lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170924190242.hsbs7tqhvcalnczt@gmail.com>
Date:   Sun, 24 Sep 2017 21:02:42 +0200
From:   Ingo Molnar <mingo@...nel.org>
To:     Eric Biggers <ebiggers3@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>,
        Andy Lutomirski <luto@...capital.net>,
        Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        "H . Peter Anvin" <hpa@...or.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Oleg Nesterov <oleg@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Rik van Riel <riel@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yu-cheng Yu <yu-cheng.yu@...el.com>
Subject: Re: [PATCH 03/10] x86/fpu: Use validate_xstate_header() to validate
 the xstate_header in sanitize_restored_xstate()


* Eric Biggers <ebiggers3@...il.com> wrote:

> On Sun, Sep 24, 2017 at 12:59:06PM +0200, Ingo Molnar wrote:
> > @@ -328,10 +331,8 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
> >  			err = copy_user_to_xstate(&fpu->state.xsave, buf_fx);
> >  		} else {
> >  			err = __copy_from_user(&fpu->state.xsave, buf_fx, state_size);
> > -
> > -			/* xcomp_bv must be 0 when using uncompacted format */
> > -			if (!err && fpu->state.xsave.header.xcomp_bv)
> > -				err = -EINVAL;
> > +			if (!err)
> > +				err = validate_xstate_header(&fpu->state.xsave.header);
> >  		}
> >  
> 
> Sorry, this is the buggy part.  The problem is that this code runs even if XSAVE
> isn't being used --- and in that case the state size is 512 bytes or less, so
> the state doesn't actually include the xstate_header.  So
> validate_xstate_header() was reading out of bounds and seeing invalid values.
> 
> So I think we need to check use_xsave() here, but it really needs to be in the
> earlier patch which added the check for just ->xcomp_bv ("x86/fpu: Don't let
> userspace set bogus xcomp_bv"), not in this one.
> 
> As far the split of patch 2/3 into these 10 patches, it looks fine (though it
> suddenly became a *lot* of patches!).  One nit: the subject of this one really
> should say "__fpu__restore_sig()", not "sanitize_restored_xstate()".
> 
> I can send a fixed series when I have a chance.

Could you please just send the delta patch against the whole tree to fix the bug? 
I'll worry about the patch dependencies and back-merge it to the proper place.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ