Skip to content

Commit f569ca4

Browse files
yukaixiongJoelgranados
authored andcommitted
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 <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Joel Granados <[email protected]>
1 parent a33e288 commit f569ca4

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

arch/sh/kernel/vsyscall/vsyscall.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/module.h>
1515
#include <linux/elf.h>
1616
#include <linux/sched.h>
17+
#include <linux/sysctl.h>
1718
#include <linux/err.h>
1819

1920
/*
@@ -30,6 +31,17 @@ static int __init vdso_setup(char *s)
3031
}
3132
__setup("vdso=", vdso_setup);
3233

34+
static const struct ctl_table vdso_table[] = {
35+
{
36+
.procname = "vdso_enabled",
37+
.data = &vdso_enabled,
38+
.maxlen = sizeof(vdso_enabled),
39+
.mode = 0644,
40+
.proc_handler = proc_dointvec,
41+
.extra1 = SYSCTL_ZERO,
42+
},
43+
};
44+
3345
/*
3446
* These symbols are defined by vsyscall.o to mark the bounds
3547
* of the ELF DSO images included therein.
@@ -58,6 +70,14 @@ int __init vsyscall_init(void)
5870
return 0;
5971
}
6072

73+
static int __init vm_sysctl_init(void)
74+
{
75+
register_sysctl_init("vm", vdso_table);
76+
return 0;
77+
}
78+
79+
fs_initcall(vm_sysctl_init);
80+
6181
/* Setup a VMA at program startup for the vsyscall page */
6282
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
6383
{

kernel/sysctl.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,18 +2012,7 @@ static const struct ctl_table kern_table[] = {
20122012
#endif
20132013
};
20142014

2015-
static const struct ctl_table vm_table[] = {
2016-
#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)
2017-
{
2018-
.procname = "vdso_enabled",
2019-
.data = &vdso_enabled,
2020-
.maxlen = sizeof(vdso_enabled),
2021-
.mode = 0644,
2022-
.proc_handler = proc_dointvec,
2023-
.extra1 = SYSCTL_ZERO,
2024-
},
2025-
#endif
2026-
};
2015+
static const struct ctl_table vm_table[] = {};
20272016

20282017
int __init sysctl_init_bases(void)
20292018
{

0 commit comments

Comments
 (0)