aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/sh
diff options
context:
space:
mode:
authorKaixiong Yu <yukaixiong@huawei.com>2025-01-11 15:07:49 +0800
committerJoel Granados <joel.granados@kernel.org>2025-02-07 16:53:04 +0100
commitf569ca4b145d07fd7c3ac1349b7da40f43c38e7b (patch)
tree2d870f4a6b30044603a9e120d08c6536d31dea77 /arch/sh
parentx86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c (diff)
downloadwireguard-linux-f569ca4b145d07fd7c3ac1349b7da40f43c38e7b.tar.xz
wireguard-linux-f569ca4b145d07fd7c3ac1349b7da40f43c38e7b.zip
sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
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>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index add35c51e017..d80dd92a483a 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -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)
{