All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/3] x86/vdso: Fix enable inconsistencies and cleanup
@ 2017-04-10 15:14 Thomas Gleixner
  2017-04-10 15:14 ` [patch 1/3] x86/vdso: Ensure vdso32_enabled gets set to valid values only Thomas Gleixner
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Thomas Gleixner @ 2017-04-10 15:14 UTC (permalink / raw)
  To: LKML; +Cc: x86, Peter Zijlstra, Andy Lutomirski, Mathias Krause

The following series is a collection of Mathias enable fix, the plug of the
sysctl race and a cleanup of the vdso*_enable handling.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 13+ messages in thread
* [PATCH] x86/vdso: ensure vdso32_enabled gets set to valid values only
@ 2017-04-05 20:36 Mathias Krause
  2017-04-06 15:59 ` Andy Lutomirski
  2017-04-10 13:13 ` Thomas Gleixner
  0 siblings, 2 replies; 13+ messages in thread
From: Mathias Krause @ 2017-04-05 20:36 UTC (permalink / raw)
  To: x86
  Cc: Mathias Krause, linux-kernel, Andy Lutomirski, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, Roland McGrath

If either via kernel command line 'vdso32=' or via 'sysctl abi.vsyscall32'
vdso32_enabled gets set to a value below 0 or above 1, load_vdso32() won't
map the vDSO but ARCH_DLINFO_IA32 would still pass an AT_SYSINFO_EHDR
auxiliary vector, however with a NULL pointer. That'll make any program
trying to make use of it fail with a segmentation fault. At least musl
makes use of it if the kernel provides it.

Ensure vdso32_enabled gets set to valid values only to fix this corner
case.

Fixes: b0b49f2673f0 ("x86, vdso: Remove compat vdso support")
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 arch/x86/entry/vdso/vdso32-setup.c |   11 +++++++++--
 1 file 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..ca312c174d6f 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)
 {
 	vdso32_enabled = simple_strtoul(s, NULL, 0);
 
-	if (vdso32_enabled > 1)
+	if (vdso32_enabled > 1) {
 		pr_warn("vdso32 values other than 0 and 1 are no longer allowed; vdso disabled\n");
+		vdso32_enabled = 0;
+	}
 
 	return 1;
 }
@@ -62,13 +64,18 @@ int __init sysenter_setup(void)
 /* Register vsyscall32 into the ABI table */
 #include <linux/sysctl.h>
 
+static const int zero;
+static const int one = 1;
+
 static struct ctl_table abi_table2[] = {
 	{
 		.procname	= "vsyscall32",
 		.data		= &vdso32_enabled,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= proc_dointvec
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= (int *)&zero,
+		.extra2		= (int *)&one,
 	},
 	{}
 };
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-04-10 17:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 15:14 [patch 0/3] x86/vdso: Fix enable inconsistencies and cleanup Thomas Gleixner
2017-04-10 15:14 ` [patch 1/3] x86/vdso: Ensure vdso32_enabled gets set to valid values only Thomas Gleixner
2017-04-10 16:34   ` [tip:x86/urgent] " tip-bot for Mathias Krause
2017-04-10 15:14 ` [patch 2/3] x86/vdso: Plug race between mapping and ELF header setup Thomas Gleixner
2017-04-10 15:56   ` Andy Lutomirski
2017-04-10 16:34   ` [tip:x86/urgent] " tip-bot for Thomas Gleixner
2017-04-10 15:14 ` [patch 3/3] x86/vdso: Sanitize vdso*_enabled handling Thomas Gleixner
2017-04-10 15:55   ` Andy Lutomirski
2017-04-10 16:25     ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2017-04-05 20:36 [PATCH] x86/vdso: ensure vdso32_enabled gets set to valid values only Mathias Krause
2017-04-06 15:59 ` Andy Lutomirski
2017-04-10 13:13 ` Thomas Gleixner
2017-04-10 13:41   ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.