Received: from eggs.gnu.org ([2001:4830:134:3::10]:38166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC6kx-0008P0-HA for qemu-devel@nongnu.org; Wed, 30 Nov 2016 10:25:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cC6ks-0005cJ-RO for qemu-devel@nongnu.org; Wed, 30 Nov 2016 10:25:11 -0500 Received: from indium.canonical.com ([91.189.90.7]:52867) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cC6ks-0005bj-LU for qemu-devel@nongnu.org; Wed, 30 Nov 2016 10:25:06 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.76 #1 (Debian)) id 1cC6kp-0005H9-L0 for ; Wed, 30 Nov 2016 15:25:03 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 7C2352E81EB for ; Wed, 30 Nov 2016 15:24:49 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 30 Nov 2016 15:08:18 -0000 From: Thomas Huth <1163065@bugs.launchpad.net> Reply-To: Bug 1163065 <1163065@bugs.launchpad.net> Sender: bounces@canonical.com References: <20130402002132.20684.26917.malonedeb@wampee.canonical.com> Message-Id: <20161130150818.28962.68614.malone@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 1163065] Re: target-i386 cpu_get_phys_page_debug checks bits in wrong order List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Can you still reproduce this problem with the latest version of QEMU? If so, could you please send a refreshed patch to the qemu-devel mailing list? We do not pick up patches from the bug tracker. Thanks! ** Changed in: qemu Status: New =3D> Incomplete -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1163065 Title: target-i386 cpu_get_phys_page_debug checks bits in wrong order Status in QEMU: Incomplete Bug description: In target-i386 cpu_get_phys_page_debug, the CR4_PAE bit is checked before CR0_PG. This means that if paging is disabled but the PAE bit has been set in CR4, cpu_get_phys_page_debug will return the wrong result (it will try to translate the address as virtual rather than using it as a physical address). Although this might seem like an unusual case, it in fact happens consistently when booting Linux on amd64 (from linux-2.6.32.60/arch/x86/boot/compressed/head_64.S): /* Enable PAE mode */ xorl %eax, %eax orl $(X86_CR4_PAE), %eax movl %eax, %cr4 [... code to set up page tables omitted ...] /* Enter paged protected Mode, activating Long Mode */ movl $(X86_CR0_PG | X86_CR0_PE), %eax /* Enable Paging and Protect= ed mode */ movl %eax, %cr0 The most noticeable effect of this bug is that using the disassembler during this time will fetch the wrong data by trying to read from page tables that aren't there. One symptom is that booting Linux amd64 with -d in_asm will result in several "Disassembler disagrees with translator over instruction decoding" messages. Attached is a patch that moves the CR0_PG check to the beginning. I'm still not 100% certain that the logic of cpu_get_phys_page_debug matches cpu_x86_handle_mmu_fault, but it's a start. To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1163065/+subscriptions