Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HVpg9-0001b4-RN for qemu-devel@nongnu.org; Mon, 26 Mar 2007 09:56:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HVpg7-0001Su-Ud for qemu-devel@nongnu.org; Mon, 26 Mar 2007 09:56:09 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HVpg7-0001SZ-Pm for qemu-devel@nongnu.org; Mon, 26 Mar 2007 08:56:07 -0500 Received: from os.inf.tu-dresden.de ([141.76.48.99]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HVpdr-0005dM-St for qemu-devel@nongnu.org; Mon, 26 Mar 2007 09:53:48 -0400 Received: from silo.inf.tu-dresden.de ([141.76.48.100]) by os.inf.tu-dresden.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.66) id 1HVpdo-0003WP-V4 for qemu-devel@nongnu.org; Mon, 26 Mar 2007 15:53:44 +0200 Received: from kauer by silo.inf.tu-dresden.de with local (Exim 4.50) id 1HVpdo-00027x-LG for qemu-devel@nongnu.org; Mon, 26 Mar 2007 15:53:44 +0200 Date: Mon, 26 Mar 2007 15:53:44 +0200 Message-ID: <20070326135344.GA32622@silo.inf.tu-dresden.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6c2NcOVqGQ03X4Wi" Content-Disposition: inline From: Bernhard Kauer Subject: [Qemu-devel] Patch: ltr for x86_64 should check the upper descriptor type Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The Intel manual states for LTR and 64-Bit Exceptions: #GP(selector) If the descriptor type of the upper 8-byte of the 16-byte descriptor is non-zero. Qemu currently does not check this. The attached patch fixes the bug. Bernhard Kauer --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="qemu_ltr.diff" --- helper.c.orig 2007-03-26 15:39:11.000000000 +0200 +++ helper.c 2007-03-26 15:40:27.000000000 +0200 @@ -1825,8 +1825,11 @@ raise_exception_err(EXCP0B_NOSEG, selector & 0xfffc); #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { - uint32_t e3; + uint32_t e3, e4; e3 = ldl_kernel(ptr + 8); + e4 = ldl_kernel(ptr + 12); + if ((e4 >> DESC_TYPE_SHIFT) & 0xf) + raise_exception_err(EXCP0D_GPF, selector & 0xfffc); load_seg_cache_raw_dt(&env->tr, e1, e2); env->tr.base |= (target_ulong)e3 << 32; } else --6c2NcOVqGQ03X4Wi--