Posted Jul 17, 2009 14:44 UTC (Fri) by trasz (guest, #45786)
[Link]
Userspace code would get SEGV signal due to null pointer dereference and probably exit. Pretty much any kernel other than Linux would panic and restart. In Linux there is this strange "Oops" mechanism inspired probably by Windows 95, which makes the kernel try to continue. I've got an impression that it would make the code exit somehow instead of continuing past the null check that got optimized away, though.
Linux 2.6.30 exploit posted
Posted Jul 17, 2009 15:11 UTC (Fri) by hegel (guest, #49501)
[Link]
Posted Jul 18, 2009 9:11 UTC (Sat) by Ross (subscriber, #4065)
[Link]
Yes that's the usual response. But the compiler can apply the same logic in userspace and there are ways to make NULL dereferences not crash (installation of a SEGV signal handler, mapping something to page zero).
In any case, it's not like this would be a good idea for userspace code. If you care enough to check if a pointer is NULL, it should really be done before dereferencing it, otherwise it is too late to stop any undefined behavior. Even if you can be sure an implementation will just crash the program, what's the point of adding code afterwards which isn't reachable?