qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] multiboot: Prevent loading of x86_64 images
Date: Thu, 19 Aug 2010 14:49:55 +0200	[thread overview]
Message-ID: <20100819124955.GK22245@os.inf.tu-dresden.de> (raw)
In-Reply-To: <AF532481-02A6-4EC6-80CC-67DF916621AA@suse.de>


On Thu Aug 19, 2010 at 14:34:10 +0200, Alexander Graf wrote:
> 
> On 19.08.2010, at 14:32, Adam Lackorzynski wrote:
> 
> > 
> > On Thu Aug 19, 2010 at 13:40:54 +0200, Alexander Graf wrote:
> >> 
> >> On 19.08.2010, at 13:36, Adam Lackorzynski wrote:
> >> 
> >>> 
> >>> On Thu Aug 19, 2010 at 13:27:32 +0200, Alexander Graf wrote:
> >>>> 
> >>>> On 19.08.2010, at 13:24, Adam Lackorzynski wrote:
> >>>> 
> >>>>> A via -kernel supplied x86_64 ELF image is being started in 32bit mode.
> >>>>> Detect and exit if a 64bit image has been supplied.
> >>>> 
> >>>> According to the multiboot spec, this is the expected behavior, no? At least Xen does it that way...
> >>> 
> >>> Yes, but then the supplied ELF-image should say it's a 32bit one and
> >>> switch to 64bit mode itself. That's at least how we do load a 64bit
> >>> kernel.
> >> 
> >> Hrm - maybe you're right:
> >> 
> >> busu:~ # readelf -a /boot/xen
> >> ELF Header:
> >>  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
> >>  Class:                             ELF32
> >> 
> >> What does the spec say here? What does grub do?
> > 
> > Grub starts the (multiboot-)OS in 32bit mode. Starting directly in 64bit
> > mode would require to setup page-tables etc. which is not done.
> > The Spec doesn't mention 64bit OS at all, and says that 32bit OSs are
> > fine ("An OS image may be an ordinary 32-bit executable file in the
> > standard format for that particular operating system, except that it may
> > be linked at a non-default load address to avoid loading on top of the
> > ...");
> 
> I think we should do the same grub does here. If grub loads 64-bit elf
> binaries and runs them in 32-bit mode, we should too. If it refuses to
> load them, we should too.

grub1:

grub> kernel (nd)/tftpboot/adam/bootstrap.elf                                  

Error 13: Invalid or unsupported executable format

grub>


grub2 loads it but then it crashes and reboots. Looks like a bug to me.



Adam
-- 
Adam                 adam@os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

  reply	other threads:[~2010-08-19 12:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19 11:24 [Qemu-devel] [PATCH] multiboot: Prevent loading of x86_64 images Adam Lackorzynski
2010-08-19 11:27 ` Alexander Graf
2010-08-19 11:36   ` Adam Lackorzynski
2010-08-19 11:40     ` Alexander Graf
2010-08-19 12:32       ` Adam Lackorzynski
2010-08-19 12:34         ` Alexander Graf
2010-08-19 12:49           ` Adam Lackorzynski [this message]
2010-08-19 13:01             ` Alexander Graf
2010-08-20 18:47             ` Rene Rebe
2010-08-19 13:02 ` Avi Kivity
2010-08-19 13:57   ` Alexander Graf
2010-08-19 14:05     ` Avi Kivity
2010-08-19 14:10       ` Alexander Graf
2010-08-19 14:12         ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2010-09-02 20:28 Adam Lackorzynski
2010-09-25  8:51 Adam Lackorzynski
2010-11-04 22:22 Adam Lackorzynski
2010-11-16 20:09 ` Anthony Liguori

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=20100819124955.GK22245@os.inf.tu-dresden.de \
    --to=adam@os.inf.tu-dresden.de \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    /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 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).