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

Aurelien Jarno aurelien at aurel32.net
Sun Aug 30 19:21:10 UTC 2009


tag 544305 + fixed-upstream
tag 544305 + patch
thanks

On Sun, Aug 30, 2009 at 04:40:33PM +0200, Petr Salinger wrote:
> Package: grub2
> User: debian-bsd at lists.debian.org
> Usertags: kfreebsd
> X-Debbugs-CC: debian-bsd at lists.debian.org, grub-devel at 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
>

Upstream has been very reactive and already provided a patch. Please 
find it below.

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



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





More information about the Pkg-grub-devel mailing list