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] [day] [month] [year] [list]
Message-ID: <20190520210012.GA18021@amd>
Date:   Mon, 20 May 2019 23:00:12 +0200
From:   Pavel Machek <pavel@...x.de>
To:     "Gustavo A. R. Silva" <gustavo@...eddedor.com>
Cc:     Greg KH <gregkh@...uxfoundation.org>, Pavel Machek <pavel@...x.de>,
        stable@...nel.org, kernel list <linux-kernel@...r.kernel.org>,
        davem@...emloft.net
Subject: Re: net: atm: Spectre v1 fix introduced bug in bcb964012d1b in
 -stable

On Mon 2019-05-20 09:26:45, Gustavo A. R. Silva wrote:
> 
> 
> On 5/20/19 9:00 AM, Greg KH wrote:
> > On Mon, May 20, 2019 at 02:40:14PM +0200, Pavel Machek wrote:
> >>
> >> In lecd_attach, if arg is < 0, it was treated as 0. Spectre v1 fix
> >> changed that. Bug does not exist in mainline AFAICT.
> >>
> >> Signed-off-by: Pavel Machek <pavel@...x.de>
> >> # for 4.19.y
> >>
> >> diff --git a/net/atm/lec.c b/net/atm/lec.c
> >> index ad4f829193f0..ed279cd912f4 100644
> >> --- a/net/atm/lec.c
> >> +++ b/net/atm/lec.c
> >> @@ -731,7 +731,7 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)
> >>  		i = arg;
> >>  	if (arg >= MAX_LEC_ITF)
> >>  		return -EINVAL;
> >> -	i = array_index_nospec(arg, MAX_LEC_ITF);
> >> +	i = array_index_nospec(i, MAX_LEC_ITF);
> >>  	if (!dev_lec[i]) {
> >>  		int size;
> >>  
> > 
> > Why is this only for 4.19.y?  What is different in Linus's tree that
> > makes this not needed there?
> > 
> 
> The only difference is this clean up:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fdd1a8103a6df50bdeacd8bb04c3f6976cb9ae41
> 
> As Dan says, the code works fine, but the *i* value wasn't being used
> anymore, so that piece of code was a bit confusing.

Yep, you are right, code managed to confused me: array_index_nospec
really returns 0 if it is out of bounds,

(typeof(_i)) (_i & _mask);

because _mask is always 0 or ~0.

Best regards,
								Pavel

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ