lkml.org 
[lkml]   [2021]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch V2 12/52] x86/fpu: Fail ptrace() requests that try to set invalid MXCSR values
    On Mon, Jun 14, 2021 at 05:44:20PM +0200, Thomas Gleixner wrote:
    > From: Andy Lutomirski <luto@kernel.org>
    >
    > We're not doing anyone any favors by accepting and silently changing an
    > invalid MXCSR value supplied via ptrace(). Instead, return -EINVAL on
    > invalid input.
    >
    > If this breaks something, we can revert it.

    Please use passive voice in your commit message: no "we" or "I", etc,

    > 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
    > @@ -65,8 +65,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;
    >
    > fpu__prepare_write(fpu);

    With that addressed:

    Reviewed-by: Borislav Petkov <bp@suse.de>

    Thx.

    --
    Regards/Gruss,
    Boris.

    SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg

    \
     
     \ /
      Last update: 2022-09-17 16:10    [W:2.277 / U:0.108 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site