Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp758991rdh; Thu, 26 Oct 2023 15:14:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEf6+3cxOqff5uUf4crYm0uNGSEKB7yGJ++7XKMfC0b3cbeZo0Fby9mavlFPqF5xpA8p48y X-Received: by 2002:a9d:6294:0:b0:6c4:a65c:f7bb with SMTP id x20-20020a9d6294000000b006c4a65cf7bbmr787477otk.33.1698358449164; Thu, 26 Oct 2023 15:14:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698358449; cv=none; d=google.com; s=arc-20160816; b=0MS7uIvA5IyZxHUpYg67nFoJCF1W7jxmrVEv1vtN25p/tULvE+dNzDuzm5FgfPgQe3 PNsRtuB9n7q61oGSeELDw1QNRbuiPy60uRDXNCAEJ1Af1/yrFt7m1PXOESb40+VSAwth +i9R3YdlfmxTQZbUUHUg2vdzYWnR5l6BLkFZ5a6OaoT5teCi0uqGJzroB7CRz6TCtHbE bkFllJE5OE/rTemUDb2Kia+TBWj5vkHG9IpNbiBA3EyTJZq+zUK9F4ugIlmhqJEhimBx nG9rOkqNRkSFdVFqevAZXdxKkadC9D1OXAheV+Gfsw5zzvGJ20WwECEV6p/snOZr0ow+ AsFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ie1LDYI5mHaOAVp7+j7iOfQDnhp8WI+dbIMd+pzktOM=; fh=Af9ZdUGt9LRtAE058DQG0StbKo8OAn34TJ6El0L09II=; b=MiJXwBvmsuk27Z/NMMGZ2qb4Gx8ffGsQALl2tc9TCAL+YqOxCTBv7Q7lOG/OGcAMUT 9dVBHxiK/0syWBcr79OekDoM75Epb6bwLRl5ABQtYPOrseZKC8tBBqWf5xoSgONDCojX 0fMLNxo+giEtNwVCiPx4mpMdn1y10eke8XPx+2+xJS0iKYFDzjOYfpnwjVhmAlSDWDkS wVGZhAvUSL6qo/a9CLwVwZRtbNguQhj9B6CWyV2KTOYyzHebQxC8WUkknZOrow5Bq4vg b4ZxObrDe4Mqta72SH/lC2hvIJlCX2RSh4TCae2YDUorV+y776L5IoSuuHhva1FNzpKl lYLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P+gJlMSK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y189-20020a0dd6c6000000b005a7d82629c1si457704ywd.69.2023.10.26.15.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 15:14:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P+gJlMSK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 94D65826CB65; Thu, 26 Oct 2023 15:14:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344897AbjJZWNv (ORCPT + 99 others); Thu, 26 Oct 2023 18:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230089AbjJZWNu (ORCPT ); Thu, 26 Oct 2023 18:13:50 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AA56CC; Thu, 26 Oct 2023 15:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698358428; x=1729894428; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=Yv1JvOjvS0kO4GNtpkTbKPp6UyvAbJPJrBhkuPrjpvY=; b=P+gJlMSKpFnNpByPvMnyORaxfZscw5aLclEP+jTcqGezqGAiMObtpXIr 5F12MYPsiK69TKWtFmyohg0BdwOBbjFnvculprCdnGNtWGzWUh3z+aHVx MEO1rL/zDg5pDFkwSvwJYvJGifO+1x83N2or6qrRZJMsZRxds83+oTQeJ hwq4SWVmsqxJRTH0Wx96LStDt7czL/tz6V1GPazQlig/BMwW56U1CYYSy v7tBJ3p4YOKCZVjhF3UAWxI3XTkM/7I5J61JJLMihA89hnsIwguKKLhl7 6BegVyvuruzMRaJk6Pg7myPh0KQGuzJLFZgfEBzkSIAHkh98EZuqAjMQE g==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="372710660" X-IronPort-AV: E=Sophos;i="6.03,254,1694761200"; d="scan'208";a="372710660" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 15:13:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="876120212" X-IronPort-AV: E=Sophos;i="6.03,254,1694761200"; d="scan'208";a="876120212" Received: from paseron-mobl4.amr.corp.intel.com (HELO desk) ([10.209.17.113]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 15:13:13 -0700 Date: Thu, 26 Oct 2023 15:13:11 -0700 From: Pawan Gupta To: Dave Hansen Cc: Nikolay Borisov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Andy Lutomirski , Jonathan Corbet , Sean Christopherson , Paolo Bonzini , tony.luck@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, Alyssa Milburn , Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com Subject: Re: [PATCH v3 2/6] x86/entry_64: Add VERW just before userspace transition Message-ID: <20231026221311.5dqmnmvq4pnpqswn@desk> References: <20231025-delay-verw-v3-0-52663677ee35@linux.intel.com> <20231025-delay-verw-v3-2-52663677ee35@linux.intel.com> <2cda7e85-aa75-4257-864d-0092b3339e0e@suse.com> <20231026192950.ylzc66f3f5naqvjv@desk> <20231026211508.tmd7hfniesiu53ps@desk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231026211508.tmd7hfniesiu53ps@desk> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 26 Oct 2023 15:14:06 -0700 (PDT) On Thu, Oct 26, 2023 at 02:15:11PM -0700, Pawan Gupta wrote: > On Thu, Oct 26, 2023 at 12:40:49PM -0700, Dave Hansen wrote: > > On 10/26/23 12:29, Pawan Gupta wrote: > > > On Thu, Oct 26, 2023 at 07:25:27PM +0300, Nikolay Borisov wrote: > > >> On 25.10.23 г. 23:52 ч., Pawan Gupta wrote: > > >>> @@ -1520,6 +1530,7 @@ SYM_CODE_START(ignore_sysret) > > >>> UNWIND_HINT_END_OF_STACK > > >>> ENDBR > > >>> mov $-ENOSYS, %eax > > >>> + CLEAR_CPU_BUFFERS > > >> nit: Just out of curiosity is it really needed in this case or it's doesn > > >> for the sake of uniformity so that all ring3 transitions are indeed > > >> covered?? > > > Interrupts returning to kernel don't clear the CPU buffers. I believe > > > interrupts will be enabled here, and getting an interrupt here could > > > leak the data that interrupt touched. > > > > Specifically NMIs, right? > > Yes, and VERW can omitted for the same reason as NMI returning to > kernel. Thinking more on this, we should not omit verw here, as this spot is way easier to target NMIs. A user executing SYSENTER in a loop has much higher chances of causing an NMI to return to kernel, and skip verw.