summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/fpu/signal.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-10-13 16:55:49 +0200
committerBorislav Petkov <bp@suse.de>2021-10-21 14:03:36 +0200
commit073e627a4537e682c43a1e8df659ce24cbced40c (patch)
tree42bd41d970df4ba299229671be9267e064af7d0b /arch/x86/kernel/fpu/signal.c
parentx86/fpu: Use fpstate::size (diff)
downloadlinux-073e627a4537e682c43a1e8df659ce24cbced40c.tar.xz
linux-073e627a4537e682c43a1e8df659ce24cbced40c.zip
x86/fpu/xstate: Use fpstate for os_xsave()
With variable feature sets XSAVE[S] requires to know the feature set for which the buffer is valid. Retrieve it 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.025695590@linutronix.de
Diffstat (limited to 'arch/x86/kernel/fpu/signal.c')
-rw-r--r--arch/x86/kernel/fpu/signal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index aa9329189864..5aca418490f0 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -349,7 +349,6 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx,
if (__copy_from_user(&env, buf, sizeof(env)))
return false;
- fpregs = &fpu->fpstate->regs;
/*
* By setting TIF_NEED_FPU_LOAD it is ensured that our xstate is
* not modified on context switch and that the xstate is considered
@@ -367,13 +366,14 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx,
* the right place in memory. It's ia32 mode. Shrug.
*/
if (xfeatures_mask_supervisor())
- os_xsave(&fpregs->xsave);
+ os_xsave(fpu->fpstate);
set_thread_flag(TIF_NEED_FPU_LOAD);
}
__fpu_invalidate_fpregs_state(fpu);
__cpu_invalidate_fpregs_state();
fpregs_unlock();
+ fpregs = &fpu->fpstate->regs;
if (use_xsave() && !fx_only) {
if (copy_sigframe_from_user_to_xstate(&fpregs->xsave, buf_fx))
return false;