Re: [PATCH] x86/doc: add PTI description

From: Dave Hansen
Date: Thu Jan 04 2018 - 19:21:51 EST


On 01/04/2018 04:06 PM, Kees Cook wrote:
>> + d. Process Context IDentifiers (PCID) is a CPU feature that
>> + allows us to skip flushing the entire TLB when switching page
>> + tables. This makes switching the page tables (at context
>> + switch, or kernel entry/exit) cheaper. But, on systems with
>> + PCID support, the context switch code must flush both the user
>> + and kernel entries out of the TLB. The user PCID TLB flush is
>> + deferred until the exit to userspace, minimizing the cost.
>
> Does this mean it's possible to bypass the NX on userspace pages?

I'll clarify this. The write to CR3 happens, but bit 63 gets set to
tell the CPU not to flush the TLB on the CR3 write.

>> [...]
>> + g. On systems without PCID support, each CR3 write flushes
>> + the entire TLB. That means that each syscall, interrupt
>> + or exception flushes the TLB.
>
> Is it worth clarifying this for hardware support of PCID vs INVPCID?

I'll make changes based on the rest of your comments. Thanks for taking
a look!