Received: from eggs.gnu.org ([2001:4830:134:3::10]:51497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9Iu2-0000h5-Ig for qemu-devel@nongnu.org; Tue, 13 Aug 2013 14:01:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V9Itw-0004LM-Ij for qemu-devel@nongnu.org; Tue, 13 Aug 2013 14:01:06 -0400 Received: from indium.canonical.com ([91.189.90.7]:36812) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V9Itw-0004LA-Da for qemu-devel@nongnu.org; Tue, 13 Aug 2013 14:01:00 -0400 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1V9Itv-0006pt-Gd for ; Tue, 13 Aug 2013 18:00:59 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 5F6F12E808D for ; Tue, 13 Aug 2013 18:00:59 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 13 Aug 2013 17:52:22 -0000 From: Nils Asmussen <1211910@bugs.launchpad.net> Sender: bounces@canonical.com References: <20130813175222.16219.80463.malonedeb@gac.canonical.com> Message-Id: <20130813175222.16219.80463.malonedeb@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1211910] [NEW] Logical to linear address translation is wrong for 32-bit guests on a 64-bit hypervisor Reply-To: Bug 1211910 <1211910@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Public bug reported: I run a 64-bit hypervisor in qemu-system-x86_64 (without KVM) and on top of= that I have a 32-bit guest. The guest configures the code-segment to have = a base of 0x4000_0000 and a limit of 0xFFFF_FFFF with paging disabled. Thus= , if a logical address of e.g. 0xC000_0000 is used, it should be translated= to 0x0000_0000 (linear and physical), because of the overflow that happens. But this does not happen with the described setup. Instead, qemu seems to c= alculate the logical to linear translation with 64-bit addresses so that no= overflow happens. Consequently, the resulting address is 0x1_0000_0000 and= this gets written to exitinfo2 in the VMCB structure. This causes trouble = for hypervisors that expect the upper 32 bits of exitinfo2 to be 0 for 32-b= it guests. Note also that the exact same setup runs fine on real AMD machines with SVM. That is, the upper 32 bits in exitinfo2 are always 0 because of the overflow. I've tested that with the latest development version of QEMU (commit 328465fd9f3a628ab320b5959d68d3d49df58fa6). ** Affects: qemu Importance: Undecided Status: New -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1211910 Title: Logical to linear address translation is wrong for 32-bit guests on a 64-bit hypervisor Status in QEMU: New Bug description: I run a 64-bit hypervisor in qemu-system-x86_64 (without KVM) and on top = of that I have a 32-bit guest. The guest configures the code-segment to hav= e a base of 0x4000_0000 and a limit of 0xFFFF_FFFF with paging disabled. Th= us, if a logical address of e.g. 0xC000_0000 is used, it should be translat= ed to 0x0000_0000 (linear and physical), because of the overflow that happe= ns. But this does not happen with the described setup. Instead, qemu seems to= calculate the logical to linear translation with 64-bit addresses so that = no overflow happens. Consequently, the resulting address is 0x1_0000_0000 a= nd this gets written to exitinfo2 in the VMCB structure. This causes troubl= e for hypervisors that expect the upper 32 bits of exitinfo2 to be 0 for 32= -bit guests. Note also that the exact same setup runs fine on real AMD machines with SVM. That is, the upper 32 bits in exitinfo2 are always 0 because of the overflow. I've tested that with the latest development version of QEMU (commit 328465fd9f3a628ab320b5959d68d3d49df58fa6). To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1211910/+subscriptions