From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758296AbdLROo4 (ORCPT ); Mon, 18 Dec 2017 09:44:56 -0500 Received: from mx2.suse.de ([195.135.220.15]:56241 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918AbdLROoz (ORCPT ); Mon, 18 Dec 2017 09:44:55 -0500 Date: Mon, 18 Dec 2017 15:44:48 +0100 From: Borislav Petkov To: Thomas Gleixner , Andy Lutomirsky Cc: LKML , x86@kernel.org, Linus Torvalds , Peter Zijlstra , Dave Hansen , Greg KH , keescook@google.com, hughd@google.com, Brian Gerst , Josh Poimboeuf , Denys Vlasenko , Rik van Riel , Boris Ostrovsky , Juergen Gross , David Laight , Eduardo Valentin , aliguori@amazon.com, Will Deacon , daniel.gruss@iaik.tugraz.at, Ingo Molnar , Kees Cook Subject: Re: [patch V163 03/51] x86/vsyscall/64: Warn and fail vsyscall emulation in NATIVE mode Message-ID: <20171218144448.n5mj2hk54ujtvvv4@pd.tnic> References: <20171218114215.239543034@linutronix.de> <20171218115253.831556467@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171218115253.831556467@linutronix.de> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 18, 2017 at 12:42:18PM +0100, Thomas Gleixner wrote: > From: Andy Lutomirski > > If something goes wrong with pagetable setup, vsyscall=native will > accidentally fall back to emulation. Make it warn and fail so that we > notice. > > Signed-off-by: Andy Lutomirski > Signed-off-by: Ingo Molnar > Signed-off-by: Thomas Gleixner > Cc: Borislav Petkov > Cc: Brian Gerst > Cc: David Laight > Cc: Kees Cook > Cc: Linus Torvalds > Cc: Peter Zijlstra > --- > arch/x86/entry/vsyscall/vsyscall_64.c | 4 ++++ > 1 file changed, 4 insertions(+) > > --- a/arch/x86/entry/vsyscall/vsyscall_64.c > +++ b/arch/x86/entry/vsyscall/vsyscall_64.c > @@ -138,6 +138,10 @@ bool emulate_vsyscall(struct pt_regs *re > > WARN_ON_ONCE(address != regs->ip); > > + /* This should be unreachable in NATIVE mode. */ > + if (WARN_ON(vsyscall_mode == NATIVE)) > + return false; There's this nice warn_bad_vsyscall() thing. Why not use that? -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --