diff options
author | Andy Lutomirski <luto@kernel.org> | 2021-06-23 14:01:40 +0200 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-06-23 17:49:46 +0200 |
commit | 145e9e0d8c6fada4a40f9fc65b34658077874d9c (patch) | |
tree | 16c8485db051cbbb16ad584c3e8de70cae0c2b3a /arch/x86 | |
parent | 6164331d15f7d912fb9369245368e9564ea49813 (diff) |
x86/fpu: Fail ptrace() requests that try to set invalid MXCSR values
There is no benefit from accepting and silently changing an invalid MXCSR
value supplied via ptrace(). Instead, return -EINVAL on invalid input.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121452.613614842@linutronix.de
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/fpu/regset.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/fpu/regset.c b/arch/x86/kernel/fpu/regset.c index f24ce873bfc2..5610f77cacad 100644 --- a/arch/x86/kernel/fpu/regset.c +++ b/arch/x86/kernel/fpu/regset.c @@ -63,8 +63,9 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, if (ret) return ret; - /* Mask invalid MXCSR bits (for historical reasons). */ - newstate.mxcsr &= mxcsr_feature_mask; + /* Do not allow an invalid MXCSR value. */ + if (newstate.mxcsr & ~mxcsr_feature_mask) + return -EINVAL; fpu__prepare_write(fpu); |