[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <x49sf8iu9u4.fsf@segfault.boston.devel.redhat.com>
Date: Wed, 16 Aug 2023 14:21:39 -0400
From: Jeff Moyer <jmoyer@...hat.com>
To: Gabriel Krisman Bertazi <krisman@...e.de>
Cc: matteorizzo@...gle.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, io-uring@...r.kernel.org,
axboe@...nel.dk, asml.silence@...il.com, corbet@....net,
akpm@...ux-foundation.org, keescook@...omium.org,
ribalda@...omium.org, rostedt@...dmis.org, jannh@...gle.com,
chenhuacai@...nel.org, gpiccoli@...lia.com, ldufour@...ux.ibm.com,
evn@...gle.com, poprdi@...gle.com, jordyzomer@...gle.com,
andres@...razel.de
Subject: Re: [PATCH v4] io_uring: add a sysctl to disable io_uring system-wide
Gabriel Krisman Bertazi <krisman@...e.de> writes:
> Jeff Moyer <jmoyer@...hat.com> writes:
>
>> From: Matteo Rizzo <matteorizzo@...gle.com>
>>
>> Introduce a new sysctl (io_uring_disabled) which can be either 0, 1, or
>> 2. When 0 (the default), all processes are allowed to create io_uring
>> instances, which is the current behavior. When 1, io_uring creation is
>> disabled (io_uring_setup() will fail with -EPERM) for processes not in
>> the kernel.io_uring_group group. When 2, calls to io_uring_setup() fail
>> with -EPERM regardless of privilege.
>>
>> Signed-off-by: Matteo Rizzo <matteorizzo@...gle.com>
>> [JEM: modified to add io_uring_group]
>> Signed-off-by: Jeff Moyer <jmoyer@...hat.com>
>>
>> ---
>> v4:
>>
>> * Add a kernel.io_uring_group sysctl to hold a group id that is allowed
>> to use io_uring. One thing worth pointing out is that, when a group
>> is specified, only users in that group can create an io_uring. That
>> means that if the root user is not in that group, root can not make
>> use of io_uring.
>
> Rejecting root if it's not in the group doesn't make much sense to
> me. Of course, root can always just add itself to the group, so it is
> not a security feature. But I'd expect 'sudo <smth>' to not start giving
> EPERM based on user group settings. Can you make CAP_SYS_ADMIN
> always allowed for option 1?
Yes, that's easy to do. I'd like to gather more opinions on this before
changing it, though.
>> I also wrote unit tests for liburing. I'll post that as well if there
>> is consensus on this approach.
>
> I'm fine with this approach as it allow me to easily reject non-root users.
Thanks for taking a look!
-Jeff
Powered by blists - more mailing lists