Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2396888rda; Wed, 25 Oct 2023 01:11:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFM1oviQkk1OTdjhnW9wsgpBiqbCr4OZ6Z3mdCqGlP0pNCbJWdzUbhN56yoOSFZBFKfPO42 X-Received: by 2002:a25:a2c9:0:b0:d9b:87f3:54f9 with SMTP id c9-20020a25a2c9000000b00d9b87f354f9mr13223423ybn.28.1698221495971; Wed, 25 Oct 2023 01:11:35 -0700 (PDT) Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id g137-20020a25db8f000000b00d13fb2858ecsi10203613ybf.428.2023.10.25.01.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 01:11:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g8Jdd9gn; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A81F08083493; Wed, 25 Oct 2023 01:10:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232691AbjJYIKJ (ORCPT + 99 others); Wed, 25 Oct 2023 04:10:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234457AbjJYH6w (ORCPT ); Wed, 25 Oct 2023 03:58:52 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1F55199; Wed, 25 Oct 2023 00:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698220079; x=1729756079; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=etvudi2QnFqDTA790I0Zqp8Si70Hab5eBkf2va63euU=; b=g8Jdd9gnmcSBEdvzXLMi4QGm+x8f6iJzh5jrWmS2gWU5puomb/zu+vyN GZVVpOBsOJEwvNcAwjRGtSi9FnatB4eF5V29wfE6dTseT2i44G38ouYy/ bM8AJVkUOOjDmKaryTySNExbuIGfJuNEfWty0p6h+PeQ4xkvvVQaU/HAS D1du25rOB2PopuOuGUUbf/NkEm23ovSxYG/f/I2MYV9Etqw5dnASVWo9i wuzATVhXKxikQWHcpWoJoah6s+aKwGKAGWrcTirAmsoIKBs29mi++BTD9 rgjR8/1yfgSqVs+rmOmIrI4XqShUXW8rV8Vl8nx0fzKaW6V55JmsjtHZ9 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="418380015" X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="418380015" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2023 00:47:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,250,1694761200"; d="scan'208";a="17553" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 25 Oct 2023 00:47:20 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 25 Oct 2023 00:47:53 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Wed, 25 Oct 2023 00:47:53 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Wed, 25 Oct 2023 00:47:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V0Bz8IBN2vyg38NAcXBL879YMTATY3USpIToXs58Y1zkrv/x/LaQzapSazyeoUX8xhp6EU3SNbryOdWDcvlgvlvgf2pMZQw0rCXVQYCJPkmcRZfeKqMjLQiSPQxh6wRgbke7Vzpds6tLcEa54RXxY2tCEmkbM+mR9dwuhzEEtCchJrO7Rn8kvJrSnPgoVI44AGq1ZVQwGhwJ8m9Tk6FM4pp80sXQtTPjPJ8vGhhg/PhlIrX8MTv3d73x/znwaOq/jVudtgXpK3aAALCNPuqGVvbulHwM8RdsehB3j32y6qIoPjgV4xAZsAfdCkk80dKRnmXzaupo96UtNnp7qVA1PA== 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=sHm8u7v7WYWBUt9r+yyNAy759u607HRrLNBWERXOKAE=; b=kK3vLQIZeOmUzSFQ2y42tEtef+UbysjIsw2dyDAseHYhE+GYs7IxHbO8Rs4yIZWwyN34/ydNtpvqhi6s0SiwN+K7cWGmwnT6rtbk5VBi6gkJ5qBRfV6IvHXcXh7cVpi7g6pnFedkKGIevxl+c2jb1K1zcMo3quhpiOQc4AN/t8ZFhcuhD0bOiWbxXyVsamvJzLNISEyj2+ggThqHIwyGsNs9siuiAFjF6Qi91mOPzg1gs8Ac/hdEUBLiK1tbORKED7YHxtJshcF/e0hCIMB2ESN2NcNg2T40+sWElw3gSuYafRWTRnzB7ITcMIbqJieIhRN/wpBoUZu2r9RSkIugWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH8PR11MB6780.namprd11.prod.outlook.com (2603:10b6:510:1cb::11) by DS0PR11MB7335.namprd11.prod.outlook.com (2603:10b6:8:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.19; Wed, 25 Oct 2023 07:47:49 +0000 Received: from PH8PR11MB6780.namprd11.prod.outlook.com ([fe80::e14c:4fbc:bb3:2728]) by PH8PR11MB6780.namprd11.prod.outlook.com ([fe80::e14c:4fbc:bb3:2728%4]) with mapi id 15.20.6933.019; Wed, 25 Oct 2023 07:47:48 +0000 Date: Wed, 25 Oct 2023 15:47:37 +0800 From: Chao Gao To: Pawan Gupta CC: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Andy Lutomirski , Jonathan Corbet , Sean Christopherson , Paolo Bonzini , , , , , , , Alyssa Milburn , Daniel Sneddon , Subject: Re: [PATCH v2 6/6] KVM: VMX: Move VERW closer to VMentry for MDS mitigation Message-ID: References: <20231024-delay-verw-v2-0-f1881340c807@linux.intel.com> <20231024-delay-verw-v2-6-f1881340c807@linux.intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231024-delay-verw-v2-6-f1881340c807@linux.intel.com> X-ClientProxiedBy: SI1PR02CA0025.apcprd02.prod.outlook.com (2603:1096:4:1f4::13) To PH8PR11MB6780.namprd11.prod.outlook.com (2603:10b6:510:1cb::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR11MB6780:EE_|DS0PR11MB7335:EE_ X-MS-Office365-Filtering-Correlation-Id: 584ec627-4143-408f-31f2-08dbd52eae8c X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yty6LGPrZ4uHfGHAke/ykBPrlPvj46lZZ3iTuHBEFHf6rdgaXYpWFfV41/B7/voNLfiuO3ZSGx8Vfvh7wSo0oHIgoMjpOeVXd4v9S6I+DCcq3/Qpcf1UidNM5G8Vfcs/HcINdMpFxXWpE5+Gzo4DdWwp+TSed4bXR0oHHmVm3bhsW8k6DrHB1r4wif0aETpmXLimzQF04/UYbfFrnDXPr5ROfSF6OiZUf0E8ZjvvRYKRC53+scnGZ9N/gZSGV7cot99mnX0FHj8yk1J2vlY4spdvjLlT/Os+2PB3eGlra3AJNzrkVb4W2JW8kqd5/gVhOj2mwe5ixlvRE+fIKBJY+gMra3UVmxkyGqDVUFGDm56wXiQA4rmudQeBMGENf14o3AbtFSIHyzen5hNDV/rGSZigxkWDbF5l+TQq5EQs6o9ZoAWq6qaNEhhl9N3qNU2vRZoF2i8AlYs4556NnBqqIPpPKgDbkEG3VU+238PDG7b2wEVGC8LGkA74o5VMX6zW027W3nrARMw6DdpMoEaNbC6wtHE3v1acp3kTvEyDfLdWvSAjm/jkkkRRlt3o3VjC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH8PR11MB6780.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7916004)(376002)(346002)(39860400002)(136003)(366004)(396003)(230922051799003)(1800799009)(451199024)(64100799003)(186009)(2906002)(5660300002)(7416002)(41300700001)(44832011)(8936002)(8676002)(4326008)(38100700002)(83380400001)(54906003)(66556008)(316002)(66476007)(6916009)(66946007)(6506007)(9686003)(6512007)(26005)(86362001)(33716001)(6666004)(82960400001)(6486002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lkXeN7cvffV61e763/aYzcMj5wy0eR3cHsVRmZA8ncytKYanOFdNbpJOLogH?= =?us-ascii?Q?9SWlgh5nGr5KC3THTw/QJ3BSOQGTalRJ+JEPasoLj9iKTcy++YBUasWXbG27?= =?us-ascii?Q?IRAT5EbUrpwBljp7go8DXhLrVvm1qy1Iy22YMJBaLsvPV1woJfp/jATJNeZr?= =?us-ascii?Q?dHLjoT6C5a+GgIl/0SmtQ6LqrTjyXnZLqhoA3zzqAX7bCAAstC/N9p8jWpVq?= =?us-ascii?Q?P+QWK/Q9Lk7mOMAi8qpXQ253VhCr/k4aw3dO+RdLT5uOXfytLYsOi+EXxxNX?= =?us-ascii?Q?Lw1N90Sf+qEn61BtuXzZLHimfZIajP/yrRtxbPXOb1JImBphaCj8g5ZLetzM?= =?us-ascii?Q?2jYUwhAxhifUPCvxZ3vKbBMWg06LBxPwAkt3R+A9WAI2lih+oNQwcxwgOyl4?= =?us-ascii?Q?McW8+ja+F0DOQFcsXNa4qZGwO8VPV2W0Cha2STHFiBe58VCnZqk8mIdKk7cM?= =?us-ascii?Q?gyzy67YIFARod5o6fQsCMylnBy2M/bc/eKEBeSWjEP5RTZBeTsQJQDorlRgZ?= =?us-ascii?Q?qw3O1cFrSbniXyzzM10jOyGt5e6kbsyeSa9ZZZuU6AOxcbOD3KZPICEVr6Io?= =?us-ascii?Q?cde4FXjFcOwBz+iaUDVc/tAf8bvaEJc4hV/Bqwanvh0bjwV1jXz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EFHR/Y5vhchN8D40d9VXh6zB+AUFZHxCuIfEydlQjI8+NwF?= =?us-ascii?Q?F1lu1c3kABHbc0jPbnbgrHY8QeyCVxWwiQPQwT7F?= X-MS-Exchange-CrossTenant-Network-Message-Id: 584ec627-4143-408f-31f2-08dbd52eae8c X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB6780.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 07:47:47.8094 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ob6c4c5ZNbah/1jNqCg3Mnyon8NMRIAfHAbHtap2nWBIxBq3sL2RXxTKSRjjQipREutE7P0Wt4Je/sbuJQdy5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB7335 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 25 Oct 2023 01:10:48 -0700 (PDT) On Tue, Oct 24, 2023 at 01:08:53AM -0700, Pawan Gupta wrote: >During VMentry VERW is executed to mitigate MDS. After VERW, any memory >access like register push onto stack may put host data in MDS affected >CPU buffers. A guest can then use MDS to sample host data. > >Although likelihood of secrets surviving in registers at current VERW >callsite is less, but it can't be ruled out. Harden the MDS mitigation >by moving the VERW mitigation late in VMentry path. > >Note that VERW for MMIO Stale Data mitigation is unchanged because of >the complexity of per-guest conditional VERW which is not easy to handle >that late in asm with no GPRs available. If the CPU is also affected by >MDS, VERW is unconditionally executed late in asm regardless of guest >having MMIO access. > >Signed-off-by: Pawan Gupta >--- > arch/x86/kvm/vmx/vmenter.S | 4 ++++ > arch/x86/kvm/vmx/vmx.c | 10 +++++++--- > 2 files changed, 11 insertions(+), 3 deletions(-) > >diff --git a/arch/x86/kvm/vmx/vmenter.S b/arch/x86/kvm/vmx/vmenter.S >index b3b13ec04bac..c566035938cc 100644 >--- a/arch/x86/kvm/vmx/vmenter.S >+++ b/arch/x86/kvm/vmx/vmenter.S >@@ -1,6 +1,7 @@ > /* SPDX-License-Identifier: GPL-2.0 */ > #include > #include >+#include This header is already included a few lines below: #include #include #include <--- > #include > #include > #include