[coreboot] [RFC] Null pointer trap?

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Fri Nov 7 15:24:33 CET 2008


v3 does not have any mechanism to detect NULL pointers used by accident.

I propose to fill the zero page (0x0-0xfff) with a special POISON_BYTE,
maybe 0x6b. Furthermore, I'd like to make sure passing a NULL pointer
(or something near it) to as a string to printk will be very visible in
the logs.
*(char *)0 = "ERROR NULL POINTER DEREFERENCE!\n";
The C statement above would cause a nice print everytime someone
referenced the first 32 bytes in %s.

Another way to do this is extending the non-NULL check in printk to
cover the whole zero page.

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the coreboot mailing list