summary refs log tree commit diff
path: root/io_uring
diff options
context:
space:
mode:
authorOndrej Mosnacek <omosnace@redhat.com>2023-07-18 13:56:07 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-03 10:23:48 +0200
commit04f7d4917471f77d87568145b646d12f51342e8d (patch)
tree6ab292eb32e9a43ce35fcb11a52bbf544a088ce3 /io_uring
parent017f686bcb536ff23d49c143fdf9d1fd89a9a924 (diff)
downloadlinux-04f7d4917471f77d87568145b646d12f51342e8d.tar.gz
io_uring: don't audit the capability check in io_uring_create()
[ Upstream commit 6adc2272aaaf84f34b652cf77f770c6fcc4b8336 ]

The check being unconditional may lead to unwanted denials reported by
LSMs when a process has the capability granted by DAC, but denied by an
LSM. In the case of SELinux such denials are a problem, since they can't
be effectively filtered out via the policy and when not silenced, they
produce noise that may hide a true problem or an attack.

Since not having the capability merely means that the created io_uring
context will be accounted against the current user's RLIMIT_MEMLOCK
limit, we can disable auditing of denials for this check by using
ns_capable_noaudit() instead of capable().

Fixes: 2b188cc1bb85 ("Add io_uring IO interface")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2193317
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Link: https://lore.kernel.org/r/20230718115607.65652-1-omosnace@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/io_uring.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index bd7b8cf8bc67..f091153bc854 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3477,7 +3477,7 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
 		ctx->syscall_iopoll = 1;
 
 	ctx->compat = in_compat_syscall();
-	if (!capable(CAP_IPC_LOCK))
+	if (!ns_capable_noaudit(&init_user_ns, CAP_IPC_LOCK))
 		ctx->user = get_uid(current_user());
 
 	/*