Skip to content

Commit 6adc227

Browse files
WOnder93axboe
authored andcommitted
io_uring: don't audit the capability check in io_uring_create()
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: 2b188cc ("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>
1 parent 8a79656 commit 6adc227

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/io_uring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3870,7 +3870,7 @@ static __cold int io_uring_create(unsigned entries, struct io_uring_params *p,
38703870
ctx->syscall_iopoll = 1;
38713871

38723872
ctx->compat = in_compat_syscall();
3873-
if (!capable(CAP_IPC_LOCK))
3873+
if (!ns_capable_noaudit(&init_user_ns, CAP_IPC_LOCK))
38743874
ctx->user = get_uid(current_user());
38753875

38763876
/*

0 commit comments

Comments
 (0)