x86/fpu/xstate: Use fpstate for xsave_to_user_sigframe()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 13 Oct 2021 14:55:51 +0000 (16:55 +0200)
committerBorislav Petkov <bp@suse.de>
Thu, 21 Oct 2021 12:04:46 +0000 (14:04 +0200)
With dynamically enabled features the sigframe code must know the features
which are enabled for the task. Get them from fpstate.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20211013145323.077781448@linutronix.de
arch/x86/kernel/fpu/xstate.h

index 24a1479caea2467f171432931dc267a576bdd78e..3e9eaf9f7cf332ddb568cffee21fa74aeb80ce69 100644 (file)
@@ -149,7 +149,7 @@ static inline int xsave_to_user_sigframe(struct xregs_state __user *buf)
         * internally, e.g. PKRU. That's user space ABI and also required
         * to allow the signal handler to modify PKRU.
         */
-       u64 mask = xfeatures_mask_uabi();
+       u64 mask = current->thread.fpu.fpstate->user_xfeatures;
        u32 lmask = mask;
        u32 hmask = mask >> 32;
        int err;