Re: [PATCH RFC 2/4] x86/arch_prctl: add ARCH_GET_NOPTI and ARCH_SET_NOPTI to enable/disable PTI

From: Thomas Gleixner
Date: Mon Jan 08 2018 - 12:26:56 EST


On Mon, 8 Jan 2018, Ingo Molnar wrote:
> * Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
> > Per task is really an odd choice. That should be per process I think, but
> > that of course needs synchronization of some form. Aside of that we need to
> > think about fork().
>
> So per task (thread) is the most natural approach to low level asm flaggery.

Well, yes and no. PTI is a property of the mm/pgdir and that's process
wide.

> Making it per thread also makes some sense conceptually: in a complex
> multi-threaded runtime implementation some threads might never execute
> 'untrusted' code, some might. No need to penalize the 'server' threads.

If one thread runs untrusted code then your 'trusted' thread is not longer
trusted either as they share everything.

Thanks,

tglx