Re: [RFC][PATCH v2 12/21] x86/pti: Use PTI stack instead of trampoline stack
From: Thomas Gleixner
Date: Thu Nov 19 2020 - 16:21:02 EST
On Thu, Nov 19 2020 at 20:55, Alexandre Chartre wrote:
> On 11/19/20 8:10 PM, Thomas Gleixner wrote:
> Sorry I mixed up a few thing; I got confused with my own code which is not a
> good sign...
>
> It's not sleeping with the user page-table which, as you mentioned, doesn't
> make sense, it's sleeping with the kernel page-table but with the PTI stack.
>
> Basically, it is:
> - entering C code with (user page-table, PTI stack);
> - then it switches to the kernel page-table so we have (kernel page-table, PTI stack);
> - and then it switches to the kernel stack so we have (kernel page-table, kernel stack).
>
> As this is all C code, some of which is executed with the PTI stack, we need the PTI stack
> to be per-task so that the stack is preserved, in case that C code does a sleep/schedule
> (no matter if this happens when using the PTI stack or the kernel stack).
That makes some more sense, but I'm not convinced that this dual stack
is really a good thing.
Thanks,
tglx