On Thu, Jan 11, 2018 at 10:15 AM, Dave Hansen
<dave.han...@linux.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

Reply via email to