[Skiboot] [PATCH] Load ELF64 binaries correctly

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Jan 28 08:06:39 AEDT 2015


On Tue, 2015-01-27 at 10:00 -0800, Nathan Whitehorn wrote:
> On 01/27/15 09:59, Nathan Whitehorn wrote:
> > On 01/22/15 09:02, Benjamin Herrenschmidt wrote:
> >> On Wed, 2015-01-21 at 08:45 -0800, Nathan Whitehorn wrote:
> >>> The attached patch fixes the big-endian ELF64 loader in skiboot to
> >>> handle the fact that the ELF entry point is specified to point to a
> >>> function descriptor describing the entry point rather than the entry
> >>> point itself. (I haven't set it up to load the TOC base pointer though)
> >>> This is required to load the FreeBSD kernel as a skiboot payload. The
> >>> patch does not touch the little-endian loader since I'm not sure if the
> >>> ELFv2 spec still has function descriptors or not.
> >> An additional problem is that the Linux 64-bit BE kernel vmlinux doesn't
> >> have a correct function descriptor as an entry point :-( So that patch
> >> breaks loading a raw BE vmlinux... We probably need a quirk to recognize
> >> such an image, possibly via the fact that the value that would be in the
> >> function descriptor cannot possibly be a valid entry point as part of
> >> the image.
> >
> > Here's a second version of the patch that can load both Linux and 
> > FreeBSD. It iterates through the ELF section table and, if the entry 
> > point points to an executable section, treats the entry point as the 
> > first instruction to run. Otherwise, it treats it as a function 
> > descriptor.
> > -Nathan
> 
> Sorry, missed a file in the patch. Here's the right one.

I would have gone for something even simpler such as checking the
boundary of the descriptor :-) But what you did is probably cleaner.

Can you re-submit in the appropriate format ? I'm not sure we've
documented it yet but we follow the same practices as Linux here that 
is a subject, a changeset comment, a Signed-off-by line, then the patch
(the important thing for us is the S-O-B without which we cannot apply
it).

Cheers,
Ben.
 
> -Nathan




More information about the Skiboot mailing list