[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NULL dereference ? why not ?



On Wed, 2007-01-03 at 12:58 +0200, Momchil Velikov wrote:
[....]
>  by may, in principle, at address 1.  However, it's convenient to have
> the system trap dereferencing null pointers (which is undefined
> behavior) in order to aid in debugging programs.  Thus a whole page at
> address 0 must be unmapped, since that's the granularity the memory
> protection works.

ACK.
In practice the Linux kernel didn't map the first MB
(<disclaimer>IIRC</disclaimer>) to catch also errors like "x + 3000"
where x is a pointer  x == NULL errors.
And performancewise it makes sense to put the limit to "TLB
granularity" (which is e.g. 4MB on common 32bit Intel CPUs IIRC) to
minimize (quite expensive) TLB switches.

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/