lkml.org 
[lkml]   [2021]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 24/28] x86/fpu/xstate: Use per-task xstate mask for saving xstate in signal frame
    Date
    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
    \
     
     \ /
      Last update: 2021-05-23 21:40    [W:9.053 / U:0.172 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site