Received: from [140.186.70.92] (port=48184 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmWdH-0001w9-Q8 for qemu-devel@nongnu.org; Fri, 20 Aug 2010 14:48:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmWdC-0000nt-9y for qemu-devel@nongnu.org; Fri, 20 Aug 2010 14:48:03 -0400 Received: from mx.exactcode.de ([85.10.202.90]:47263) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmWdB-0000n4-Rb for qemu-devel@nongnu.org; Fri, 20 Aug 2010 14:47:58 -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=iso-8859-1 From: Rene Rebe In-Reply-To: <20100819124955.GK22245@os.inf.tu-dresden.de> Date: Fri, 20 Aug 2010 20:47:47 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <631E0EEA-D08B-4CB7-B73D-EF421748B3C1@exactcode.de> References: <20100819112414.GH22245@os.inf.tu-dresden.de> <20100819113635.GI22245@os.inf.tu-dresden.de> <472C9D6F-E1EB-4BE4-8BE9-35D99CC5CB45@suse.de> <20100819123258.GJ22245@os.inf.tu-dresden.de> <20100819124955.GK22245@os.inf.tu-dresden.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Adam Lackorzynski Cc: Alexander Graf , qemu-devel@nongnu.org Hi, On Aug 19, 2010, at 2:49 PM, Adam Lackorzynski wrote: >=20 > On Thu Aug 19, 2010 at 14:34:10 +0200, Alexander Graf wrote: >>=20 >> On 19.08.2010, at 14:32, Adam Lackorzynski wrote: >>=20 >>>=20 >>> On Thu Aug 19, 2010 at 13:40:54 +0200, Alexander Graf wrote: >>>>=20 >>>> On 19.08.2010, at 13:36, Adam Lackorzynski wrote: >>>>=20 >>>>>=20 >>>>> On Thu Aug 19, 2010 at 13:27:32 +0200, Alexander Graf wrote: >>>>>>=20 >>>>>> On 19.08.2010, at 13:24, Adam Lackorzynski wrote: >>>>>>=20 >>>>>>> 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 >>>>>> According to the multiboot spec, this is the expected behavior, = no? At least Xen does it that way... >>>>>=20 >>>>> 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. >>>>=20 >>>> Hrm - maybe you're right: >>>>=20 >>>> busu:~ # readelf -a /boot/xen >>>> ELF Header: >>>> Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00=20 >>>> Class: ELF32 >>>>=20 >>>> What does the spec say here? What does grub do? >>>=20 >>> 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 >>> ..."); >>=20 >> 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. >=20 > grub1: >=20 > grub> kernel (nd)/tftpboot/adam/bootstrap.elf = =20 >=20 > Error 13: Invalid or unsupported executable format >=20 > grub> >=20 >=20 > grub2 loads it but then it crashes and reboots. Looks like a bug to = me. I once added some x86_64 patch to our grub at T2. I forgot for what, L4, = Luvally? At that time it worked, ... http://svn.exactcode.de/t2/trunk/package/x86/grub/grub-0.97-x86_64.patch Ren=E9 --=20 Ren=E9 Rebe, ExactCODE GmbH, Jaegerstr. 67, DE-10117 Berlin http://exactcode.com | http://t2-project.org | http://rene.rebe.de