From nobody Sat May 4 00:00:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=us.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1577477355; cv=none; d=zohomail.com; s=zohoarc; b=P1Kr2SdMjUodPgSt5XYdGQK+7WieX0Id3mmn+oAUtBj68CtfBfw6kvtuIJrq/lTTaR/ykGlnGDfmnPpXhiYRL1tlFfRbSnHuHg+NTqXxoCJC5Fc1fua2/xxcDiA7zyZRCt+xMp9ARdoUgKIVeilQ6nx59M4+cvFDNLX0gaZ8evw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577477355; h=Content-Type:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=PfgscUSRejTjzLo8rQ3EYkDW+266fjSKs1CKdvUJ37g=; b=L/byWl6kwRjjYZXZIYiW7WWOEXgbknS8oTzxdwWmsS6oKYj5NH7LGjkjI2Ga7kZAt9+f7Hao1G/4z2N2Ngu2ES3FuH75nsp9cMlmlD7kCK+QitLWSmEQlnkqAkgkQdxFXh7S+qtPYCjmaLPVOhmM7CFcpHx4oRq1914qZYOrGY4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1577477355885829.7556326610486; Fri, 27 Dec 2019 12:09:15 -0800 (PST) Received: from localhost ([::1]:38362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikvv8-0002lD-8E for importer@patchew.org; Fri, 27 Dec 2019 15:09:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikvuB-0002FC-JW for qemu-devel@nongnu.org; Fri, 27 Dec 2019 15:08:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ikvuA-00085k-BY for qemu-devel@nongnu.org; Fri, 27 Dec 2019 15:08:15 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:23068) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ikvu5-0007vV-Vj; Fri, 27 Dec 2019 15:08:10 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBRK2Q5F052301; Fri, 27 Dec 2019 15:08:08 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 2x5jh20mhv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Dec 2019 15:08:08 -0500 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id xBRK87ar088645; Fri, 27 Dec 2019 15:08:07 -0500 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0a-001b2d01.pphosted.com with ESMTP id 2x5jh20mhg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Dec 2019 15:08:07 -0500 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id xBRK0VO0003079; Fri, 27 Dec 2019 20:08:07 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma02dal.us.ibm.com with ESMTP id 2x1b180d6h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Dec 2019 20:08:06 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xBRK869d16253718 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 27 Dec 2019 20:08:06 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18E0B124052; Fri, 27 Dec 2019 20:08:06 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F135C12405B; Fri, 27 Dec 2019 20:08:05 +0000 (GMT) Received: from mail.gmx.ibm.com (unknown [9.209.242.114]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTPS; Fri, 27 Dec 2019 20:08:05 +0000 (GMT) Received: from m01ex005.gmx.ibm.com (10.148.53.45) by m01ex002.gmx.ibm.com (10.148.53.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Fri, 27 Dec 2019 15:07:53 -0500 Received: from m01ex005.gmx.ibm.com ([fe80::7d2d:476:2d5a:cb2f]) by m01ex005.gmx.ibm.com ([fe80::7d2d:476:2d5a:cb2f%9]) with mapi id 15.01.1779.002; Fri, 27 Dec 2019 14:07:53 -0600 From: "Marek Dolata - mkdolata@us.ibm.com" To: "qemu-devel@nongnu.org" Subject: [PATCH] target/i386: Fix handling of k_gs_base register in 32-bit mode in gdbstub Thread-Topic: [PATCH] target/i386: Fix handling of k_gs_base register in 32-bit mode in gdbstub Thread-Index: AdW88H6nBhaHncE3T2iSXPzbb8O+qQ== Date: Fri, 27 Dec 2019 20:07:53 +0000 Message-ID: <62c3c3385b014ce1a6ca07f88973bf95@us.ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [9.16.14.33] Content-Type: multipart/alternative; boundary="_000_62c3c3385b014ce1a6ca07f88973bf95usibmcom_" MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-27_07:2019-12-24,2019-12-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 clxscore=1011 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912270167 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "qemu-trivial@nongnu.org" , Doug Gale , Markus Armbruster , Paolo Bonzini , =?iso-8859-1?Q?Philippe_Mathieu-Daud=E9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" --_000_62c3c3385b014ce1a6ca07f88973bf95usibmcom_ Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fixes: corrects clobbering of registers appearing after k_gs_base Buglink: https://bugs.launchpad.net/qemu/+bug/1857640 Signed-off-by: Marek Dolata > --- target/i386/gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c index aef25b70f1..572ead641c 100644 --- a/target/i386/gdbstub.c +++ b/target/i386/gdbstub.c @@ -350,15 +350,15 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t = *mem_buf, int n) env->segs[R_GS].base =3D ldl_p(mem_buf); return 4; -#ifdef TARGET_X86_64 case IDX_SEG_REGS + 8: +#ifdef TARGET_X86_64 if (env->hflags & HF_CS64_MASK) { env->kernelgsbase =3D ldq_p(mem_buf); return 8; } env->kernelgsbase =3D ldl_p(mem_buf); - return 4; #endif + return 4; case IDX_FP_REGS + 8: cpu_set_fpuc(env, ldl_p(mem_buf)); -- 2.24.1 --_000_62c3c3385b014ce1a6ca07f88973bf95usibmcom_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Fixes: corrects clobbering of registers appearing after k_= gs_base

Buglink: https://bugs.l= aunchpad.net/qemu/+bug/1857640

 

= Signed-off-by: Marek Dolata <mkdo= lata@us.ibm.com>

---

target/i386/gdbstub.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

 

diff --git a/target/i386/gdbstub.c b/target/i386/gdbstub.c=

index aef25b70f1..572ead641c 100644

--- a/target/i386/gdbstub.c

+++ b/target/i386/gdbstub.c<= /p>

@@ -350,15 +350,15 @@ int x86_cpu_gdb_write_register(C= PUState *cs, uint8_t *mem_buf, int n)

         &nbs= p;   env->segs[R_GS].base =3D ldl_p(mem_buf);

         &nbs= p;   return 4;

-#ifdef TARGET_X86_64

         case IDX_= SEG_REGS + 8:

+#ifdef TARGET_X86_64

         &nbs= p;   if (env->hflags & HF_CS64_MASK) {

         &nbs= p;       env->kernelgsbase =3D ldq_p(mem_b= uf);

         &nbs= p;       return 8;

         &nbs= p;   }

         &nbs= p;   env->kernelgsbase =3D ldl_p(mem_buf);

-         &nb= sp;  return 4;

#endif

+         = ;   return 4;

         case= IDX_FP_REGS + 8:

         &nbs= p;   cpu_set_fpuc(env, ldl_p(mem_buf));

--

2.24.1

 

--_000_62c3c3385b014ce1a6ca07f88973bf95usibmcom_--