From: Subramanya Swamy <subramanya.swamy.linux@gmail.com>
To: corbet@lwn.net, jmoyer@redhat.com, axboe@kernel.dk,
asml.silence@gmail.com, akpm@linux-foundation.org,
bhe@redhat.com, ribalda@chromium.org, rostedt@goodmis.org,
subramanya.swamy.linux@gmail.com, sshegde@linux.vnet.ibm.com,
alexghiti@rivosinc.com, matteorizzo@google.com, ardb@kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
io-uring@vger.kernel.org
Subject: [PATCH v3] iouring:added boundary value check for io_uring_group systl
Date: Sat, 20 Jan 2024 18:19:25 +0000 [thread overview]
Message-ID: <20240120181925.1959-1-subramanya.swamy.linux@gmail.com> (raw)
/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
Fixes: 76d3ccecfa18 ("io_uring: add a sysctl to disable io_uring system-wide")
Signed-off-by: Subramanya Swamy <subramanya.swamy.linux@gmail.com>
---
Documentation/admin-guide/sysctl/kernel.rst | 4 +---
io_uring/io_uring.c | 8 ++++++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
index 6584a1f9bfe3..262d92f51fa5 100644
--- a/Documentation/admin-guide/sysctl/kernel.rst
+++ b/Documentation/admin-guide/sysctl/kernel.rst
@@ -471,9 +471,7 @@ 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.
+to create an io_uring instance.
kexec_load_disabled
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index cd9a137ad6ce..bd6cc0391efa 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -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,
},
{},
};
--
2.34.1
reply other threads:[~2024-01-20 18:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240120181925.1959-1-subramanya.swamy.linux@gmail.com \
--to=subramanya.swamy.linux@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=ardb@kernel.org \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=bhe@redhat.com \
--cc=corbet@lwn.net \
--cc=io-uring@vger.kernel.org \
--cc=jmoyer@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matteorizzo@google.com \
--cc=ribalda@chromium.org \
--cc=rostedt@goodmis.org \
--cc=sshegde@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox