| From | Thomas Gleixner <> | Subject | Re: [patch V3 15/66] x86/fpu: Fail ptrace() requests that try to set invalid MXCSR values | Date | Mon, 21 Jun 2021 12:17:43 +0200 |
| |
On Fri, Jun 18 2021 at 16:18, Thomas Gleixner wrote:
> From: Andy Lutomirski <luto@kernel.org> > > 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> > --- > V2: New patch. Picked up from Andy. > --- > arch/x86/kernel/fpu/regset.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > --- > --- a/arch/x86/kernel/fpu/regset.c > +++ b/arch/x86/kernel/fpu/regset.c > @@ -64,8 +64,9 @@ int xfpregs_set(struct task_struct *targ > 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) > + ret = -EINVAL;
This obviously needs to be:
return -EINVAL;
/me goes to find a brown paperbag
|