Skip to contentSkip to conversation

iouring:added boundary value check for io_uring_group systl

PATCH Superseded Subramanya Swamy 2 participants 3 messages Jan 20, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iouring:added boundary value check for io_uring_group systl

/proc/sys/kernel/io_uring_group takes gid as input added boundary value check to accept gid in range of 0<=gid<=4294967294 & Documentation is updated for same

---
 Documentation/admin-guide/sysctl/kernel.rst | 6 ++----
 io_uring/io_uring.c                         | 8 ++++++--
 2 files changed, 8 insertions(+), 6 deletions(-)
Documentation/admin-guide/sysctl/kernel.rst +2 -4
index 6584a1f9bfe3..a8b61ab3e118 100644
@@ -470,10 +470,8 @@ io_uring_group
 ==============
 
 When io_uring_disabled is set to 1, a process must either be
-privileged (CAP_SYS_ADMIN) or be in the io_uring_group group in order
-to create an io_uring instance.  If io_uring_group is set to -1 (the
-default), only processes with the CAP_SYS_ADMIN capability may create
-io_uring instances.
+privledged (CAP_SYS_ADMIN) or be in the io_uring_group group in order
+to create an io_uring instance.
 
 
 kexec_load_disabled
io_uring/io_uring.c +6 -2
index cd9a137ad6ce..bd6cc0391efa 100644
@@ -154,9 +154,11 @@ static void io_queue_sqe(struct io_kiocb *req);
 struct kmem_cache *req_cachep;
 
 static int __read_mostly sysctl_io_uring_disabled;
-static int __read_mostly sysctl_io_uring_group = -1;
+static unsigned int __read_mostly sysctl_io_uring_group;
 
 #ifdef CONFIG_SYSCTL
+static unsigned int max_gid  = ((gid_t) ~0U) - 1; /*4294967294 is the max guid*/
+
 static struct ctl_table kernel_io_uring_disabled_table[] = {
 	{
 		.procname	= "io_uring_disabled",
@@ -172,7 +174,9 @@ static struct ctl_table kernel_io_uring_disabled_table[] = {
 		.data		= &sysctl_io_uring_group,
 		.maxlen		= sizeof(gid_t),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
+		.proc_handler	= proc_douintvec_minmax,
+		.extra1         = SYSCTL_ZERO,
+		.extra2         = &max_gid,
 	},
 	{},
 };
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 3 lines · Subramanya Swamy

/proc/sys/kernel/io_uring_group takes gid as input added boundary value check to accept gid in range of 0<=gid<=4294967294 & Documentation is updated for same

This should have:

Fixes 76d3ccecfa18 ("io_uring: add a sysctl to disable io_uring system-wide")

Documentation/admin-guide/sysctl/kernel.rst io_uring_group · line 473

Quoted 13 lines
Documentation/admin-guide/sysctl/kernel.rst +1 -4
index 6584a1f9bfe3..a8b61ab3e118 100644
@@ -470,10 +470,8 @@ io_uring_group
 ==============
 
 When io_uring_disabled is set to 1, a process must either be
-privileged (CAP_SYS_ADMIN) or be in the io_uring_group group in order
-to create an io_uring instance.  If io_uring_group is set to -1 (the
-default), only processes with the CAP_SYS_ADMIN capability may create
-io_uring instances.
+privledged (CAP_SYS_ADMIN) or be in the io_uring_group group in order

privileged.

Signature · 1 line
Jens Axboe
#2 lore raw

Hi Jens,

Quoted 7 lines · Jens Axboe
Quoted 3 lines · Subramanya Swamy

/proc/sys/kernel/io_uring_group takes gid as input added boundary value check to accept gid in range of 0<=gid<=4294967294 & Documentation is updated for same

This should have:

Fixes 76d3ccecfa18 ("io_uring: add a sysctl to disable io_uring system-wide")

 added fixes to commit msg in v3

Quoted 7 lines
Quoted 7 lines
Documentation/admin-guide/sysctl/kernel.rst +0 -0
index 6584a1f9bfe3..a8b61ab3e118 100644
@@ -470,10 +470,8 @@ io_uring_group
  ==============
 
Quoted 7 lines

Documentation/admin-guide/sysctl/kernel.rst io_uring_group · line 473

Quoted 6 lines
Documentation/admin-guide/sysctl/kernel.rst +1 -4
  When io_uring_disabled is set to 1, a process must either be
-privileged (CAP_SYS_ADMIN) or be in the io_uring_group group in order
-to create an io_uring instance.  If io_uring_group is set to -1 (the
-default), only processes with the CAP_SYS_ADMIN capability may create
-io_uring instances.
+privledged (CAP_SYS_ADMIN) or be in the io_uring_group group in order

privileged.

fixed  typo in v3

Signature · 2 lines
Best Regards
Subramanya