commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[1861] 2008-09-08 Robert Millan <address@hidden>


From: Robert Millan
Subject: [1861] 2008-09-08 Robert Millan <address@hidden>
Date: Mon, 08 Sep 2008 19:10:17 +0000

Revision: 1861
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1861
Author:   robertmh
Date:     2008-09-08 19:10:16 +0000 (Mon, 08 Sep 2008)

Log Message:
-----------
2008-09-08  Robert Millan  <address@hidden>

        * loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Skip
        segments when their filesz is zero (grub_file_read() interprets
        zero-size as "read untill EOF", which results in memory corruption).
        Use `lowest_segment' rather than 0 for calculating the current
        segment load address.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/loader/i386/pc/multiboot.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2008-09-08 14:00:29 UTC (rev 1860)
+++ trunk/grub2/ChangeLog       2008-09-08 19:10:16 UTC (rev 1861)
@@ -1,5 +1,13 @@
 2008-09-08  Robert Millan  <address@hidden>
 
+       * loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Skip
+       segments when their filesz is zero (grub_file_read() interprets
+       zero-size as "read untill EOF", which results in memory corruption).
+       Use `lowest_segment' rather than 0 for calculating the current
+       segment load address.
+
+2008-09-08  Robert Millan  <address@hidden>
+
        * util/hostdisk.c (open_device): Replace a grub_util_info() call
        with grub_dprintf("hostdisk", ...), as it was so verbose that it
        clobbered useful information.

Modified: trunk/grub2/loader/i386/pc/multiboot.c
===================================================================
--- trunk/grub2/loader/i386/pc/multiboot.c      2008-09-08 14:00:29 UTC (rev 
1860)
+++ trunk/grub2/loader/i386/pc/multiboot.c      2008-09-08 19:10:16 UTC (rev 
1861)
@@ -158,7 +158,7 @@
 #define phdr(i)                        ((Elf32_Phdr *) (phdr_base + (i) * 
ehdr->e_phentsize))
 
   for (i = 0; i < ehdr->e_phnum; i++)
-    if (phdr(i)->p_type == PT_LOAD)
+    if (phdr(i)->p_type == PT_LOAD && phdr(i)->p_filesz != 0)
       {
        if (phdr(i)->p_paddr < phdr(lowest_segment)->p_paddr)
          lowest_segment = i;
@@ -177,9 +177,9 @@
   /* Load every loadable segment in memory.  */
   for (i = 0; i < ehdr->e_phnum; i++)
     {
-      if (phdr(i)->p_type == PT_LOAD)
+      if (phdr(i)->p_type == PT_LOAD && phdr(i)->p_filesz != 0)
         {
-         char *load_this_module_at = (char *) (grub_multiboot_payload_orig + 
(phdr(i)->p_paddr - phdr(0)->p_paddr));
+         char *load_this_module_at = (char *) (grub_multiboot_payload_orig + 
(phdr(i)->p_paddr - phdr(lowest_segment)->p_paddr));
 
          grub_dprintf ("multiboot_loader", "segment %d: paddr=%p, 
memsz=0x%x\n",
                        i, (void *) phdr(i)->p_paddr, phdr(i)->p_memsz);






reply via email to

[Prev in Thread] Current Thread [Next in Thread]