aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kernel/fpu/signal.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2021-10-16 15:17:46 +0200
committerIngo Molnar <mingo@kernel.org>2021-10-16 15:17:46 +0200
commit082f20b21de20285da2cbfc1be29656f0714c1b8 (patch)
tree6170af99f1491fe256351b9cf92725dbda79c153 /arch/x86/kernel/fpu/signal.c
parent724fc0248d450224b19ef5b5ee41e392348f6704 (diff)
parentb2381acd3fd9bacd2c63f53b2c610c89959b31cc (diff)
downloadlinux-082f20b21de20285da2cbfc1be29656f0714c1b8.tar.gz
linux-082f20b21de20285da2cbfc1be29656f0714c1b8.tar.bz2
linux-082f20b21de20285da2cbfc1be29656f0714c1b8.zip
Merge branch 'x86/urgent' into x86/fpu, to resolve a conflict
Resolve the conflict between these commits: x86/fpu: 1193f408cd51 ("x86/fpu/signal: Change return type of __fpu_restore_sig() to boolean") x86/urgent: d298b03506d3 ("x86/fpu: Restore the masking out of reserved MXCSR bits") b2381acd3fd9 ("x86/fpu: Mask out the invalid MXCSR bits properly") Conflicts: arch/x86/kernel/fpu/signal.c Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/fpu/signal.c')
-rw-r--r--arch/x86/kernel/fpu/signal.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
index 39c7bae97daf..51c4915a35f0 100644
--- a/arch/x86/kernel/fpu/signal.c
+++ b/arch/x86/kernel/fpu/signal.c
@@ -384,9 +384,14 @@ static bool __fpu_restore_sig(void __user *buf, void __user *buf_fx,
sizeof(fpu->state.fxsave)))
return false;
- /* Reject invalid MXCSR values. */
- if (fpu->state.fxsave.mxcsr & ~mxcsr_feature_mask)
- return false;
+ if (IS_ENABLED(CONFIG_X86_64)) {
+ /* Reject invalid MXCSR values. */
+ if (fpu->state.fxsave.mxcsr & ~mxcsr_feature_mask)
+ return false;
+ } else {
+ /* Mask invalid bits out for historical reasons (broken hardware). */
+ fpu->state.fxsave.mxcsr &= mxcsr_feature_mask;
+ }
/* Enforce XFEATURE_MASK_FPSSE when XSAVE is enabled */
if (use_xsave())