Skip to content

Commit a33e288

Browse files
yukaixiongJoelgranados
authored andcommitted
x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
When CONFIG_X86_32 is defined and CONFIG_UML is not defined, vdso_enabled belongs to arch/x86/entry/vdso/vdso32-setup.c. So, move it into its own file. Before this patch, vdso_enabled was allowed to be set to a value exceeding 1 on x86_32 architecture. After this patch is applied, vdso_enabled is not permitted to set the value more than 1. It does not matter, because according to the function load_vdso32(), only vdso_enabled is set to 1, VDSO would be enabled. Other values all mean "disabled". The same limitation could be seen in the function vdso32_setup(). Signed-off-by: Kaixiong Yu <[email protected]> Reviewed-by: Kees Cook <[email protected]> Signed-off-by: Joel Granados <[email protected]>
1 parent 52e6682 commit a33e288

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

arch/x86/entry/vdso/vdso32-setup.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ __setup("vdso32=", vdso32_setup);
5151
__setup_param("vdso=", vdso_setup, vdso32_setup, 0);
5252
#endif
5353

54-
#ifdef CONFIG_X86_64
5554

5655
#ifdef CONFIG_SYSCTL
57-
/* Register vsyscall32 into the ABI table */
5856
#include <linux/sysctl.h>
5957

60-
static const struct ctl_table abi_table2[] = {
58+
static const struct ctl_table vdso_table[] = {
6159
{
60+
#ifdef CONFIG_X86_64
6261
.procname = "vsyscall32",
62+
#else
63+
.procname = "vdso_enabled",
64+
#endif
6365
.data = &vdso32_enabled,
6466
.maxlen = sizeof(int),
6567
.mode = 0644,
@@ -71,10 +73,14 @@ static const struct ctl_table abi_table2[] = {
7173

7274
static __init int ia32_binfmt_init(void)
7375
{
74-
register_sysctl("abi", abi_table2);
76+
#ifdef CONFIG_X86_64
77+
/* Register vsyscall32 into the ABI table */
78+
register_sysctl("abi", vdso_table);
79+
#else
80+
register_sysctl_init("vm", vdso_table);
81+
#endif
7582
return 0;
7683
}
7784
__initcall(ia32_binfmt_init);
7885
#endif /* CONFIG_SYSCTL */
7986

80-
#endif /* CONFIG_X86_64 */

kernel/sysctl.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,17 +2013,11 @@ static const struct ctl_table kern_table[] = {
20132013
};
20142014

20152015
static const struct ctl_table vm_table[] = {
2016-
#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
2017-
(defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
2016+
#if defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL)
20182017
{
20192018
.procname = "vdso_enabled",
2020-
#ifdef CONFIG_X86_32
2021-
.data = &vdso32_enabled,
2022-
.maxlen = sizeof(vdso32_enabled),
2023-
#else
20242019
.data = &vdso_enabled,
20252020
.maxlen = sizeof(vdso_enabled),
2026-
#endif
20272021
.mode = 0644,
20282022
.proc_handler = proc_dointvec,
20292023
.extra1 = SYSCTL_ZERO,

0 commit comments

Comments
 (0)