Received: from [140.186.70.92] (port=50186 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Om5ct-0002SJ-CF for qemu-devel@nongnu.org; Thu, 19 Aug 2010 09:57:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Om5cr-0008UJ-Up for qemu-devel@nongnu.org; Thu, 19 Aug 2010 09:57:50 -0400 Received: from cantor.suse.de ([195.135.220.2]:41248 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Om5cr-0008U3-Oh for qemu-devel@nongnu.org; Thu, 19 Aug 2010 09:57:49 -0400 Subject: Re: [Qemu-devel] [PATCH] multiboot: Prevent loading of x86_64 images Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <4C6D2B5F.40805@redhat.com> Date: Thu, 19 Aug 2010 15:57:47 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <29F80855-96F3-429F-9AFB-44009B107487@suse.de> References: <20100819112414.GH22245@os.inf.tu-dresden.de> <4C6D2B5F.40805@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org On 19.08.2010, at 15:02, Avi Kivity wrote: > On 08/19/2010 02:24 PM, 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. >>=20 >>=20 >>=20 >> diff --git a/hw/multiboot.c b/hw/multiboot.c >> index dc980e6..e9dcbc9 100644 >> --- a/hw/multiboot.c >> +++ b/hw/multiboot.c >> @@ -171,6 +171,12 @@ int load_multiboot(void *fw_cfg, >> uint64_t elf_low, elf_high; >> int kernel_size; >> fclose(f); >> + >> + if (((struct elf64_hdr*)header)->e_machine =3D=3D EM_X86_64) = { >> + fprintf(stderr, "Cannot load x86-64 image, give a 32bit = one.\n"); >> + exit(1); >> + } >> + >> kernel_size =3D load_elf(kernel_filename, NULL, = NULL,&elf_entry, >> &elf_low,&elf_high, 0, ELF_MACHINE, = 0); >> if (kernel_size< 0) { >=20 > We rely on the existing behaviour in kvm-unit-tests.git. Tests (.flat = files) are 64-bit elf binaries that are loaded in 32-bit more and switch = immediately to 64-bit. >=20 > We can easily wrap them in a 32-bit elf, but that's a needless = complication. Well, but if they wouldn't work in grub that doesn't help too much, = right? I'm in full sympathy to stick to whatever grub does, as that's = the reference implementation. Alex