grub-devel
[Top][All Lists]
Advanced

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

Re: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD


From: Vladimir 'phcoder' Serbinenko
Subject: Re: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD
Date: Sun, 30 Aug 2009 18:55:24 +0200

diff --git a/ChangeLog b/ChangeLog
index 217a433..9e562a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-08-30  Vladimir Serbinenko  <address@hidden>
+
+       * loader/i386/bsdXX.c (SUFFIX (grub_freebsd_load_elfmodule)): Fix
+       loading of headers in some cases.
+
 2009-08-28  Vladimir Serbinenko  <address@hidden>

        * include/grub/i386/xnu.h: Add license header.
diff --git a/loader/i386/bsdXX.c b/loader/i386/bsdXX.c
index 3f15579..aedc204 100644
--- a/loader/i386/bsdXX.c
+++ b/loader/i386/bsdXX.c
@@ -197,15 +197,15 @@ SUFFIX (grub_freebsd_load_elfmodule)
(grub_file_t file, int argc, char *argv[],
   if (curload < module + sizeof (e))
     curload = module + sizeof (e);

-  load (file, UINT_TO_PTR (module + e.e_shoff), e.e_shoff,
+  load (file, UINT_TO_PTR (curload), e.e_shoff,
        e.e_shnum * e.e_shentsize);
-  if (curload < module + e.e_shoff + e.e_shnum * e.e_shentsize)
-    curload = module + e.e_shoff + e.e_shnum * e.e_shentsize;
+  e.e_shoff = curload - module;
+  curload +=  e.e_shnum * e.e_shentsize;

-  load (file, UINT_TO_PTR (module + e.e_phoff), e.e_phoff,
+  load (file, UINT_TO_PTR (curload), e.e_phoff,
        e.e_phnum * e.e_phentsize);
-  if (curload < module + e.e_phoff + e.e_phnum * e.e_phentsize)
-    curload = module + e.e_phoff + e.e_phnum * e.e_phentsize;
+  e.e_phoff = curload - module;
+  curload +=  e.e_phnum * e.e_phentsize;

   *kern_end = curload;


On Sun, Aug 30, 2009 at 5:51 PM, Aurelien Jarno<address@hidden> wrote:
> Hi all,
>
> I am forwarding this mail from Petr Salinger about a problem with GRUB 2
> loading acpi.ko (and probably other modules).
>
> In short due to recent changes in the toolchain (not yet identified),
> the modules are not page aligned anymore, and contains a .comment
> section. This does not causes any problem when using the original
> FreeBSD loader, but this causes a kernel panic when used with GRUB 2.
>
> This is reported in Debian as bug#544305 [1].
>
> Don't hesitate to ask if you want more details or tests.
>
> Thanks,
> Aurelien
>
> [1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=544305
>
>
> On Sun, Aug 30, 2009 at 04:40:33PM +0200, Petr Salinger wrote:
>> Package: grub2
>> User: address@hidden
>> Usertags: kfreebsd
>> X-Debbugs-CC: address@hidden, address@hidden
>>
>>
>> Hello,
>>
>> we have some problems with grub2 and loading acpi.ko for FreeBSD kernel.
>> With some acpi.ko the kernel panics. The same kernel without acpi.ko
>> boots fine. See also thread started by
>> http://lists.debian.org/debian-bsd/2009/08/msg00147.html
>>
>> It is still unclear what the real reason is,
>> so far only acpi enable boots are affected.
>> It looks like the problem lies in interaction
>> between gnu linker and grub bootloader and FreeBSD kernel.
>>
>> Maybe only GRUB 2 based installation are affected,
>> the kfreebsd-loader loads acpi.ko from 7.2-5 fine.
>>
>> There are 3 different version of acpi.ko,
>> compiled by different binutils and/or different linking parameters.
>>
>> a) acpi_725_fail.ko
>> b) acpi_b20090805_fail.ko
>> c) acpi_b20090723_works.ko
>>
>> The only difference between b) and c) is .comment section.
>> After "objcopy --remove-section=.comment" it loads also fine.
>>
>> The interesting might be parts of "readelf -l -S",
>> the differences are:
>>
>> Program Headers:
>> a)
>>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>>   LOAD           0x000000 0x00000000 0x00000000 0x54248 0x54248 R E 0x1000
>>   LOAD           0x054248 0x00055248 0x00055248 0x02414 0x03c84 RW  0x1000
>>   DYNAMIC        0x054248 0x00055248 0x00055248 0x00078 0x00078 RW  0x4
>>   GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
>>
>> b), c)
>>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>>   LOAD           0x000000 0x00000000 0x00000000 0x54008 0x54008 R E 0x1000
>>   LOAD           0x055000 0x00055000 0x00055000 0x0241c 0x03c8c RW  0x1000
>>   DYNAMIC        0x055000 0x00055000 0x00055000 0x00078 0x00078 RW  0x4
>>   GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RWE 0x4
>>
>> Length and attributes of .comment section
>>
>> a) [15] .comment          PROGBITS        00000000 05665c 000cd8 01  MS  0   
>> 0  1
>> b) [15] .comment          PROGBITS        00000000 05741c 000cd8 01  MS  0   
>> 0  1
>> c) [15] .comment          PROGBITS        00000000 05741c 001cef 00      0   
>> 0  1
>>
>> I will try to attach all acpi.ko to the debian BTS later.
>>
>> Petr
>>
>>
>>
>> --
>> To UNSUBSCRIBE, email to address@hidden
>> with a subject of "unsubscribe". Trouble? Contact address@hidden
>>
>>
>
> --
> Aurelien Jarno                          GPG: 1024D/F1BCDB73
> address@hidden                 http://www.aurel32.net
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git




reply via email to

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