* [PATCH] audit: enforce AUDIT_LOCKED for AUDIT_TRIM and AUDIT_MAKE_EQUIV
@ 2026-05-12 13:28 Sergio Correia
2026-05-12 20:10 ` Paul Moore
0 siblings, 1 reply; 2+ messages in thread
From: Sergio Correia @ 2026-05-12 13:28 UTC (permalink / raw)
To: audit, linux-kernel; +Cc: paul, eparis, rrobaina, Sergio Correia
AUDIT_ADD_RULE and AUDIT_DEL_RULE correctly check for AUDIT_LOCKED
and return -EPERM, but AUDIT_TRIM and AUDIT_MAKE_EQUIV do not. This
allows a process with CAP_AUDIT_CONTROL to modify directory tree
watches and equivalence mappings even when the audit configuration
has been locked, undermining the purpose of the lock.
Add AUDIT_LOCKED checks to both commands.
Reviewed-by: Ricardo Robaina <rrobaina@redhat.com>
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Sergio Correia <scorreia@redhat.com>
---
kernel/audit.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/audit.c b/kernel/audit.c
index e1d489bc2dff..34dc7cb246ff 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1468,6 +1468,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
err = audit_list_rules_send(skb, seq);
break;
case AUDIT_TRIM:
+ if (audit_enabled == AUDIT_LOCKED)
+ return -EPERM;
audit_trim_trees();
audit_log_common_recv_msg(audit_context(), &ab,
AUDIT_CONFIG_CHANGE);
@@ -1480,6 +1482,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
size_t msglen = data_len;
char *old, *new;
+ if (audit_enabled == AUDIT_LOCKED)
+ return -EPERM;
err = -EINVAL;
if (msglen < 2 * sizeof(u32))
break;
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] audit: enforce AUDIT_LOCKED for AUDIT_TRIM and AUDIT_MAKE_EQUIV
2026-05-12 13:28 [PATCH] audit: enforce AUDIT_LOCKED for AUDIT_TRIM and AUDIT_MAKE_EQUIV Sergio Correia
@ 2026-05-12 20:10 ` Paul Moore
0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2026-05-12 20:10 UTC (permalink / raw)
To: Sergio Correia, audit, linux-kernel; +Cc: eparis, rrobaina, Sergio Correia
On May 12, 2026 Sergio Correia <scorreia@redhat.com> wrote:
>
> AUDIT_ADD_RULE and AUDIT_DEL_RULE correctly check for AUDIT_LOCKED
> and return -EPERM, but AUDIT_TRIM and AUDIT_MAKE_EQUIV do not. This
> allows a process with CAP_AUDIT_CONTROL to modify directory tree
> watches and equivalence mappings even when the audit configuration
> has been locked, undermining the purpose of the lock.
>
> Add AUDIT_LOCKED checks to both commands.
>
> Reviewed-by: Ricardo Robaina <rrobaina@redhat.com>
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Sergio Correia <scorreia@redhat.com>
> ---
> kernel/audit.c | 4 ++++
> 1 file changed, 4 insertions(+)
Merged into audit/stable-7.1 with the expectation of sending it up to
Linus later this week, thanks!
--
paul-moore.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-12 20:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 13:28 [PATCH] audit: enforce AUDIT_LOCKED for AUDIT_TRIM and AUDIT_MAKE_EQUIV Sergio Correia
2026-05-12 20:10 ` Paul Moore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox