Query regarding ELF loader arg style

Vivek Goyal vgoyal at redhat.com
Fri Jan 17 09:03:47 EST 2014


On Thu, Jan 16, 2014 at 03:27:13PM -0800, Eric W. Biederman wrote:

[..]
> > - ELF does not tell anything whether it is self relocating or not. So we
> >   are forced to load it at a address it has been compiled for (In case of
> >   kdump). And that address is already occupied by current running kernel
> >   so it does not work.
> 
> ELF does tell you if it is relocatable in the e_type field of the main
> elf header.  In particular ET_DYN vs ET_EXEC.  ET_DYN can be loaded
> anywhere, and ET_EXEC must be loaded at the specified address.  It would
> not surprise me if the kernel build process is using ET_EXEC in error.
> 
> ET_DYN is also what is used for PIE executables and shared libraires.
> 
> The rule with ET_DYN without a dynamic linker is that a constant offset
> must be added to the load address of all of the program segments but
> otherwise nothing changes.  I thought I had support for that form in
> kexec-tools.
> 
> Perhaps not.

Hi Eric,

Kexec-tools supports ET_DYN. I saw code for that. Current kernel vmlinux
is ET_EXEC though and expects to be loaded at the address for it has been
compiled for.

I think in intial version of patches I will just support ET_EXEC and then
support for ET_DYN can be added later. It should really be simple as  all
the core structure to find a memory hole and load buffers there will
already be present. And at that time one can look into converting vmlinux
to a ET_DYN instead of ET_EXEC.

Thanks
Vivek



More information about the kexec mailing list