Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D344C7618D for ; Thu, 6 Apr 2023 15:34:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.518929.805948 (Exim 4.92) (envelope-from ) id 1pkRcQ-0001dL-0P; Thu, 06 Apr 2023 15:33:46 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 518929.805948; Thu, 06 Apr 2023 15:33:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pkRcP-0001dE-TY; Thu, 06 Apr 2023 15:33:45 +0000 Received: by outflank-mailman (input) for mailman id 518929; Thu, 06 Apr 2023 15:33:44 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pkRcN-0001d8-TA for xen-devel@lists.xenproject.org; Thu, 06 Apr 2023 15:33:44 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 67a483bb-d490-11ed-85db-49a42c6b2330; Thu, 06 Apr 2023 17:33:42 +0200 (CEST) Received: from mail-dm6nam12lp2172.outbound.protection.outlook.com (HELO NAM12-DM6-obe.outbound.protection.outlook.com) ([104.47.59.172]) by ob1.hc3370-68.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Apr 2023 11:33:38 -0400 Received: from BYAPR03MB3623.namprd03.prod.outlook.com (2603:10b6:a02:aa::12) by SN4PR03MB6768.namprd03.prod.outlook.com (2603:10b6:806:214::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.31; Thu, 6 Apr 2023 15:33:36 +0000 Received: from BYAPR03MB3623.namprd03.prod.outlook.com ([fe80::a5a1:8cae:d45b:2030]) by BYAPR03MB3623.namprd03.prod.outlook.com ([fe80::a5a1:8cae:d45b:2030%3]) with mapi id 15.20.6254.035; Thu, 6 Apr 2023 15:33:36 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 67a483bb-d490-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1680795221; h=message-id:date:from:subject:to:cc:references: in-reply-to:content-transfer-encoding:mime-version; bh=BAvJtl8D8wnOaRJr6oR7rTwaR89LKmeaTPG9kn5YroU=; b=PJMFBwaEyvX5mQy4QiEWUZcp0gNbLZo4NfbXl1vJe3eSBaGhFNgK5pEH 5sglr00sqSCci+0AO0UYtlKLThwwviN2GRszLdOv6+GVsEV2aoac9s1Vo uj0ZDYtJ2H6b7jyTl5hZvtPLGsJZRgNeqUAc0lB7Jb6tzvnCaax8xV41e Q=; X-IronPort-RemoteIP: 104.47.59.172 X-IronPort-MID: 104498459 X-IronPort-Reputation: None X-IronPort-Listener: OutboundMail X-IronPort-SenderGroup: RELAY_O365 X-IronPort-MailFlowPolicy: $RELAYED IronPort-Data: A9a23:sDCqw6OL+tNknYnvrR2IlsFynXyQoLVcMsEvi/4bfWQNrUp00DQBn WEaDWuHa67bZDfyf493a9+yo00DsZHXn9AySwto+SlhQUwRpJueD7x1DKtS0wC6dZSfER09v 63yTvGacajYm1eF/k/F3oDJ9CU6jufQAOKnUoYoAwgpLSd8UiAtlBl/rOAwh49skLCRDhiE/ Nj/uKUzAnf8s9JPGj9SuvLrRC9H5qyo42tE5gJmP5ingXeF/5UrJMNHTU2OByOQrrl8RoaSW +vFxbelyWLVlz9F5gSNy+uTnuUiG9Y+DCDW4pZkc/HKbitq/0Te5p0TJvsEAXq7vh3S9zxHJ HehgrTrIeshFvWkdO3wyHC0GQkmVUFN0OevzXRSLaV/ZqAJGpfh66wGMa04AWEX0thsHWFi+ 6EeFG4yfhODuumzypS6Y9A506zPLOGzVG8ekldJ6GiDSNoDH9XESaiM4sJE1jAtgMwIBezZe 8cSdTtoalLHfgFLPVAUTpk5mY9EhFGmK2Ee9A3T+PtxujeJpOBy+OGF3N79U9qGX8hK2G2fo XrL5T/RCRAGLt2PjzGC9xpAg8eWxX+nCdJOSezQGvhCkG2z/E0xWQAqCniF/+KTzXybXfxNA hlBksYphe1onKCxdfH/VRClpH+PvjYHRsFdVeY97Wml2qfSpgqUGGUAZjpAc8A98t87QyQw0 V2ElM+vAiZg2JWKTVqN+7HSqim9URX5NkcHbC4ACAcAvd/qpdhpigqVF4k5VqmoktfyBDf8h SiQqzQzjKkSishN0Lin+VfAgHSnoZ2hohMJ2zg7l1mNtmtRDLNJraTzgbQHxZ6s9Lqkc2Q= IronPort-HdrOrdr: A9a23:ht85cKvHnzKYUtHPS3ka1WSK7skDp9V00zEX/kB9WHVpmwKj5q KTddAgpGfJYVcqKQgdcLW7VpVoLkm8yXcY2+ks1PKZLXLbUSiTXf5fBOjZslvd8k/Fh4pgPP xbAtRD4bTLZDAQ56uXjzVQUexQp+Vvm5rY4Ns2oU0dLj1CWuVF5wd9CgGUVmh3XhQuP+tGKH OF3Ls7m9O/QwVsUviG X-IronPort-AV: E=Sophos;i="5.98,323,1673931600"; d="scan'208";a="104498459" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jk8sq1R7IOBpxOMsa3cjL6R/waHwiG51bfOF9HEPca/tYEC3+v+iJ9eO30QrD4TKsJXyTg1QbbkEPM7fukg7PELHCdjT/b03WRc14EjQr2Hnm36rnYnMiImrM1wBA8jjJbYRRVGPZeSHiZv1hpoUqd7LsMtLGZv6IKO8ixyGwGuUmp8FXorWMxsgJZXt6eqAHS8KJFNDKNRUh+qgd+kEJpNF+Vdj6poMSq0Ix5sX/3ANGovVUKNzgN0kiVLpayz/McJpa75ThIa0MGj1dzZz66mbmhtsv0AiQepYZa1xmgxCXL6mbL4Bx7IJ+9PZFivDeDRg8KjqQ1vX5MM/iJ72GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/Mfne7y8aweDKenSHNw4RzZCfFt4bGVZDOLeZa41Gvw=; b=ayOto2LOQc9204BfQIkSK2zCUlBls4PThcFA78KAFVgkDl9fFBWpw0E8cJDDsaG6lZ/9GviOhsx6cmdc6qsEx4/iDqc/6qpPWxhRQcoyXw7l309sYvV81wHGUPemy5fQx+3J60txSPSdY4vOvTKMLdKWoptD7+zwXcsG3C2WF5Wo4PwPUvrij5vZdz+gx2x3tAdgDArs1ZFH/ux7kXRHgKzfv/61d1ccaBco/tEGnO3hyrHKP9LeJGnEq/wvMDnkG1t6YffX8pXp0JKWKzkCZzI0jq+U2cBBe1q3JX/Ws9Sz+p2imq8RIf9uu+pWAkfE+il+40wmUzFMTTNNAkxfJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/Mfne7y8aweDKenSHNw4RzZCfFt4bGVZDOLeZa41Gvw=; b=IF3PTjbZGh3nO875qGvIrxSKDJn/XMA9iT9r7rP6yzwogIwJuaSNKXn6GtjjUlHfZu1U8eAESeG+KuJICSgK31UQLXm/6epqF6JdXdSb18wDWzbciUBenm8+13O4UD7sxQf+Ymhg/+BfPPW/Fkquw2PAXrWyJr0p7NCNBhVUKrU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com; Message-ID: <4fc4f5a9-0b9e-bb30-df32-09b5e9e63a57@citrix.com> Date: Thu, 6 Apr 2023 16:33:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 From: Andrew Cooper Subject: Re: [PATCH] x86emul: avoid triggering event related assertions Content-Language: en-GB To: Jan Beulich , "xen-devel@lists.xenproject.org" Cc: Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0164.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:312::13) To BYAPR03MB3623.namprd03.prod.outlook.com (2603:10b6:a02:aa::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR03MB3623:EE_|SN4PR03MB6768:EE_ X-MS-Office365-Filtering-Correlation-Id: 716c6c66-42bb-4f2f-8be2-08db36b449b5 X-LD-Processed: 335836de-42ef-43a2-b145-348c2ee9ca5b,ExtAddr,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yufdyamwhPkGxL3mdxhoHtTluSuBBDvb4Ka+JJ8jDg9E7A5bniQDrwG7ABF2TP0Z8tFknJXGq2CxH/4Gw1dmIe1dZqY8zvj1F5xi7KAmFfYnku+cFUZ/zbSUVxTqNu4qkcKIiRLPMFxSN2V3tyGau849g/y9PikwYGXyGmNcMOJlJomnAtjQPT7KjzmIaoMyBf7dnNgS9hTHtWTt1RgfXiq+AUpb5nXgeUOjPDoocHq9TOkfjlT0klY1CPIcS1T0Z6TKZXqiX6a/u+WDdX371DL4dZMdAveXqmhRpaGLpuo1tt5Lo+xvAvNor4C4zt2kikZ44qHcSVavw96Q7jSqyscepWMoHXECZLcbjbv3EdAullW1TQMBcvLxPSRWeKYWnkbUC++qQz2upKhUNR79KzsznyHAZqq2v7Natf0auhZl3SF9/WUW0HYmkoypUXfp2ECD2f/SEAbqZ82EJ4eq/DwlPrLPndXt7a3L1UFzZlq9eFfiX//ntZvkjjRDQdcmY8iHtciMUtHX50zrvlPkkSJ5QkNlhrqtrVWaxhgfBqHELr3xkUElsO1G3dFkw7V3T00f5OlG0OvQn39QHnWch7c9Ug2nerNoSUCmxQJ+9N0eMz/dAdVrgH8xCURxrIS/dOGvGE4CYR2k7AkMgHDWwg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR03MB3623.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(366004)(39860400002)(376002)(451199021)(86362001)(31696002)(36756003)(316002)(110136005)(66946007)(41300700001)(4326008)(66476007)(6486002)(6666004)(478600001)(66556008)(54906003)(8676002)(8936002)(2906002)(5660300002)(82960400001)(38100700002)(186003)(53546011)(6506007)(26005)(107886003)(2616005)(6512007)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N1dyK0U0cWo1Qmkra1ZoSUFKSnZYL1U3UExFblpncmk4ako0bUZLNmdHNWwv?= =?utf-8?B?ZnMzUE95b213cFpGV1QvT0prSS9CN2xYNUpwTEQzZjcyK2NqdjB6QzdtNjU1?= =?utf-8?B?dzJ2M1IvRzhxSHh2YlNOU3YwWC8wSk83bk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zNELJDwo/NPCM1KmxHGlYWMR2oMR067BiWhlx6N3REKKNUjQ8rXYp697BxqJFJl5W7IECy1P0pgOGUp31WZCwzX7iB0CsgJf9YQGi4VYu3lGUhMkxzGwkgZQ5AKIeqBl1ZsMQ89JkLYZ9 X-OriginatorOrg: citrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 716c6c66-42bb-4f2f-8be2-08db36b449b5 X-MS-Exchange-CrossTenant-AuthSource: BYAPR03MB3623.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2023 15:33:36.4315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mPaaEM+aXghqzfcT+fXTdwN++BFvDbj0JB5xk+JfTynfAvkAkvktnxMB22Jii8e7qo9JWDhhoHsq4ge+6XmlsAKiej63FJjt98S2iyLJXz4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN4PR03MB6768 On 06/04/2023 3:15 pm, Jan Beulich wrote: > The assertion at the end of x86_emulate_wrapper() as well as the ones > in x86_emul_{hw_exception,pagefault}() can trigger if we ignore > X86EMUL_EXCEPTION coming back from certain hook functions. Looking at the comment I wrote back then, I don't think I'd considered this case. What I was fixing at the time was the case where hvm_inject_hw_exception() had raised an exception behind the back of the emulator, and any subsequent exception escalates to #DF. I guess the comment wants updating to discuss this problem too, where the hook queued an exception but we didn't squash it properly when deciding to ignore it. As it's debugging-only anyway, it might be worth rearranging the expression to be if ( ctxt->event_pending )     ASSERT(rc == X86EMUL_EXCEPTION); else     ASSERT(rc != X86EMUL_EXCEPTION); because it distinguishes the two cases without an intermediate round of debugging. > Squash > exceptions when merely probing MSRs, plus on SWAPGS'es "best effort" > error handling path. > > In adjust_bnd() add another assertion after the read_xcr(0, ...) > invocation, paralleling the one in x86emul_get_fpu() - XCR0 reads should > never fault when XSAVE is (implicitly) known to be available. > > Fixes: 14a6be89ec04 ("x86emul: correct EFLAGS.TF handling") > Fixes: cb2626c75813 ("x86emul: conditionally clear BNDn for branches") > Fixes: 6eb43fcf8a0b ("x86emul: support SWAPGS") > Reported-by: AFL > Signed-off-by: Jan Beulich > --- > EFER reads won't fault in any of the handlers we have, so in principle > the respective check could be omitted (and hence has no Fixes: tag). > Thoughts? We already require LMA as input state, and don't have an execution model where EFER is actually absent in the first place, so passing the whole thing wouldn't really be an issue. I have previously considered doing the same for CR0 too, but at best it's marginal so I haven't got around to trying it. > --- a/xen/arch/x86/x86_emulate/0fae.c > +++ b/xen/arch/x86/x86_emulate/0fae.c > @@ -67,7 +67,10 @@ int x86emul_0fae(struct x86_emulate_stat > cr4 = X86_CR4_OSFXSR; > if ( !ops->read_msr || > ops->read_msr(MSR_EFER, &msr_val, ctxt) != X86EMUL_OKAY ) > + { > + x86_emul_reset_event(ctxt); This is the only path you've introduced that doesn't restrict the reset to the X86EMUL_EXCEPTION case. In principle you can get things like RETRY for introspection.  Internally, UNHANDLEABLE is used but I hope that never escapes from guest_{rd,wr}msr(). ~Andrew