From: Joel Granados <joel.granados@kernel.org>
To: Kees Cook <kees@kernel.org>, Shuah Khan <shuah@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Joel Granados <joel.granados@kernel.org>
Subject: [PATCH 4/5] kernel/sys.c: Move overflow{uid,gid} sysctl into kernel/sys.c
Date: Fri, 27 Jun 2025 11:27:28 +0200 [thread overview]
Message-ID: <20250627-jag-sysctl-v1-4-20dd9801420b@kernel.org> (raw)
In-Reply-To: <20250627-jag-sysctl-v1-0-20dd9801420b@kernel.org>
Moved ctl_tables elements for overflowuid and overflowgid into in
kernel/sys.c. Create a register function that keeps them under "kernel"
and run it after core with postcore_initcall.
This is part of a greater effort to move ctl tables into their
respective subsystems which will reduce the merge conflicts in
kernel/sysctl.c.
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
kernel/sys.c | 30 ++++++++++++++++++++++++++++++
kernel/sysctl.c | 18 ------------------
2 files changed, 30 insertions(+), 18 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index adc0de0aa364aebb23999f621717a5d32599921c..bbeee62f9abcdf18cdf5cdb06271476b048357ae 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -181,6 +181,36 @@ int fs_overflowgid = DEFAULT_FS_OVERFLOWGID;
EXPORT_SYMBOL(fs_overflowuid);
EXPORT_SYMBOL(fs_overflowgid);
+static const struct ctl_table overflow_sysctl_table[] = {
+ {
+ .procname = "overflowuid",
+ .data = &overflowuid,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_MAXOLDUID,
+ },
+ {
+ .procname = "overflowgid",
+ .data = &overflowgid,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_MAXOLDUID,
+ },
+};
+
+static int __init init_overflow_sysctl(void)
+{
+ register_sysctl_init("kernel", overflow_sysctl_table);
+ return 0;
+}
+
+postcore_initcall(init_overflow_sysctl);
+
+
/*
* Returns true if current's euid is same as p's uid or euid,
* or has CAP_SYS_NICE to p's user_ns.
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 2df63b69edf6fd21a58584d670e75e6f26a6e5cc..21b70443aea75ae3212f70e5ce7efbfdf8a4f75b 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1475,24 +1475,6 @@ static const struct ctl_table kern_table[] = {
.proc_handler = proc_dointvec,
},
#endif
- {
- .procname = "overflowuid",
- .data = &overflowuid,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_MAXOLDUID,
- },
- {
- .procname = "overflowgid",
- .data = &overflowgid,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_MAXOLDUID,
- },
{
.procname = "ngroups_max",
.data = (void *)&ngroups_max,
--
2.47.2
next prev parent reply other threads:[~2025-06-27 9:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 9:27 [PATCH 0/5] sysctl: Remove last two ctl_tables from the kern_table array Joel Granados
2025-06-27 9:27 ` [PATCH 1/5] sysctl: Nixify sysctl.sh Joel Granados
2025-06-27 9:27 ` [PATCH 2/5] sysctl: Removed unused variable Joel Granados
2025-06-27 9:27 ` [PATCH 3/5] uevent: mv uevent_helper into kobject_uevent.c Joel Granados
2025-06-27 9:27 ` Joel Granados [this message]
2025-06-27 9:27 ` [PATCH 5/5] sysctl: rename kern_table -> sysctl_subsys_table Joel Granados
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=20250627-jag-sysctl-v1-4-20dd9801420b@kernel.org \
--to=joel.granados@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dakr@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kees@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=shuah@kernel.org \
/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
all inboxes | Powered by JetHome®