Skip to content

Commit d4dc79e

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 81c34d9 commit d4dc79e

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
@@ -155,7 +155,7 @@ static __read_mostly DEFINE_STATIC_KEY_FALSE(io_key_has_sqarray);
155155
struct kmem_cache *req_cachep;
156156
static struct workqueue_struct *iou_wq __ro_after_init;
157157

158-
static int __read_mostly sysctl_io_uring_disabled;
158+
static int __read_mostly sysctl_io_uring_disabled = 1;
159159
static int __read_mostly sysctl_io_uring_group = -1;
160160

161161
#ifdef CONFIG_SYSCTL
@@ -165,8 +165,9 @@ static const struct ctl_table kernel_io_uring_disabled_table[] = {
165165
.data = &sysctl_io_uring_disabled,
166166
.maxlen = sizeof(sysctl_io_uring_disabled),
167167
.mode = 0644,
168+
/* only handle a transition from default "1" to "2" */
168169
.proc_handler = proc_dointvec_minmax,
169-
.extra1 = SYSCTL_ZERO,
170+
.extra1 = SYSCTL_TWO,
170171
.extra2 = SYSCTL_TWO,
171172
},
172173
{

0 commit comments

Comments
 (0)