LKML Archive on
help / color / mirror / Atom feed
From: Etienne Lorrain <>
Cc: "H. Peter Anvin" <>,,
	"Eric W. Biederman" <>
Subject: Re : [PATCH] Compressed ia32 ELF file generation for loading by Gujin 1/3
Date: Fri, 9 Feb 2007 14:04:25 +0100 (CET)	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

--- Vivek Goyal <> wrote:
> No, as of today, kexec does not relocate vmlinux. At compilation time,
> vmlinux is compiled for a fixed address and vmlinux is loaded at that
> address. This compile address can be controlled with CONFIG_PHYSICAL_START,
> as you already mentioned in your patchset.
> So in the case of kdump, if one wishes to use vmlinux instead of a relocatable
> bzImage, he will re-compile the kernel for a different address and then use
> that vmlinux.
> OTOH, boot loader can possibly relocate vmlinux because all the relocation
> information is retained in vmlinux (Using ld option --emit-relocs). But
> probably self relocating image should be a better option as all the
> boot-loaders out there don't have to be modifed.

  Well, a self relocating image cannot be an ELF file because the code
 to relocate the ELF cannot be executed at the wrong place.
 If relocation is needed, I would better like not to link vmlinux at a
 fixed address first. In fact I wonder if we are talking of the same
 kind of relocation: you seem to talk about "ld --pic-executable" while
 I am thinking of "ld -r" to "locate" it at the bootloader loading time.
  The main problem I see is that I do not have the code for that, and
 I am going deeper/earlier into the generation of vmlinux, while comments
 are "already you are too early, loading an ELF file is too complex for
 a bootloader". The solution I have already is working.

> > If you cannot get a PT_LOAD
> > section, maybe we can put a simple system in NOTE, or just create a
> > PT_LOAD16 if the linker accepts other values.
> My guess is that PT_LOAD16 is not an acceptable value. Putting information
> in PT_NOTE seems interesting (As Eric already mentioned).

 In fact, thinking more about that, I am going back to my implementation
 of it, because on ia32 the interrupt vectors are at address zero and it is
 obviouly an invalid address to load an ELF for this architecture.
 But for the linker, it is the right address to link it (being an offset
 into a non-null segment in real mode), and because the entry point has
 to be zero (I cannot use the ELF entry value) the program header base
 address has to be zero.
 Anyway, your loader in (probably) written in C, so a test against zero
 is a simple thing to do, and should be done anyway to check for an
 incorrect ELF program header. I wonder if this NOTE program header is
 not simply designed as an "end" marker, it does not seem to contain
 anything, so me defining the realmode after that program header may
 be a good idea.

> We already do checksum verification to make sure newly loaded kernel has
> not been corrupted before we jump to it. What's the point in doing the
> verification existing kernel text. Because even that is intact, and you
> reload your data section, that data section will have to be reloaded at
> the same place where previous data section was. Now after you re-loaded 
> the data section, some DMA might corrupt it now (Because we never stopped
> DMAs). So loading a fresh copy of text and data section at a reserved 
> memory location seems safer.

 If you really are tring to catch an erroneous DMA into the kernel,
 is it better to keep an exact copy of the kernel you are using somewhere
 else to do a bit-to-bit comparisson after the crash, and so no relocate.
 Anyway if the DMA crash has crashed the exception handling area the system
 is dead anyway.

> Interesting question, How does a boot loader/user decide where to load
> the relocatable image? I think it depends on the new interesting usages
> of the relocatable kernel. As of today, kexec knows where is reserved
> memory region (Read from /proc/iomem) and it loads the image at the
> start of that reserved region (Meeting alignment restrictions, if any). So
> in this case boot loader takes the decision. May be a user option also
> can be created, something like --load-address=0xXYZ and then people
> can have fun loading same image at various addresses.

 I think that you are asking too much for the bootloader user, and that
is a decision he has to take *before* the crash; even me, I would select
one address like 16 Mbytes and stick with it...
 If the running Linux kernel do not erase Gujin from memory, it could
also go back to real mode and do a "longjmp()" to return to the
Gujin interface - but most of the times the system had a reason to
crash (for instance a ventilator stopped working) and you can plan
whatever you want in software...



Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses

  reply	other threads:[~2007-02-09 13:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-08 13:10 Etienne Lorrain
2007-02-09  5:59 ` Vivek Goyal
2007-02-09 13:04   ` Etienne Lorrain [this message]
2007-02-09 19:42     ` Eric W. Biederman
2007-02-11 13:23       ` RE : " Etienne Lorrain
2007-02-11 20:49         ` Eric W. Biederman
2007-02-12 10:42           ` Etienne Lorrain
2007-02-12 12:29             ` Eric W. Biederman
2007-02-12 13:58               ` Etienne Lorrain
2007-02-12 14:06               ` H. Peter Anvin
2007-02-12 19:47                 ` Eric W. Biederman
  -- strict thread matches above, loose matches on Subject: below --
2007-02-08  9:48 Etienne Lorrain
2007-02-08 11:20 ` Eric W. Biederman
2007-02-08 11:37 ` Vivek Goyal
2007-02-08 12:10   ` Eric W. Biederman
2007-02-07 14:29 Etienne Lorrain
2007-02-07 17:12 ` H. Peter Anvin
2007-02-06 17:23 Etienne Lorrain
2007-02-06 17:34 ` H. Peter Anvin
2007-02-06 18:12 ` Eric W. Biederman
2007-02-06 13:23 Etienne Lorrain
2007-02-06 13:12 Etienne Lorrain
2007-02-07  6:44 ` Vivek Goyal
2007-02-06 12:49 Etienne Lorrain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \
    --subject='Re: Re : [PATCH] Compressed ia32 ELF file generation for loading by Gujin 1/3' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).