Stable kernels 2.6.27.27 and 2.6.30.2
Stable kernels 2.6.27.27 and 2.6.30.2
Posted Jul 20, 2009 15:10 UTC (Mon) by zorro (subscriber, #45643)In reply to: Stable kernels 2.6.27.27 and 2.6.30.2 by qg6te2
Parent article: Stable kernels 2.6.27.27 and 2.6.30.2
Posted Jul 20, 2009 15:40 UTC (Mon)
by nybble41 (subscriber, #55106)
[Link]
With the recent changes this optimization is no longer performed, which--as a fix for a single obvious logic error in the code--will lead to less efficient code in general without solving the core issue, which is the failure to test for NULL before dereferencing a potentially-NULL pointer. It would make more sense to either guarantee that execution will not continue following a NULL dereference or classify all NULL dereferences as exploitable vulnerabilities (or both).
Posted Jul 20, 2009 16:33 UTC (Mon)
by luto (guest, #39314)
[Link]
The reason that the kernel wants this option but userspace doesn't is because, in kernel space, an attacker might map something into address 0, so assuming that null pointer dereferences always crash is dangerous. In userspace, on the other hand, you've already been owned by the time someone maps something at address 0.
Posted Jul 20, 2009 19:25 UTC (Mon)
by stevenb (guest, #11536)
[Link]
But examples abound. Simple one from http://lwn.net/Articles/342226/:
inline char foo(char *p) { if (p == 0) return 0; else return *p; }
I already see GCC bugzilla fill with complaints when it would no longer compile this (perfectly valid) piece of code with a redundant NULL pointer check...
Stable kernels 2.6.27.27 and 2.6.30.2
Stable kernels 2.6.27.27 and 2.6.30.2
Stable kernels 2.6.27.27 and 2.6.30.2
char bar(char *p) { *p = 2; return foo(p); }
int main() { char c = 0; return bar(&c); }
