Hi! What do you think of adding this kind of checks? I know it's not a perfect safegard, but it can save your day in some situations (it helped me during i386/ieee1275 port, when link address was 0x100000).
-- Robert Millan <GPLv2> I know my rights; I want my phone call! <DRM> What use is a phone call… if you are unable to speak? (as seen on /.)
--- ../../grub2/kern/powerpc/ieee1275/init.c 2008-01-14 15:30:59.000000000 +0100 +++ kern/powerpc/ieee1275/init.c 2008-01-20 15:20:23.000000000 +0100 @@ -143,6 +143,17 @@ (total + (HEAP_MAX_ADDR - addr) > HEAP_MIN_SIZE)) /* only limit ourselves when we can afford to */ len = HEAP_MAX_ADDR - addr; + /* In theory, firmware should already prevent this from happening by not + listing our own image in /memory/available. The check below is intended + as a safegard in case that doesn't happen. It does, however, not protect + us from corrupting our module area, which extends up to a + yet-undetermined region above _end. */ + if ((addr < _end) && ((addr + len) > _start)) + { + grub_printf ("Warning: attempt to claim over our own code!\n"); + len = 0; + } + if (len) { /* Claim and use it. */
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel