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]
Date: Tue, 16 Apr 2024 11:09:26 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Segher Boessenkool' <segher@...nel.crashing.org>, Naresh Kamboju
	<naresh.kamboju@...aro.org>
CC: Nathan Chancellor <nathan@...nel.org>, Anders Roxell
	<anders.roxell@...aro.org>, Linux Regressions <regressions@...ts.linux.dev>,
	Arnd Bergmann <arnd@...db.de>, clang-built-linux <llvm@...ts.linux.dev>,
	"Nick Desaulniers" <ndesaulniers@...gle.com>, open list
	<linux-kernel@...r.kernel.org>, "lkft-triage@...ts.linaro.org"
	<lkft-triage@...ts.linaro.org>, Aneesh Kumar K.V <aneesh.kumar@...nel.org>,
	Jeff Xu <jeffxu@...omium.org>, "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
	linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>, Dan Carpenter
	<dan.carpenter@...aro.org>, Kees Cook <keescook@...omium.org>
Subject: RE: powerpc: io-defs.h:43:1: error: performing pointer arithmetic on
 a null pointer has undefined behavior [-Werror,-Wnull-pointer-arithmetic]

From: Segher Boessenkool
> Sent: 16 April 2024 11:38
> 
> On Tue, Apr 16, 2024 at 03:02:52PM +0530, Naresh Kamboju wrote:
> > In file included from arch/powerpc/include/asm/io.h:672:
> > arch/powerpc/include/asm/io-defs.h:43:1: error: performing pointer
> > arithmetic on a null pointer has undefined behavior
> > [-Werror,-Wnull-pointer-arithmetic]
> 
> It is not UB, but just undefined: the program is meaningless.
> 
> It is not a null pointer but even a null pointer constant here.  It
> matters in places, including here.
> 
> It would help if the warnings were more correct :-(

Isn't it only a problem because the NULL pointer isn't required to
be the all-zero bit pattern?

So when do we get a warning from using memset() on a structure
that contains pointers? Since it is equally buggy.

Has anyone ever seen a system where NULL wasn't 'all zeros'?
I've used a system where the 'native' invalid pointer was 'all ones',
but even there the C code used 'all zeros'.

	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