Skip to contentSkip to conversation

ipc-dont-audit-capability-check-in-ipc_permissions.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Feb 1

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: ipc: don't audit capability check in ipc_permissions()
has been removed from the -mm tree. Its filename was
ipc-dont-audit-capability-check-in-ipc_permissions.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Ondrej Mosnacek <[email protected]>
Subject: ipc: don't audit capability check in ipc_permissions()
Date: Thu, 22 Jan 2026 15:13:03 +0100

The IPC sysctls implement the ctl_table_root::permissions hook and they override the file access mode based on the CAP_CHECKPOINT_RESTORE capability, which is being checked regardless of whether any access is actually denied or not, so if an LSM denies the capability, an audit record may be logged even when access is in fact granted.

It wouldn't be viable to restructure the sysctl permission logic to only check the capability when the access would be actually denied if it's not granted. Thus, do the same as in net_ctl_permissions() (net/sysctl_net.c)
- switch from ns_capable() to ns_capable_noaudit(), so that the check never emits an audit record.

Fixes 0889f44e2810 ("ipc: Check permissions for checkpoint_restart sysctls at open time")
Cc Eric Biederman <[email protected]>
Cc Paul Moore <[email protected]>

---

 include/linux/capability.h |    6 ++++++
 ipc/ipc_sysctl.c           |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
include/linux/capability.h renamed from include/linux/capability.h~ipc-dont-audit-capability-check-in-ipc_permissions +6 -0
@@ -203,6 +203,12 @@ static inline bool checkpoint_restore_ns
 		ns_capable(ns, CAP_SYS_ADMIN);
 }
 
+static inline bool checkpoint_restore_ns_capable_noaudit(struct user_namespace *ns)
+{
+	return ns_capable_noaudit(ns, CAP_CHECKPOINT_RESTORE) ||
+		ns_capable_noaudit(ns, CAP_SYS_ADMIN);
+}
+
 /* audit system wants to get cap info from files as well */
 int get_vfs_caps_from_disk(struct mnt_idmap *idmap,
 			   const struct dentry *dentry,
ipc/ipc_sysctl.c renamed from ipc/ipc_sysctl.c~ipc-dont-audit-capability-check-in-ipc_permissions +1 -1
@@ -214,7 +214,7 @@ static int ipc_permissions(struct ctl_ta
 	if (((table->data == &ns->ids[IPC_SEM_IDS].next_id) ||
 	     (table->data == &ns->ids[IPC_MSG_IDS].next_id) ||
 	     (table->data == &ns->ids[IPC_SHM_IDS].next_id)) &&
-	    checkpoint_restore_ns_capable(ns->user_ns))
+	    checkpoint_restore_ns_capable_noaudit(ns->user_ns))
 		mode = 0666;
 	else
 #endif

_

Patches currently in -mm which might be from [email protected] are