From: Paul Moore <paul@paul-moore.com>
To: "Christian Göttsche" <cgoettsche@seltendoof.de>, selinux@vger.kernel.org
Cc: "Stephen Smalley" <stephen.smalley.work@gmail.com>,
"Ondrej Mosnacek" <omosnacek@gmail.com>,
"Christian Göttsche" <cgzones@googlemail.com>
Subject: Re: [PATCH RFC 1/32] selinux: remove unused AVC update events
Date: Fri, 04 Dec 2026 22:28:20 -0500 [thread overview]
Message-ID: <2a5d98fd538cd6033290fe804c395c3d@paul-moore.com> (raw)
In-Reply-To: <20260928174643.2458710-32-cgoettsche@seltendoof.de>
On Sep 28, 2026 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgoettsche@seltendoof.de> wrote:
>
> avc_update_node() is only ever called with AVC_CALLBACK_GRANT or
> AVC_CALLBACK_ADD_XPERMS. Drop the unreachable revoke and audit toggle
> cases and their now unused event macros.
>
> Convert the remaining update events, which are only used within avc.c,
> into a local enum.
>
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> ---
> security/selinux/avc.c | 26 ++++++++------------------
> security/selinux/include/avc.h | 8 --------
> 2 files changed, 8 insertions(+), 26 deletions(-)
>
> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
> index dd8905648b6a..936e116b01fb 100644
> --- a/security/selinux/avc.c
> +++ b/security/selinux/avc.c
> @@ -812,6 +812,11 @@ int __init avc_add_callback(int (*callback)(u32 event), u32 events)
> return rc;
> }
>
> +enum avc_update_event {
> + AVC_CALLBACK_GRANT,
> + AVC_CALLBACK_ADD_XPERMS,
> +};
> +
...
> diff --git a/security/selinux/include/avc.h b/security/selinux/include/avc.h
> index 87027a934a11..0f788dfc66e9 100644
> --- a/security/selinux/include/avc.h
> +++ b/security/selinux/include/avc.h
> @@ -149,15 +149,7 @@ int avc_has_extended_perms(u32 ssid, u32 tsid, u16 tclass, u32 requested,
>
> u32 avc_policy_seqno(void);
>
> -#define AVC_CALLBACK_GRANT 1
> -#define AVC_CALLBACK_TRY_REVOKE 2
> -#define AVC_CALLBACK_REVOKE 4
> #define AVC_CALLBACK_RESET 8
> -#define AVC_CALLBACK_AUDITALLOW_ENABLE 16
> -#define AVC_CALLBACK_AUDITALLOW_DISABLE 32
> -#define AVC_CALLBACK_AUDITDENY_ENABLE 64
> -#define AVC_CALLBACK_AUDITDENY_DISABLE 128
> -#define AVC_CALLBACK_ADD_XPERMS 256
Let's keep all of the AVC_CALLBACK_* values in the same place. Splitting
up the values like this makes the code much harder to read and with the
values being split between an implicitly numbered enum and an explicitly
numbered #define there is also a risk of overlapping values.
I would suggest moving moving the avc_update_event enum to avc.h and
including AVC_CALLBACK_RESET.
--
paul-moore.com
next prev parent reply other threads:[~2026-12-05 3:28 UTC|newest]
Thread overview: 96+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 17:46 [RFC PATCH 02/32] selinux: drop event filtering from AVC callbacks Christian Göttsche
2026-09-28 17:46 ` [RFC PATCH 03/32] selinux: use kfree_strarray() Christian Göttsche
2026-09-29 15:26 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 3/32] " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 04/32] selinux: use vmemdup_user() for policy loading Christian Göttsche
2026-09-29 15:29 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 4/32] " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 05/32] selinux: use kmemdup_array() for conditional expressions Christian Göttsche
2026-09-29 15:30 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 5/32] " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 06/32] selinux: use memcpy_{from,to}_le32() in avtab Christian Göttsche
2026-09-29 15:31 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 6/32] " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 07/32] selinux: drop constant value parameter of ebitmap_set_bit() Christian Göttsche
2026-09-29 15:32 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 7/32] " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 08/32] selinux: use rounddown() and roundup() in ebitmap Christian Göttsche
2026-09-29 15:35 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 8/32] " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 09/32] selinux: factor out sel_make_files() Christian Göttsche
2026-09-29 15:36 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 9/32] " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 10/32] selinux: use struct_size() and isdigit() Christian Göttsche
2026-09-29 15:36 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 11/32] selinux: use file table names to mark selinuxfs inodes immutable Christian Göttsche
2026-09-29 15:37 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 12/32] selinux: avoid context string allocation on getxattr size query Christian Göttsche
2026-09-29 15:38 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 13/32] selinux: remove unused SECSID_WILD and sidtab_search_force() Christian Göttsche
2026-09-29 15:39 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 14/32] selinux: make sidtab_init() return void Christian Göttsche
2026-09-29 15:40 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 15/32] selinux: make mls_level_isvalid() static Christian Göttsche
2026-09-29 15:41 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 16/32] selinux: drop unused policydb parameter of perm_read() Christian Göttsche
2026-09-29 15:46 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 17/32] selinux: drop redundant last_class_ino parameter Christian Göttsche
2026-09-29 15:47 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 18/32] selinux: drop dead NULL check in sel_open_policy() Christian Göttsche
2026-09-29 15:49 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 19/32] selinux: drop no-op gotos in ocontext SID lookups Christian Göttsche
2026-09-29 15:50 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 20/32] selinux: consolidate MLS context copy helpers Christian Göttsche
2026-09-29 15:51 ` Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 21/32] selinux: simplify mls_context_glblub() and mls_context_equal() Christian Göttsche
2026-09-29 15:52 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 22/32] selinux: factor out constraint_list_destroy() Christian Göttsche
2026-09-29 15:53 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 23/32] selinux: simplify nlmsg_perm() Christian Göttsche
2026-09-29 15:55 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 24/32] selinux: factor out sel_sid_to_payload() Christian Göttsche
2026-09-29 15:56 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 25/32] selinux: share implementation of relabel and member transactions Christian Göttsche
2026-09-29 15:56 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 26/32] selinux: drop page_mkwrite handler for the policy mapping Christian Göttsche
2026-09-29 16:01 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 27/32] selinux: fail mount if status or policy cannot be marked immutable Christian Göttsche
2026-09-29 16:03 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 28/32] selinux: pass inode number by value to sel_make_dir() Christian Göttsche
2026-09-29 16:04 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 29/32] selinux: drop sb member of struct selinux_fs_info Christian Göttsche
2026-09-29 16:05 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 30/32] selinux: add level_val_to_struct[] for sensitivity lookups Christian Göttsche
2026-09-29 16:07 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 31/32] selinux: add policydb_class_datum() helper Christian Göttsche
2026-09-29 16:10 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 32/32] selinux: drop unused policydb parameter of context_write() Christian Göttsche
2026-09-29 16:11 ` Stephen Smalley
2026-12-05 3:29 ` [PATCH RFC " Paul Moore
2026-09-28 17:46 ` [RFC PATCH 01/32] selinux: remove unused AVC update events Christian Göttsche
2026-09-29 15:23 ` Stephen Smalley
2026-12-05 3:28 ` Paul Moore [this message]
2026-09-29 15:24 ` [RFC PATCH 02/32] selinux: drop event filtering from AVC callbacks Stephen Smalley
2026-12-05 3:28 ` [PATCH RFC 2/32] " Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2a5d98fd538cd6033290fe804c395c3d@paul-moore.com \
--to=paul@paul-moore.com \
--cc=cgoettsche@seltendoof.de \
--cc=cgzones@googlemail.com \
--cc=omosnacek@gmail.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.