grub-devel
[Top][All Lists]
Advanced

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

Re: [PATCH, RFC, RFT] ARM relocation fixes


From: Leif Lindholm
Subject: Re: [PATCH, RFC, RFT] ARM relocation fixes
Date: Mon, 2 Dec 2013 18:32:47 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Dec 02, 2013 at 03:33:06PM +0100, Leif Lindholm wrote:
> > > Ok, so I've tested this on arm64, and it works on the commercial FVP
> > > Base model (which does not trigger veneer generation due to its runtime
> > > memory map), but crashes on the Foundation model (which does).
> > > So the generic dl refactoring seems correct, but somehing about the
> > > veneers is fishy.
> > 
> > Well, this one seems to be because mod->trampptr is never initilised
> > (which should be a problem also on the other archs?).
> > 
> > With
> > diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
> > index 33ccc98..92027e0 100644
> > --- a/grub-core/kern/dl.c
> > +++ b/grub-core/kern/dl.c
> > @@ -317,6 +317,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
> >  #if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__)
> >    ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
> >    mod->tramp = ptr;
> > +  mod->trampptr = (ptr + tramp);
> >    ptr += tramp;
> >    ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN);
> >    mod->got = ptr;
> > 
> > This runs successfully on my foundation model.
> 
> Umm, that's obviously not correct. But it did work :)
> 
> What is needed is to store the size of the module before adding
> trampoline and got sizes.

So - after some much needed Lunch, and coffee, I think the below would
be correct?

diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c
index 33ccc98..a83b744 100644
--- a/grub-core/kern/dl.c
+++ b/grub-core/kern/dl.c
@@ -316,10 +316,10 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
     }
 #if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc__)
   ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
-  mod->tramp = ptr;
+  mod->tramp = mod->trampptr = ptr;
   ptr += tramp;
   ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN);
-  mod->got = ptr;
+  mod->got = mod->gotptr = ptr;
   ptr += got;
 #endif
 
/
    Leif



reply via email to

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