Messages in this thread | | | Subject | Re: [PATCH v29 23/32] x86/cet/shstk: Add user-mode shadow stack support | From | "Yu, Yu-cheng" <> | Date | Fri, 27 Aug 2021 11:37:34 -0700 |
| |
On 8/27/2021 11:21 AM, Borislav Petkov wrote: > On Fri, Aug 27, 2021 at 11:10:31AM -0700, Yu, Yu-cheng wrote: >> Because on context switches the whole xstates are switched together, >> we need to make sure all are in registers. > > There's context switch code which does that already. > > Why would shstk_setup() be responsible for switching the whole extended > states buffer instead of only the shadow stack stuff only? >
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.
| |