diff options
| author | Mathias Krause <minipli@googlemail.com> | 2017-04-10 11:14:27 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-21 03:31:20 -0400 |
| commit | ec980b6f7dcc006f6859c0871c0d7298281f0394 (patch) | |
| tree | faef2f5a91d9d61a83a75821b18f05c42917b136 /arch/x86 | |
| parent | a9826aa4860a9ca1268a9ab5c10fc5e65a72b4ef (diff) | |
x86/vdso: Ensure vdso32_enabled gets set to valid values only
commit c06989da39cdb10604d572c8c7ea8c8c97f3c483 upstream.
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: b0b49f2673f0 ("x86, vdso: Remove compat vdso support")
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Acked-by: Andy Lutomirski <luto@amacapital.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Roland McGrath <roland@redhat.com>
Link: http://lkml.kernel.org/r/1491424561-7187-1-git-send-email-minipli@googlemail.com
Link: http://lkml.kernel.org/r/20170410151723.518412863@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86')
| -rw-r--r-- | arch/x86/entry/vdso/vdso32-setup.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/entry/vdso/vdso32-setup.c b/arch/x86/entry/vdso/vdso32-setup.c index 7853b53959cd..3f9d1a83891a 100644 --- a/arch/x86/entry/vdso/vdso32-setup.c +++ b/arch/x86/entry/vdso/vdso32-setup.c | |||
| @@ -30,8 +30,10 @@ static int __init vdso32_setup(char *s) | |||
| 30 | { | 30 | { |
| 31 | vdso32_enabled = simple_strtoul(s, NULL, 0); | 31 | vdso32_enabled = simple_strtoul(s, NULL, 0); |
| 32 | 32 | ||
| 33 | if (vdso32_enabled > 1) | 33 | if (vdso32_enabled > 1) { |
| 34 | pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n"); | 34 | pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n"); |
| 35 | vdso32_enabled = 0; | ||
| 36 | } | ||
| 35 | 37 | ||
| 36 | return 1; | 38 | return 1; |
| 37 | } | 39 | } |
| @@ -62,13 +64,18 @@ subsys_initcall(sysenter_setup); | |||
| 62 | /* Register vsyscall32 into the ABI table */ | 64 | /* Register vsyscall32 into the ABI table */ |
| 63 | #include <linux/sysctl.h> | 65 | #include <linux/sysctl.h> |
| 64 | 66 | ||
| 67 | static const int zero; | ||
| 68 | static const int one = 1; | ||
| 69 | |||
| 65 | static struct ctl_table abi_table2[] = { | 70 | static struct ctl_table abi_table2[] = { |
| 66 | { | 71 | { |
| 67 | .procname = "vsyscall32", | 72 | .procname = "vsyscall32", |
| 68 | .data = &vdso32_enabled, | 73 | .data = &vdso32_enabled, |
| 69 | .maxlen = sizeof(int), | 74 | .maxlen = sizeof(int), |
| 70 | .mode = 0644, | 75 | .mode = 0644, |
| 71 | .proc_handler = proc_dointvec | 76 | .proc_handler = proc_dointvec_minmax, |
| 77 | .extra1 = (int *)&zero, | ||
| 78 | .extra2 = (int *)&one, | ||
| 72 | }, | 79 | }, |
| 73 | {} | 80 | {} |
| 74 | }; | 81 | }; |
