bug-grub
[Top][All Lists]
Advanced

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

bugs in loader/i386/pc/multiboot.c


From: Tom Bachmann
Subject: bugs in loader/i386/pc/multiboot.c
Date: Fri, 16 Jan 2009 17:20:50 +0100
User-agent: Mozilla-Thunderbird 2.0.0.17 (X11/20081018)

Hi list,

first of all, please CC me in your replies, I'm not subscribed.

I have been using grub2 for a while now (it's just nicer than grub legacy to work with, especially as it can load my 64 bit elf files). I didn't realize, however, that you switched to svn (guess that says something about my attentiveness - and the usefulness of grub2), so I just today got a report from a codeveloper who said he couldn't boot my code with the newest grub2 build. I'm now running grub2 (latest svn) inside qemu-system-x86_64 (version 0.9.1) on x86_64 (debian).

Now, as it turns out, it doesn't work for me, either. After fiddling around with my kernel image for quite a while I convinced myself that this is a grub bug: even with _start: jmp _start (i.e. the entire kernel effectively consisting of a while(1)/*do nothing*/; loop), qemu either signals a triple-fault or the code loops at a completely different address. Using manually inserted calls to grub_printf, I found the following problems in loader/i386/pc/multiboot.c.

1) The entry address is overwritten.
At line 462 grub_multiboot_load_elf is called. This initializes the variable ENTRY as a side effect. However, at lines 478/484 this variable is overwritten with a (as far as I can tell) non-sensical value. I'm really trying not to make this sound like a rant, but I cannot believe this code has ever worked in this constellation.

2) Reading the mmap doesn't work.
Now this could be a qemu artifact (would still be nice to fix), but even with the two above-mentioned lines removed the code doesn't seem to work. I still have to uncomment lines 466-468 which call grub_fill_multiboot_mmap. This call doesn't seem to return. Indeed my introspection printfs suggest that the inner hook of that function is called three times, but adding printfs to grub_machine_map_iterate (in kern/i386/pc/mmap.c I believe) doesn't seem to work (just crashes grub?) and so I had to stop looking around here.

I hope my description is helpful and I have included everything necessary.

Thanks,
Tom
--
-ness-




reply via email to

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