bug-grub
[Top][All Lists]
Advanced

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

Re: [PATCH] Bug in multiboot loader


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: [PATCH] Bug in multiboot loader
Date: Sat, 18 Dec 2010 14:23:21 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101211 Icedove/3.0.11

On 12/15/2010 10:39 PM, kashyap garimella wrote:
> Hello everybody,
>
> I have tried to boot Invaders <http://www.erikyyy.de/invaders/>, a
> small multiboot compliant kernel game, and found that it was not
> working(triple faults). After a lot of painful debugging, I found the
> bug in grub-core/loader/i386/multiboot_mbi.c. Here is the patch:
> === modified file 'grub-core/loader/i386/multiboot_mbi.c'
> --- grub-core/loader/i386/multiboot_mbi.c    2010-09-29 21:51:12 +0000
> +++ grub-core/loader/i386/multiboot_mbi.c    2010-12-15 21:25:52 +0000
> @@ -141,7 +141,7 @@
>      }
>  
>        if (header->bss_end_addr)
> -    grub_memset ((grub_uint32_t *) source + load_size, 0,
> +    grub_memset ((grub_uint8_t *) source + load_size, 0,
>               header->bss_end_addr - header->load_addr - load_size);
>  
>        grub_multiboot_payload_eip = header->entry_addr;
>
>
Thanks you. Committed locally will be pushed as soon as savannah is back
online.
> --
> The bug is very simple, but tough to find. "(grub_uint32_t *) source +
> load_size" will give the resultant address as "source + 4 *
> load_size", since source is made 32-bit pointer. But it is wrong
> because load_size is the size in bytes. So "source" should also be
> treated in bytes, i.e. grub_uint8_t. Hence a single line fix will
> solve the problem. Pfa the patch file. I have read the multiboot specs
> from here </>. I have used grub_printf to debug. I would like to know
> if there is any better debugging technique for memory debugging.
>
> Thanks,
> Kashyap Garimella
>
>
> _______________________________________________
> Bug-grub mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-grub
>   


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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