* [PATCH 1/5] sysctl: Nixify sysctl.sh
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 ` Joel Granados
2025-06-27 9:27 ` [PATCH 2/5] sysctl: Removed unused variable Joel Granados
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Joel Granados @ 2025-06-27 9:27 UTC (permalink / raw)
To: Kees Cook, Shuah Khan, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Andrew Morton
Cc: linux-kernel, linux-fsdevel, linux-kselftest, Joel Granados
Use "#!/usr/bin/env bash" instead of "#!/bin/bash". Needed for testing
in nix environments as they only provide /usr/bin/env at the standard
location.
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
tools/testing/selftests/sysctl/sysctl.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh
index a10350c8a46e42691f4f89763bc3e2d3dc270097..b2d8bd9026a721e96c26be20069f7f87b06a5cf7 100755
--- a/tools/testing/selftests/sysctl/sysctl.sh
+++ b/tools/testing/selftests/sysctl/sysctl.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1
# Copyright (C) 2017 Luis R. Rodriguez <mcgrof@kernel.org>
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] sysctl: Removed unused variable
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 ` Joel Granados
2025-06-27 9:27 ` [PATCH 3/5] uevent: mv uevent_helper into kobject_uevent.c Joel Granados
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Joel Granados @ 2025-06-27 9:27 UTC (permalink / raw)
To: Kees Cook, Shuah Khan, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Andrew Morton
Cc: linux-kernel, linux-fsdevel, linux-kselftest, Joel Granados
Remove unaligned_dump_stack from sysctl.h; it is no longer used or
defined.
Signed-off-by: Joel Granados <joel.granados@kernel.org>
---
include/linux/sysctl.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 30bcbc59d12d2f4cec7545e7ee3f5ea5f0eefbd7..92e9146b1104123d3dc0ff004bd681861e297581 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -243,7 +243,6 @@ int do_proc_douintvec(const struct ctl_table *table, int write,
void *data);
extern int unaligned_enabled;
-extern int unaligned_dump_stack;
extern int no_unaligned_warning;
#else /* CONFIG_SYSCTL */
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] uevent: mv uevent_helper into kobject_uevent.c
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 ` Joel Granados
2025-06-27 9:27 ` [PATCH 4/5] kernel/sys.c: Move overflow{uid,gid} sysctl into kernel/sys.c Joel Granados
2025-06-27 9:27 ` [PATCH 5/5] sysctl: rename kern_table -> sysctl_subsys_table Joel Granados
4 siblings, 0 replies; 6+ messages in thread
From: Joel Granados @ 2025-06-27 9:27 UTC (permalink / raw)
To: Kees Cook, Shuah Khan, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Andrew Morton
Cc: linux-kernel, linux-fsdevel, linux-kselftest, Joel Granados
Move both uevent_helper table into lib/kobject_uevent.c. Place the
registration early in the initcall order 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/sysctl.c | 9 ---------
lib/kobject_uevent.c | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 0716c7df7243dc38f0a49c7cae78651c3f75f5a3..2df63b69edf6fd21a58584d670e75e6f26a6e5cc 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1474,15 +1474,6 @@ static const struct ctl_table kern_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
-#endif
-#ifdef CONFIG_UEVENT_HELPER
- {
- .procname = "hotplug",
- .data = &uevent_helper,
- .maxlen = UEVENT_HELPER_PATH_LEN,
- .mode = 0644,
- .proc_handler = proc_dostring,
- },
#endif
{
.procname = "overflowuid",
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index b7f2fa08d9c82c2838b703f3fd25f6e43b88b68a..78e16b95d2101a01c442f62ad9b9133f3f8533c2 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -826,3 +826,23 @@ static int __init kobject_uevent_init(void)
postcore_initcall(kobject_uevent_init);
#endif
+
+#ifdef CONFIG_UEVENT_HELPER
+static const struct ctl_table uevent_helper_sysctl_table[] = {
+ {
+ .procname = "hotplug",
+ .data = &uevent_helper,
+ .maxlen = UEVENT_HELPER_PATH_LEN,
+ .mode = 0644,
+ .proc_handler = proc_dostring,
+ },
+};
+
+static int __init init_uevent_helper_sysctl(void)
+{
+ register_sysctl_init("kernel", uevent_helper_sysctl_table);
+ return 0;
+}
+
+postcore_initcall(init_uevent_helper_sysctl);
+#endif
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] kernel/sys.c: Move overflow{uid,gid} sysctl into kernel/sys.c
2025-06-27 9:27 [PATCH 0/5] sysctl: Remove last two ctl_tables from the kern_table array Joel Granados
` (2 preceding siblings ...)
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
2025-06-27 9:27 ` [PATCH 5/5] sysctl: rename kern_table -> sysctl_subsys_table Joel Granados
4 siblings, 0 replies; 6+ messages in thread
From: Joel Granados @ 2025-06-27 9:27 UTC (permalink / raw)
To: Kees Cook, Shuah Khan, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Andrew Morton
Cc: linux-kernel, linux-fsdevel, linux-kselftest, Joel Granados
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] sysctl: rename kern_table -> sysctl_subsys_table
2025-06-27 9:27 [PATCH 0/5] sysctl: Remove last two ctl_tables from the kern_table array Joel Granados
` (3 preceding siblings ...)
2025-06-27 9:27 ` [PATCH 4/5] kernel/sys.c: Move overflow{uid,gid} sysctl into kernel/sys.c Joel Granados
@ 2025-06-27 9:27 ` Joel Granados
4 siblings, 0 replies; 6+ messages in thread
From: Joel Granados @ 2025-06-27 9:27 UTC (permalink / raw)
To: Kees Cook, Shuah Khan, Greg Kroah-Hartman, Rafael J. Wysocki,
Danilo Krummrich, Andrew Morton
Cc: linux-kernel, linux-fsdevel, linux-kselftest, Joel Granados
Renamed sysctl table from kern_table to sysctl_subsys_table and grouped
the two arch specific ctls to the end of the array.
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 | 1 -
kernel/sysctl.c | 22 +++++++++++-----------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/kernel/sys.c b/kernel/sys.c
index bbeee62f9abcdf18cdf5cdb06271476b048357ae..18a037cc6f61a339f1f21af9c26b25ecca1ae43c 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -210,7 +210,6 @@ static int __init init_overflow_sysctl(void)
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 21b70443aea75ae3212f70e5ce7efbfdf8a4f75b..cb6196e3fa993daa21704d190baf366084e014f7 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1454,7 +1454,7 @@ int proc_do_static_key(const struct ctl_table *table, int write,
return ret;
}
-static const struct ctl_table kern_table[] = {
+static const struct ctl_table sysctl_subsys_table[] = {
#ifdef CONFIG_PROC_SYSCTL
{
.procname = "sysctl_writes_strict",
@@ -1465,15 +1465,6 @@ static const struct ctl_table kern_table[] = {
.extra1 = SYSCTL_NEG_ONE,
.extra2 = SYSCTL_ONE,
},
-#endif
-#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
- {
- .procname = "unaligned-trap",
- .data = &unaligned_enabled,
- .maxlen = sizeof (int),
- .mode = 0644,
- .proc_handler = proc_dointvec,
- },
#endif
{
.procname = "ngroups_max",
@@ -1489,6 +1480,15 @@ static const struct ctl_table kern_table[] = {
.mode = 0444,
.proc_handler = proc_dointvec,
},
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
+ {
+ .procname = "unaligned-trap",
+ .data = &unaligned_enabled,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec,
+ },
+#endif
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
{
.procname = "ignore-unaligned-usertrap",
@@ -1502,7 +1502,7 @@ static const struct ctl_table kern_table[] = {
int __init sysctl_init_bases(void)
{
- register_sysctl_init("kernel", kern_table);
+ register_sysctl_init("kernel", sysctl_subsys_table);
return 0;
}
--
2.47.2
^ permalink raw reply related [flat|nested] 6+ messages in thread