[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <x49lefd4aad.fsf@segfault.boston.devel.redhat.com>
Date: Tue, 18 Jul 2023 09:30:18 -0400
From: Jeff Moyer <jmoyer@...hat.com>
To: Ondrej Mosnacek <omosnace@...hat.com>
Cc: Jens Axboe <axboe@...nel.dk>,
Pavel Begunkov <asml.silence@...il.com>,
io-uring@...r.kernel.org, linux-security-module@...r.kernel.org,
selinux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] io_uring: don't audit the capability check in io_uring_create()
Hi, Ondrej,
Ondrej Mosnacek <omosnace@...hat.com> writes:
> 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().
Could you add a comment, or add some documentation to
ns_capable_noaudit() about when it should be used? It wasn't apparent
to me, at least, before this explanation.
> Fixes: 2b188cc1bb85 ("Add io_uring IO interface")
> Link: https://bugzilla.redhat.com/show_bug.cgi?id=2193317
> Signed-off-by: Ondrej Mosnacek <omosnace@...hat.com>
> ---
> io_uring/io_uring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 7505de2428e03..a9923676d16d6 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -3870,7 +3870,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());
>
> /*
Reviewed-by: Jeff Moyer <jmoyer@...hat.com>
Powered by blists - more mailing lists