[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFygqFbpgc6UaPqn9KiPVj0srd5wyPNmFZcef+gG_v+QBw@mail.gmail.com>
Date: Thu, 11 Jan 2018 10:31:58 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Willy Tarreau <w@....eu>, Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>, X86 ML <x86@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Brian Gerst <brgerst@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Josh Poimboeuf <jpoimboe@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Kees Cook <keescook@...omium.org>
Subject: Re: [RFC PATCH v2 6/6] x86/entry/pti: don't switch PGD on when
pti_disable is set
On Thu, Jan 11, 2018 at 10:15 AM, Dave Hansen
<dave.hansen@...ux.intel.com> wrote:
>
> Well, on the bright side, we don't need IPIs when _removing_ NX. We can
> just handle those like a spurious fault.
I think I agree.
> But, when re-enabling it, we need all the TLB flushing for all the CPUs
> that have run with the un-NX'd page tables.
Actually, I really don't think we should even allow "re-enable PTI".
The only thing that re-enables PTI is a completely new page table,
notably "execve()".
And I think that is when the "NOW" vs "NEXT" *may* make sense. Not for
enabling PTI, but if we want to have a "disable PTI", I think it
should act on the next execve().
And one reason I think we want that behavior is that once you've
disabled PTI, I don't think the double page tables would necessarily
even exist, and I don't think we should try to re-populate them. A
noPTI process might simply *have* just the single page table.
That wouldn't be the first implementation, but I think the interface
should be designed for that kind of thing in mind, where nopti really
means "stop doing two page tables for this process". And that may make
it *impossible* to re-enable PTI for this process, simply because we
don't have the required double-page PGD allocation at all.
Linus
Powered by blists - more mailing lists