All of lore.kernel.org
 help / color / mirror / Atom feed
* Fwd: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD
       [not found] <Pine.LNX.4.62.0908301619030.7550@sci.felk.cvut.cz>
@ 2009-08-30 15:51 ` Aurelien Jarno
  2009-08-30 16:00   ` Vladimir 'phcoder' Serbinenko
  2009-08-30 16:55   ` Vladimir 'phcoder' Serbinenko
  0 siblings, 2 replies; 4+ messages in thread
From: Aurelien Jarno @ 2009-08-30 15:51 UTC (permalink / raw)
  To: grub-devel

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: debian-bsd@lists.debian.org
> Usertags: kfreebsd
> X-Debbugs-CC: debian-bsd@lists.debian.org, grub-devel@gnu.org
>
>
> 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 debian-bsd-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD
  2009-08-30 15:51 ` Fwd: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD Aurelien Jarno
@ 2009-08-30 16:00   ` Vladimir 'phcoder' Serbinenko
  2009-08-30 16:55   ` Vladimir 'phcoder' Serbinenko
  1 sibling, 0 replies; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-08-30 16:00 UTC (permalink / raw)
  To: The development of GRUB 2

debugging it

On Sun, Aug 30, 2009 at 5:51 PM, Aurelien Jarno<aurelien@aurel32.net> 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: debian-bsd@lists.debian.org
>> Usertags: kfreebsd
>> X-Debbugs-CC: debian-bsd@lists.debian.org, grub-devel@gnu.org
>>
>>
>> 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 debian-bsd-REQUEST@lists.debian.org
>> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>>
>>
>
> --
> Aurelien Jarno                          GPG: 1024D/F1BCDB73
> aurelien@aurel32.net                 http://www.aurel32.net
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD
  2009-08-30 15:51 ` Fwd: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD Aurelien Jarno
  2009-08-30 16:00   ` Vladimir 'phcoder' Serbinenko
@ 2009-08-30 16:55   ` Vladimir 'phcoder' Serbinenko
  2009-08-30 19:13     ` Aurelien Jarno
  1 sibling, 1 reply; 4+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2009-08-30 16:55 UTC (permalink / raw)
  To: The development of GRUB 2

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

 	* 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<aurelien@aurel32.net> 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: debian-bsd@lists.debian.org
>> Usertags: kfreebsd
>> X-Debbugs-CC: debian-bsd@lists.debian.org, grub-devel@gnu.org
>>
>>
>> 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 debian-bsd-REQUEST@lists.debian.org
>> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>>
>>
>
> --
> Aurelien Jarno                          GPG: 1024D/F1BCDB73
> aurelien@aurel32.net                 http://www.aurel32.net
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>



-- 
Regards
Vladimir 'phcoder' Serbinenko

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD
  2009-08-30 16:55   ` Vladimir 'phcoder' Serbinenko
@ 2009-08-30 19:13     ` Aurelien Jarno
  0 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2009-08-30 19:13 UTC (permalink / raw)
  To: The development of GRUB 2

On Sun, Aug 30, 2009 at 06:55:24PM +0200, Vladimir 'phcoder' Serbinenko wrote:
> diff --git a/ChangeLog b/ChangeLog
> index 217a433..9e562a0 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2009-08-30  Vladimir Serbinenko  <phcoder@gmail.com>
> +
> +	* loader/i386/bsdXX.c (SUFFIX (grub_freebsd_load_elfmodule)): Fix
> +	loading of headers in some cases.
> +

I confirm it works, thanks a lot!

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-30 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.62.0908301619030.7550@sci.felk.cvut.cz>
2009-08-30 15:51 ` Fwd: Bug#544305: load of some acpi.ko leads to panic on GNU/kFreeBSD Aurelien Jarno
2009-08-30 16:00   ` Vladimir 'phcoder' Serbinenko
2009-08-30 16:55   ` Vladimir 'phcoder' Serbinenko
2009-08-30 19:13     ` Aurelien Jarno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.