Skip to content

Commit b949d74

Browse files
nbouchinet-anssianthraxx
authored andcommitted
io_uring: set io_uring_disabled sysctl to 1 by default
This forces processes to have `CAP_SYS_ADMIN` in order to use io_uring or to be in the io_uring_group. The patch alter the sysctl value range in order that once set to "2" it can't be lowered again. The io_uring_group sysctl option is set to -1 by default, user should define a proper group and set the sysctl properly if they want it configured. Signed-off-by: Nicolas Bouchinet <[email protected]>
1 parent e6e1903 commit b949d74

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

io_uring/io_uring.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void io_queue_sqe(struct io_kiocb *req);
150150
struct kmem_cache *req_cachep;
151151
static struct workqueue_struct *iou_wq __ro_after_init;
152152

153-
static int __read_mostly sysctl_io_uring_disabled;
153+
static int __read_mostly sysctl_io_uring_disabled = 1;
154154
static int __read_mostly sysctl_io_uring_group = -1;
155155

156156
#ifdef CONFIG_SYSCTL
@@ -160,8 +160,9 @@ static struct ctl_table kernel_io_uring_disabled_table[] = {
160160
.data = &sysctl_io_uring_disabled,
161161
.maxlen = sizeof(sysctl_io_uring_disabled),
162162
.mode = 0644,
163+
/* only handle a transition from default "1" to "2" */
163164
.proc_handler = proc_dointvec_minmax,
164-
.extra1 = SYSCTL_ZERO,
165+
.extra1 = SYSCTL_TWO,
165166
.extra2 = SYSCTL_TWO,
166167
},
167168
{

0 commit comments

Comments
 (0)