Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753476AbdDJNlt (ORCPT ); Mon, 10 Apr 2017 09:41:49 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:50993 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753297AbdDJNls (ORCPT ); Mon, 10 Apr 2017 09:41:48 -0400 Date: Mon, 10 Apr 2017 15:41:45 +0200 (CEST) From: Thomas Gleixner To: Mathias Krause cc: x86@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Ingo Molnar , "H. Peter Anvin" , Roland McGrath Subject: Re: [PATCH] x86/vdso: ensure vdso32_enabled gets set to valid values only In-Reply-To: Message-ID: References: <1491424561-7187-1-git-send-email-minipli@googlemail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1387 Lines: 53 On Mon, 10 Apr 2017, Thomas Gleixner wrote: > On Wed, 5 Apr 2017, Mathias Krause wrote: > > @@ -62,13 +64,18 @@ int __init sysenter_setup(void) > > /* Register vsyscall32 into the ABI table */ > > #include > > > > +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, > > This is still bustable. Let's start with: vdso32_enabled = false > > arch_setup_additional_pages() > --> No mapping > > sysctl.vsysscall32() > --> vdso32_enabled = true > > create_elf_tables() > if (vdso32_enabled) { > --> Add VDSO entry with NULL pointer > > The vdso map code needs to store a flag in current which can be checked in > ARCH_DLINFO_IA32. It's ways simpler. Patch below. Thanks, tglx --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -287,7 +287,7 @@ struct task_struct; #define ARCH_DLINFO_IA32 \ do { \ - if (vdso32_enabled) { \ + if (VDSO_CURRENT_BASE) { \ NEW_AUX_ENT(AT_SYSINFO, VDSO_ENTRY); \ NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_CURRENT_BASE); \ } \