Messages in this thread Patch in this message |  | | From | "Chang S. Bae" <> | Subject | [PATCH v5 24/28] x86/fpu/xstate: Use per-task xstate mask for saving xstate in signal frame | Date | Sun, 23 May 2021 12:32:55 -0700 |
| |
Entering a signal handler, the kernel saves xstate in signal frame. The dynamic user state is better to be saved only when used. fpu->state_mask can help to exclude unused states.
Returning from a signal handler, XRSTOR(S) re-initializes the excluded state components.
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com> Reviewed-by: Len Brown <len.brown@intel.com> Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org --- Changes from v4: * Updated the title and the changelog. * Excluded the test case addition; separated out as a new patch.
Changes from v3: * Removed 'no functional changes' in the changelog. (Borislav Petkov)
Changes from v1: * Made it revertable (moved close to the end of the series). * Included the test case. --- arch/x86/include/asm/fpu/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 6460d52991ba..4a3436684805 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -354,7 +354,7 @@ static inline void copy_kernel_to_xregs(struct xregs_state *xstate, u64 mask) */ static inline int copy_xregs_to_user(struct xregs_state __user *buf) { - u64 mask = xfeatures_mask_user(); + u64 mask = current->thread.fpu.state_mask; u32 lmask = mask; u32 hmask = mask >> 32; int err; -- 2.17.1
|  |