]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fanotify: avoid/silence premature LSM capability checks
authorOndrej Mosnacek <omosnace@redhat.com>
Mon, 16 Feb 2026 15:06:24 +0000 (16:06 +0100)
committerJan Kara <jack@suse.cz>
Thu, 26 Feb 2026 14:18:31 +0000 (15:18 +0100)
commit0d5ee3373426395478c355f3e93ba4b1118a04e9
tree755061fd20e276dee77431e97ed3efb74935167c
parent6a320935fa4293e9e599ec9f85dc9eb3be7029f8
fanotify: avoid/silence premature LSM capability checks

Make sure calling capable()/ns_capable() actually leads to access denied
when false is returned, because these functions emit an audit record
when a Linux Security Module denies the capability, which makes it
difficult to avoid allowing/silencing unnecessary permissions in
security policies (namely with SELinux).

Where the return value just used to set a flag, use the non-auditing
ns_capable_noaudit() instead.

Fixes: 7cea2a3c505e ("fanotify: support limited functionality for unprivileged users")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Reviewed-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/20260216150625.793013-2-omosnace@redhat.com
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/fanotify/fanotify_user.c