Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on

2017-12-11 Thread Andy Lutomirski
On Mon, Dec 11, 2017 at 11:47 AM, Dave Hansen wrote: > On 12/11/2017 11:39 AM, Andy Lutomirski wrote: >>> I thought there would be a "fast path" where we just use the normal >>> clear_LDT() LDT from the cpu_entry_area and don't have to do any of >>> this, but I'm missing where that happens. Do we

Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on

2017-12-11 Thread Dave Hansen
On 12/11/2017 11:39 AM, Andy Lutomirski wrote: >> I thought there would be a "fast path" where we just use the normal >> clear_LDT() LDT from the cpu_entry_area and don't have to do any of >> this, but I'm missing where that happens. Do we need a check in >> (un)map_ldt_struct() for !mm->context.l

Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on

2017-12-11 Thread Andy Lutomirski
On Mon, Dec 11, 2017 at 11:32 AM, Dave Hansen wrote: > On 12/11/2017 10:40 AM, Andy Lutomirski wrote: >>> Also, from a high level, this does increase the overhead of KPTI in a >>> non-trivial way, right? It costs us three more page table pages per >>> process allocated at fork() and freed at exit

Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on

2017-12-11 Thread Dave Hansen
On 12/11/2017 10:40 AM, Andy Lutomirski wrote: >> Also, from a high level, this does increase the overhead of KPTI in a >> non-trivial way, right? It costs us three more page table pages per >> process allocated at fork() and freed at exit() and a new TLB flush. > Yeah, but no one will care. modi

Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on

2017-12-11 Thread Andy Lutomirski
On Mon, Dec 11, 2017 at 9:49 AM, Dave Hansen wrote: > So, before this, > > On 12/10/2017 10:47 PM, Andy Lutomirski wrote: > ...> + if (unlikely(ldt)) { >> + if (static_cpu_has_bug(X86_BUG_CPU_SECURE_MODE_PTI)) { >> + if (WARN_ON_ONCE((unsigned long)ldt->slot > 1))

Re: [PATCH PTI v2 6/6] x86/pti: Put the LDT in its own PGD if PTI is on

2017-12-11 Thread Dave Hansen
So, before this, On 12/10/2017 10:47 PM, Andy Lutomirski wrote: ...> + if (unlikely(ldt)) { > + if (static_cpu_has_bug(X86_BUG_CPU_SECURE_MODE_PTI)) { > + if (WARN_ON_ONCE((unsigned long)ldt->slot > 1)) { > + clear_LDT(); > +