# Re: \[PATCH v29 23/32\] x86/cet/shstk: Add user-mode shadow stack support

- From: Borislav Petkov \<bp@alien8.de\>
- Date: 2021-08-27 18:46:01 
- List: linux-mm
- Page: https://ratatoskr.run/linux-mm/2021/08/1490819
- Thread: https://ratatoskr.run/linux-doc/2021/08/1484313/t.md

```text
On Fri, Aug 27, 2021 at 11:37:34AM -0700, Yu, Yu-cheng wrote:
> Right now, the kernel does lazy restore, and it waits until right before a
> task goes back to ring-3 to restore xstates.  If a task needs to write to
> any xstate registers before that (e.g. for signals), it restores the whole
> xstates first and clears TIF_NEED_FPU_LOAD, which will prevent xstates being
> restored again later.

shstk_setup() allocates a shadow stack for the task and puts its pointer
in MSR_IA32_PL3_SSP.

What does that have to do with a task having to write any xstate
registers?

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

```
