io_uring: add a sysctl to disable io_uring system-wide
authorMatteo Rizzo <matteorizzo@google.com>
Mon, 21 Aug 2023 21:15:52 +0000 (17:15 -0400)
committerJens Axboe <axboe@kernel.dk>
Tue, 5 Sep 2023 14:34:07 +0000 (08:34 -0600)
commit76d3ccecfa186af3120e206d62f03db1a94a535f
tree8b3760ca153fe6e034e0caaaf7558055ad88afa3
parent32f5dea040ee6e3cc30ac52d23f1674fd5110d03
io_uring: add a sysctl to disable io_uring system-wide

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 unprivileged
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@google.com>
[JEM: modified to add io_uring_group]
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Link: https://lore.kernel.org/r/x49y1i42j1z.fsf@segfault.boston.devel.redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Documentation/admin-guide/sysctl/kernel.rst
io_uring/io_uring.c