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: <1312860783.2531.31.camel@edumazet-laptop>
Date:	Tue, 09 Aug 2011 05:33:03 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Akinobu Mita <akinobu.mita@...il.com>
Cc:	linux-kernel@...r.kernel.org,
	Christoph Lameter <cl@...ux-foundation.org>,
	Pekka Enberg <penberg@...nel.org>,
	Matt Mackall <mpm@...enic.com>, linux-mm@...ck.org
Subject: Re: [PATCH] slub: fix check_bytes() for slub debugging

Le mardi 09 août 2011 à 05:10 +0200, Eric Dumazet a écrit :
> Le dimanche 07 août 2011 à 18:30 +0900, Akinobu Mita a écrit :
> > The check_bytes() function is used by slub debugging.  It returns a pointer
> > to the first unmatching byte for a character in the given memory area.
> > 
> > If the character for matching byte is greater than 0x80, check_bytes()
> > doesn't work.  Becuase 64-bit pattern is generated as below.
> > 
> > 	value64 = value | value << 8 | value << 16 | value << 24;
> > 	value64 = value64 | value64 << 32;
> > 
> > The integer promotions are performed and sign-extended as the type of value
> > is u8.  The upper 32 bits of value64 is 0xffffffff in the first line, and
> > the second line has no effect.
> > 
> > This fixes the 64-bit pattern generation.
> > 
> > Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>
> > Cc: Christoph Lameter <cl@...ux-foundation.org>
> > Cc: Pekka Enberg <penberg@...nel.org>
> > Cc: Matt Mackall <mpm@...enic.com>
> > Cc: linux-mm@...ck.org
> > ---
> >  mm/slub.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/mm/slub.c b/mm/slub.c
> > index eb5a8f9..5695f92 100644
> > --- a/mm/slub.c
> > +++ b/mm/slub.c
> > @@ -701,7 +701,7 @@ static u8 *check_bytes(u8 *start, u8 value, unsigned int bytes)
> >  		return check_bytes8(start, value, bytes);
> >  
> >  	value64 = value | value << 8 | value << 16 | value << 24;
> > -	value64 = value64 | value64 << 32;
> > +	value64 = (value64 & 0xffffffff) | value64 << 32;
> >  	prefix = 8 - ((unsigned long)start) % 8;
> >  
> >  	if (prefix) {
> 
> Still buggy I am afraid. Could we use the following ?
> 
> 
> 	value64 = value;
> 	value64 |= value64 << 8;
> 	value64 |= value64 << 16;
> 	value64 |= value64 << 32;
> 
> 

Well, 'buggy' was not well chosen.

Another possibility would be to use a multiply if arch has a fast
multiplier...


	value64 = value;
#if defined(ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64
	value64 *= 0x0101010101010101;
#elif defined(ARCH_HAS_FAST_MULTIPLIER)
	value64 *= 0x01010101;
	value64 |= value64 << 32;
#else
	value64 |= value64 << 8;
	value64 |= value64 << 16;
	value64 |= value64 << 32;
#endif




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ