Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935548AbeAKSVy (ORCPT + 1 other); Thu, 11 Jan 2018 13:21:54 -0500 Received: from mail-pg0-f45.google.com ([74.125.83.45]:36254 "EHLO mail-pg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934462AbeAKSVx (ORCPT ); Thu, 11 Jan 2018 13:21:53 -0500 X-Google-Smtp-Source: ACJfBovQ0Z5VccM6kjgyzShNF8dEsrk17WoMvMoJ/UQgRfOsSNySJ3AtSgAX2BGpMuR7+ARG0ytPXA== Date: Thu, 11 Jan 2018 10:21:49 -0800 From: Alexei Starovoitov To: Andy Lutomirski Cc: Dave Hansen , Willy Tarreau , Linus Torvalds , Peter Zijlstra , LKML , X86 ML , Borislav Petkov , Brian Gerst , Ingo Molnar , Thomas Gleixner , Josh Poimboeuf , "H. Peter Anvin" , Greg Kroah-Hartman , Kees Cook Subject: Re: [RFC PATCH v2 6/6] x86/entry/pti: don't switch PGD on when pti_disable is set Message-ID: <20180111182147.masunghp5km6igjq@ast-mbp.dhcp.thefacebook.com> References: <1515502580-12261-7-git-send-email-w@1wt.eu> <20180110082207.GX29822@worktop.programming.kicks-ass.net> <20180110091102.GH14066@1wt.eu> <20180111064259.GC14920@1wt.eu> <0f08d89e-61e1-20e3-5c59-0b2f7b32bf0c@linux.intel.com> <20180111154412.GA15296@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Jan 11, 2018 at 09:02:55AM -0800, Andy Lutomirski wrote: > On Thu, Jan 11, 2018 at 7:51 AM, Dave Hansen > wrote: > > On 01/11/2018 07:44 AM, Willy Tarreau wrote: > >>> I think we also need to be able to dump the actual > >>> CR3 value that we entered the kernel with before we start doing too much > >>> other funky stuff with the entry code. > >> When you say dump, you mean save it somewhere in a per_cpu variable ? > > > > Yeah, I think a per-cpu variable is fine for now. But, that only gives > > you a dump from a single entry to the kernel. Ideally, it would be nice > > to have a stack of them so you could do things like debug > > syscall->fault->oops. Was it the syscall entry or the fault entry that > > lead to the oops? > > > > But, the stack gets really fun because of NMIs. > > > > I'm sure Andy Lutomirski has some ideas too. > > I was thinking that maybe we should add a new field or two to pt_regs. > They could store CR2 and maybe CR3 as well. I'd also like to expose > the error code of exceptions in stack traces. We should get this > integrated right into the unwinder. hmm. Exposing cr3 to user space will make it trivial for user process to know whether kpti is active. Not sure how exploitable such information leak.