Subject: Re: Disallowing mmapping of NULL
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 01/29/2007 21:31:36
On Mon, Jan 29, 2007 at 08:06:22PM +0100, Joerg Sonnenberger wrote:
> 
> It can't be activated by default as some emulation require this (like SYSV)
> or because it allows heavy optimisations with prefetching. I consider it
> useful enough to force under securelevel 2 though.

I'm not sure that any SYSV (or other) code will rely on mapping stuff to address 0.
IIRC support for reading address 0 was removed as part of the SVR4 port.
(Certainly from the sparc SVR4 I did most stuff on (and I don't mean solaris)).

It might be true that some of the program header gets mapped to zero, but that
would be a permanent mapping, not something that a program might expect mmap()
to perform.

Historically a byte read from address 0 returned the value 0, so that code
could do 'if (*ptr)' instead of 'if (ptr && *ptr)' in order to save code bytes.

	David

-- 
David Laight: david@l8s.co.uk