path: root/fs/proc/proc_sysctl.c
diff options
authorLuis Chamberlain <>2022-01-21 22:13:24 -0800
committerLinus Torvalds <>2022-01-22 08:33:36 +0200
commit51cb8dfc5a5c39e6c70376b9dc9a14d624a9d271 (patch)
tree11ebe5d1dd56770f6cf2ba3bfd8fa67ac9be25dc /fs/proc/proc_sysctl.c
parent1998f19324d24df7de4e74d81503b4299eb99e7d (diff)
sysctl: add and use base directory declarer and registration helper
Patch series "sysctl: add and use base directory declarer and registration helper". In this patch series we start addressing base directories, and so we start with the "fs" sysctls. The end goal is we end up completely moving all "fs" sysctl knobs out from kernel/sysctl. This patch (of 6): Add a set of helpers which can be used to declare and register base directory sysctls on their own. We do this so we can later move each of the base sysctl directories like "fs", "kernel", etc, to their own respective files instead of shoving the declarations and registrations all on kernel/sysctl.c. The lazy approach has caught up and with this, we just end up extending the list of base directories / sysctls on one file and this makes maintenance difficult due to merge conflicts from many developers. The declarations are used first by kernel/sysctl.c for registration its own base which over time we'll try to clean up. It will be used in the next patch to demonstrate how to cleanly deal with base sysctl directories. [ null-terminate the ctl_table arrays] Link: Link: Link: Signed-off-by: Luis Chamberlain <> Cc: Al Viro <> Cc: Kees Cook <> Cc: Iurii Zaikin <> Cc: Xiaoming Ni <> Cc: Eric Biederman <> Cc: Stephen Kitt <> Cc: Lukas Middendorf <> Cc: Antti Palosaari <> Cc: Christian Brauner <> Cc: Eric Biggers <> Cc: "Naveen N. Rao" <> Cc: "David S. Miller" <> Cc: Masami Hiramatsu <> Cc: Anil S Keshavamurthy <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index b9d53b53d769..95dfd195e04e 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1646,6 +1646,15 @@ struct ctl_table_header *register_sysctl_table(struct ctl_table *table)
+int __register_sysctl_base(struct ctl_table *base_table)
+ struct ctl_table_header *hdr;
+ hdr = register_sysctl_table(base_table);
+ kmemleak_not_leak(hdr);
+ return 0;
static void put_links(struct ctl_table_header *header)
struct ctl_table_set *root_set = &sysctl_table_root.default_set;