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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd95d7249ff94e31beb11b3f71a64e87@AcuMS.aculab.com>
Date: Fri, 6 Dec 2024 02:18:59 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Naresh Kamboju' <naresh.kamboju@...aro.org>, Dan Carpenter
	<dan.carpenter@...aro.org>
CC: open list <linux-kernel@...r.kernel.org>, "lkft-triage@...ts.linaro.org"
	<lkft-triage@...ts.linaro.org>, Linux Regressions
	<regressions@...ts.linux.dev>, Linux ARM
	<linux-arm-kernel@...ts.infradead.org>, "netfilter-devel@...r.kernel.org"
	<netfilter-devel@...r.kernel.org>, Arnd Bergmann <arnd@...db.de>, "Anders
 Roxell" <anders.roxell@...aro.org>, Johannes Berg <johannes.berg@...el.com>,
	"toke@...nel.org" <toke@...nel.org>, Al Viro <viro@...iv.linux.org.uk>,
	"kernel@...rr.cc" <kernel@...rr.cc>, "kees@...nel.org" <kees@...nel.org>
Subject: RE: arm64: include/linux/compiler_types.h:542:38: error: call to
 '__compiletime_assert_1050' declared with attribute error: clamp() low limit
 min greater than high limit max_avail

From: Naresh Kamboju
> Sent: 05 December 2024 18:42
> 
> On Thu, 5 Dec 2024 at 20:46, Dan Carpenter <dan.carpenter@...aro.org> wrote:
> >
> > Add David to the CC list.
> 
> Anders bisected this reported issue and found the first bad commit as,
> 
> # first bad commit:
>   [ef32b92ac605ba1b7692827330b9c60259f0af49]
>   minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()

That 'just' changed the test to use __builtin_constant_p() and
thus gets checked after the optimiser has run.

I can paraphrase the code as:
unsigned int fn(unsigned int x)
{
	return clamp(10, 5, x == 0 ? 0 : x - 1);
}
which is never actually called with x <= 5.
The compiler converts it to:
	return x < 0 ? clamp(10, 5, 0) : clamp(10, 5, x);
(Probably because it can see that clamp(10, 5, 0) is constant.)
And then the compile-time sanity check in clamp() fires.

The order of the arguments to clamp is just wrong!

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ