2008-01-22 Robert Millan <rmh@aybabtu.com>

* kern/powerpc/ieee1275/init.c (grub_claim_heap): Add sanity check to
        avoid claiming over our own code.
This commit is contained in:
robertmh 2008-01-22 20:10:27 +00:00
parent 34842f2d6b
commit 9dad816d3d
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-01-22 Robert Millan <rmh@aybabtu.com>
* kern/powerpc/ieee1275/init.c (grub_claim_heap): Add sanity check to
avoid claiming over our own code.
2008-01-22 Bean <bean123ch@gmail.com>
* conf/i386-pc.rmk (pkglib_MODULES): Add `jpeg.mod'.

View File

@ -1,7 +1,7 @@
/* init.c -- Initialize GRUB on the newworld mac (PPC). */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -143,6 +143,17 @@ static void grub_claim_heap (void)
(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. */