Skip to content

Commit c06989d

Browse files
minipliKAGA-KOKO
authored andcommitted
x86/vdso: Ensure vdso32_enabled gets set to valid values only
vdso_enabled can be set to arbitrary integer values via the kernel command line 'vdso32=' parameter or via 'sysctl abi.vsyscall32'. load_vdso32() only maps VDSO if vdso_enabled == 1, but ARCH_DLINFO_IA32 merily checks for vdso_enabled != 0. As a consequence the AT_SYSINFO_EHDR auxiliary vector for the VDSO_ENTRY is emitted with a NULL pointer which causes a segfault when the application tries to use the VDSO. Restrict the valid arguments on the command line and the sysctl to 0 and 1. Fixes: b0b49f2 ("x86, vdso: Remove compat vdso support") Signed-off-by: Mathias Krause <[email protected]> Acked-by: Andy Lutomirski <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: [email protected] Cc: Roland McGrath <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent cfac6df commit c06989d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ static int __init vdso32_setup(char *s)
3030
{
3131
vdso32_enabled = simple_strtoul(s, NULL, 0);
3232

33-
if (vdso32_enabled > 1)
33+
if (vdso32_enabled > 1) {
3434
pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
35+
vdso32_enabled = 0;
36+
}
3537

3638
return 1;
3739
}
@@ -62,13 +64,18 @@ subsys_initcall(sysenter_setup);
6264
/* Register vsyscall32 into the ABI table */
6365
#include <linux/sysctl.h>
6466

67+
static const int zero;
68+
static const int one = 1;
69+
6570
static struct ctl_table abi_table2[] = {
6671
{
6772
.procname = "vsyscall32",
6873
.data = &vdso32_enabled,
6974
.maxlen = sizeof(int),
7075
.mode = 0644,
71-
.proc_handler = proc_dointvec
76+
.proc_handler = proc_dointvec_minmax,
77+
.extra1 = (int *)&zero,
78+
.extra2 = (int *)&one,
7279
},
7380
{}
7481
};

0 commit comments

Comments
 (0)