Re: [RFC PATCH v2 6/6] x86/entry/pti: don't switch PGD on when pti_disable is set

From: Dave Hansen
Date: Thu Jan 11 2018 - 13:15:10 EST


On 01/11/2018 10:05 AM, Willy Tarreau wrote:
>> That's exactly what it does for now, but Linus doesn't like it at all.
>> So I'll switch it back to per-mm + per-CPU variable. Well he has a valid
>> point regarding the pgd and _PAGE_NX setting. point Now at least we know
>> the change is minimal if we have a good reason for doing differently
>> later.
> Yuck, I hate this. Are you really going to wire it up complete with
> all the IPIs needed to get the thing synced up right?

Well, on the bright side, we don't need IPIs when _removing_ NX. We can
just handle those like a spurious fault.

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. I guess that's the one
benefit if you come up with an API that only allows "disable PTI" while
a task is running but leaves execve()/fork() as places that implicitly
reenable PTI.