Spec#, nullables and more

Walter Bright newshound2 at digitalmars.com
Fri Nov 5 12:22:16 PDT 2010


Daniel Gibson wrote:
> Walter Bright schrieb:
>> It's infinitely worse. Null pointers do not result in memory 
>> corruption, buffer overflows, and security breaches.
>>
> 
> Not entirely true: Null Pointer dereferences *have* been used for 
> security breaches, see for example: http://lwn.net/Articles/342330/
> The problem is that one can mmap() to 0/NULL so it can be dereferenced 
> without causing a crash.
> 
> Of course this is also a problem of the OS, it shouldn't allow mmap()ing 
> to NULL in the first place (it's now forbidden by default on Linux and 
> FreeBSD afaik) - but some software (dosemu, wine) doesn't work without it.

I'm surprised. 20 years ago, OS design articles I've seen all said that the 
first thing to do was render the bottom 64Kb of address space inaccessible in 
order to catch null pointer dereferences. People were pretty fed up with Intel's 
decision to put the interrupt table in the first page of addresses, so any null 
pointers promptly trashed the operating system.

(Intel should have put the BIOS boot rom at location 0.)


More information about the Digitalmars-d mailing list