Re: NULL dereference ? why not ?

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

 



2007/1/3, Bernd Petrovitsch <bernd@xxxxxxxxx>:
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.

I think your description makes sense. But I can not find the
corresponding evidence in the kernel source code. What I discovered is
that the kernel does initialize the mapping for the first MB in
head.S. Could you please elaborate where in the code the kernel
disables the mapping?


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

Yes, this is ture. Just to further confirm my understanding, I think
this has no relationship to the NULL dereference problem. Because the
4MB granularity is used for kernel space only, which is upper 3GB
linear address and has no overlap to the NULL address. Is this
understanding correct?

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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux