grub-devel
[Top][All Lists]
Advanced

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

Dynamic loader


From: Marco Gerards
Subject: Dynamic loader
Date: Sun, 19 Sep 2004 12:32:33 +0000
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

Hi,

As I mentioned earlier I am working on loadable module support for the
PPC.  I had a lot of problems with this so I decided to play a bit
with grub-emu to see what is going on.

At the moment this is still a big hack (and a few minutes work), if
Thomas does not mind I will make it work properly.

I found a big problem in kern/dl.c.  Two pointers are added and GRUB
is writing outside memory reserved for it, if I understand it
correctly.  I really hope Okuji can have a look at this and tell me
what is going on.  I am not familiar with this code and I am afraid it
can take a while to understand what is going on for me.

In `grub_dl_resolve_symbols' the following things are done:

In the case STT_FUNC the `sym->st_value' has a valid pointer.  After
that the following thing happens:

          sym->st_value += (Elf_Addr) grub_dl_get_section_addr (mod,
                                                                sym->st_shndx);

Another (valid) pointer gets added.  This results in an invalid
pointer which is used afterwards.  I think this happens consistently
and that is why nothing seems wrong when using GRUB.  In grub-emu this
simply means a segfault.  This segfault happens when `mod->init' is
called, which points to a non-executable region of memory.

When I reserve a lot (100 MB is what I used) of memory using mmap and
make sure it is executable it works because the memory that was
accidently used was allocated.

Any kind of help is appreciated.

Thanks,
Marco





reply via email to

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