All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@suse.de>
To: Christian.Limpach@cl.cam.ac.uk
Cc: xen-devel@lists.xensource.com, Joe Bonasera <joe.bonasera@sun.com>
Subject: Re: [PATCH] Elf loader fixes
Date: Wed, 01 Mar 2006 16:00:02 +0100	[thread overview]
Message-ID: <4405B6F2.7090009@suse.de> (raw)
In-Reply-To: <3d8eece20603010148v692d8ba6oc89a841c7394303f@mail.gmail.com>

  Hi,

> I have two issues with your latest patch:
> - the heuristics you use to distinguish between "old" and "new" kernel
> images, especially the case where a valid "new" kernel image could be
> mistaken for an "old" image.

I don't think it can ever happen, at least not with linux.  The
(correct) paddr addresses must be relatively small, otherwise loading
the kernel on machines with a small amount of memory will not work.
Especially they must be much smaller than the usual linux kernel VIRT_BASE.

Not sure about other OS'es, maybe there are some which use a small
VIRT_BASE, then it could be problematic, yes.

> - the change to the entry point, now entry point and the elf header
> paddr fields are in different address modes.

xen/include/xen/elf.h says entry point is virtual.  IMHO the elf headers
should be correctly filled.

> - we want to be able to specify where the virtual address space mapped
> by the initial pagetables starts, this is why we have VIRT_BASE

Sure.

> - since we always run in virtual address mode, we thought that the
> loader should also do so, thus it will load the image to a virtual
> address - this seems to be in line with how other loaders would read
> the elf header paddr fields, i.e. use them as load addresses.

Well, loadelfimage() in tools/libxc/xc_load_elf.c copyes the image
page-by-page to the _physical_ addresses.  And this is how it should be
IMHO.  virt_base is only used to create the initial virtual mappings as
expected by the guest kernel (and for bug-compatibility with old kernels).

The dom0 builder can take a shortcut and simply copy the big blobs to
virtual addresses (paddr + virt_base).  That works because the initial
virtual mapping is a simple offset to the physical address and the
mappings are already created and active at that point.

> If we really need to get rid of how we change LOAD_OFFSET in Linux,
> how about this:
> we add another entry to the __xen_guest header, PHYS_OFFSET=0 and then
> substract PHYS_OFFSET from all elf header paddr fiels to turn them
> into physical addresses, respectively, resp. add VIRT_BASE-PHYS_OFFSET
> to turn them into virtual addresses.  We default PHYS_OFFSET to
> VIRT_BASE if it's not present in the __xen_guest header.

I don't think the new PHYS_OFFSET is needed.

cheers,

  Gerd

-- 
Gerd 'just married' Hoffmann <kraxel@suse.de>
I'm the hacker formerly known as Gerd Knorr.
http://www.suse.de/~kraxel/just-married.jpeg

  reply	other threads:[~2006-03-01 15:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1F6x4v-0001lS-2n@host-192-168-0-1-bcn-london>
2006-02-22 18:17 ` [PATCH] Elf loader fixes Joe Bonasera
2006-02-23 11:15   ` Gerd Hoffmann
2006-03-01  9:48     ` Christian Limpach
2006-03-01 15:00       ` Gerd Hoffmann [this message]
2006-03-06 13:40       ` Gerd Hoffmann
2006-02-22 11:37 Gerd Hoffmann
2006-02-22 12:51 ` Jan Beulich
2006-02-22 13:33   ` Gerd Hoffmann
2006-02-22 15:12   ` Gerd Hoffmann
2006-02-22 15:30     ` Jan Beulich
2006-02-22 16:10       ` Gerd Hoffmann
2006-02-22 16:11         ` Ronald G Minnich
2006-02-22 16:25         ` Jacob Gorm Hansen

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=4405B6F2.7090009@suse.de \
    --to=kraxel@suse.de \
    --cc=Christian.Limpach@cl.cam.ac.uk \
    --cc=joe.bonasera@sun.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.