]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
authorKaixiong Yu <yukaixiong@huawei.com>
Sat, 11 Jan 2025 07:07:49 +0000 (15:07 +0800)
committerJoel Granados <joel.granados@kernel.org>
Fri, 7 Feb 2025 15:53:04 +0000 (16:53 +0100)
When CONFIG_SUPERH and CONFIG_VSYSCALL are defined,
vdso_enabled belongs to arch/sh/kernel/vsyscall/vsyscall.c.
So, move it into its own file. To avoid failure when registering
the vdso_table, move the call to register_sysctl_init() into
its own fs_initcall().

Signed-off-by: Kaixiong Yu <yukaixiong@huawei.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Signed-off-by: Joel Granados <joel.granados@kernel.org>
arch/sh/kernel/vsyscall/vsyscall.c
kernel/sysctl.c

index add35c51e017811241a944fa8ca131f357d85d73..d80dd92a483afa11acc6b738e0f78461ebf04873 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/elf.h>
 #include <linux/sched.h>
+#include <linux/sysctl.h>
 #include <linux/err.h>
 
 /*
@@ -30,6 +31,17 @@ static int __init vdso_setup(char *s)
 }
 __setup("vdso=", vdso_setup);
 
+static const struct ctl_table vdso_table[] = {
+       {
+               .procname       = "vdso_enabled",
+               .data           = &vdso_enabled,
+               .maxlen         = sizeof(vdso_enabled),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec,
+               .extra1         = SYSCTL_ZERO,
+       },
+};
+
 /*
  * These symbols are defined by vsyscall.o to mark the bounds
  * of the ELF DSO images included therein.
@@ -58,6 +70,14 @@ int __init vsyscall_init(void)
        return 0;
 }
 
+static int __init vm_sysctl_init(void)
+{
+       register_sysctl_init("vm", vdso_table);
+       return 0;
+}
+
+fs_initcall(vm_sysctl_init);
+
 /* Setup a VMA at program startup for the vsyscall page */
 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 {
index c4833a555bd2c8588e991f88134113c87afcb0d5..ebe7c19abffb0a7bc9e688b418db85d32567c199 100644 (file)
@@ -2012,18 +2012,7 @@ static const struct ctl_table kern_table[] = {
 #endif
 };
 
-static const struct ctl_table vm_table[] = {
-#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)
-       {
-               .procname       = "vdso_enabled",
-               .data           = &vdso_enabled,
-               .maxlen         = sizeof(vdso_enabled),
-               .mode           = 0644,
-               .proc_handler   = proc_dointvec,
-               .extra1         = SYSCTL_ZERO,
-       },
-#endif
-};
+static const struct ctl_table vm_table[] = {};
 
 int __init sysctl_init_bases(void)
 {