Commit 145e9e0d authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Borislav Petkov

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: default avatarAndy Lutomirski <luto@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210623121452.613614842@linutronix.de
parent 6164331d
...@@ -63,8 +63,9 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, ...@@ -63,8 +63,9 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset,
if (ret) if (ret)
return ret; return ret;
/* Mask invalid MXCSR bits (for historical reasons). */ /* Do not allow an invalid MXCSR value. */
newstate.mxcsr &= mxcsr_feature_mask; if (newstate.mxcsr & ~mxcsr_feature_mask)
return -EINVAL;
fpu__prepare_write(fpu); fpu__prepare_write(fpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment