summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorOndrej Mosnacek <omosnace@redhat.com>2026-01-22 17:13:03 +0300
committerSerge Hallyn <sergeh@kernel.org>2026-01-28 06:30:42 +0300
commit071588136007482d70fd2667b827036bc60b1f8f (patch)
treec94a8a5c2e235f92a664fdacde34cfe1c2fd3bcf /include/linux
parent24e9b431b5837bc9d2cf2c2fde4abf507e2fae19 (diff)
downloadlinux-071588136007482d70fd2667b827036bc60b1f8f.tar.xz
ipc: don't audit capability check in ipc_permissions()
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") Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> Acked-by: Alexey Gladkov <legion@kernel.org> Acked-by: Serge Hallyn <serge@hallyn.com> Signed-off-by: Serge Hallyn <sergeh@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/capability.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 1fb08922552c..37db92b3d6f8 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -203,6 +203,12 @@ static inline bool checkpoint_restore_ns_capable(struct user_namespace *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,