From patchwork Fri Oct 27 14:38:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawan Gupta X-Patchwork-Id: 158969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp652485vqb; Fri, 27 Oct 2023 07:39:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERTVk3V2NO15hSMBpcCpAvbknyk6uVFO8wHcyXO39BShwMcDJfdWhCmv7pyb4f2U43y8DW X-Received: by 2002:a81:ad1d:0:b0:5a8:1a54:ba4b with SMTP id l29-20020a81ad1d000000b005a81a54ba4bmr11388860ywh.13.1698417585161; Fri, 27 Oct 2023 07:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698417585; cv=none; d=google.com; s=arc-20160816; b=Y9Kj2vRFKo1tmzJlfqoPtsRKelQnNTP9DCdsQ3ON6uPE1aDlPb2q/qm+I5ZDefNtMD X/8A7kNKWIK7/l6w3C8xH2GyL+dw5/OW9EWsLq6hy5rJfX0Ku+oqpgDW1+9izRNCSEnl VrWuVhrF5P3/+wLmLdwmXcR0H+q6Ww4A0ai3OA2lFoOLSirDoDvwgHjTtEJOei27TV7n bwCGkcb6X7PYj2ZqCjyAc1ObWG2jB+sMLosp/SqV210Q36Xnt0//+lFbt1aw5SVXhf/a BX43cCCP9rUs4+xbMcFet7bSGH2NAfu2CT8wFINXcqX6y/FZ1cAVGcOUxxI8B0sXN/qQ yAUQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UtZ6k9Oyj9C76UgVXziiWcsI59b09aZmqIi0GzVC7eo=; fh=9bGxxPI+IiFttPs3QhfhBAZDnxipaVmWpf+QSj2Bc/s=; b=EFIA8OdueVO/JEjLzAG6OVtk1iKEjuFeWmiCsQr4ZIvILFCFNTbnVuvbMsGcuOBWxH JtJYd2o3sU0FLDMUwq+IFJ64C0NBPWM5CdqkLvwpn4GM5jqbOkMrS11lVzyR1ajac+1x YsywMhc1h7QkEW8dSPUY6IRaq67tNn/dAKcweWpNlZhLX27NgGAQL95HqNCZvt2EwTYI ucmmBosSIxB93dMQXFhGin/oUL0kG30eV861UgwC5Jl5wTaSovXjze2ahklb7FwmdZ25 6eWmSRfbCEE7vjB7OZSC1nMgiGeXbpGIq9147KsYcruMgpk02EeoSMrQwds17De+iKXV +Ixw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lcTOp6Ug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id y7-20020a818807000000b005af6d13d25fsi2587271ywf.300.2023.10.27.07.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:39:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lcTOp6Ug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 915DC80A1A29; Fri, 27 Oct 2023 07:39:29 -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 S1345875AbjJ0Oi7 (ORCPT + 25 others); Fri, 27 Oct 2023 10:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346132AbjJ0Oi5 (ORCPT ); Fri, 27 Oct 2023 10:38:57 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 026CBD7; Fri, 27 Oct 2023 07:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698417535; x=1729953535; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=fKL8O9LfX0J38E00Mtc5QFOreN8mewIuIipoFxbNi84=; b=lcTOp6UgzEM6Kf2icDAPp8eLvbjv1T8ASaIqPXW6M0HZtEJe5sTiymwh Qc7R0PTSEpTTW1n1WwIjny1mDKps4glpB6KjAjrufN+8Vbg/Q0WS/GhMZ +NSoV0ytTMZKmO8YIBFopGxPVIY4rNSRO4/HS2w3EU/29VL0c9sBdBcyx jGws/LS+7kTD8jyv9i0aXlt74O+HoaBJkusX+9gszJHs3/Sood0q95rWm JwXUglzIKudXx7c9ZdsPJ+lDCUQ3SVYUxWoWlSE35p/4K12ikrZivkrXu xCDEG53jCelfRqXzBD8ITmu88ygrYczzU2v1hVkHiyN984iERbBEV51JM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10876"; a="606700" X-IronPort-AV: E=Sophos;i="6.03,256,1694761200"; d="scan'208";a="606700" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2023 07:38:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10876"; a="736094436" X-IronPort-AV: E=Sophos;i="6.03,256,1694761200"; d="scan'208";a="736094436" Received: from dmnassar-mobl.amr.corp.intel.com (HELO desk) ([10.212.203.39]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2023 07:38:53 -0700 Date: Fri, 27 Oct 2023 07:38:53 -0700 From: Pawan Gupta To: 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, Andrew Cooper , Nikolay Borisov Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, Alyssa Milburn , Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com, Greg Kroah-Hartman , Pawan Gupta Subject: [PATCH v4 3/6] x86/entry_32: Add VERW just before userspace transition Message-ID: <20231027-delay-verw-v4-3-9a3622d4bcf7@linux.intel.com> X-Mailer: b4 0.12.3 References: <20231027-delay-verw-v4-0-9a3622d4bcf7@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231027-delay-verw-v4-0-9a3622d4bcf7@linux.intel.com> 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,URIBL_BLOCKED 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]); Fri, 27 Oct 2023 07:39:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780919917658898848 X-GMAIL-MSGID: 1780919917658898848 As done for entry_64, add support for executing VERW late in exit to user path for 32-bit mode. Signed-off-by: Pawan Gupta --- arch/x86/entry/entry_32.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 6e6af42e044a..74a4358c7f45 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -885,6 +885,7 @@ SYM_FUNC_START(entry_SYSENTER_32) BUG_IF_WRONG_CR3 no_user_check=1 popfl popl %eax + CLEAR_CPU_BUFFERS /* * Return back to the vDSO, which will pop ecx and edx. @@ -954,6 +955,7 @@ restore_all_switch_stack: /* Restore user state */ RESTORE_REGS pop=4 # skip orig_eax/error_code + CLEAR_CPU_BUFFERS .Lirq_return: /* * ARCH_HAS_MEMBARRIER_SYNC_CORE rely on IRET core serialization @@ -1146,6 +1148,7 @@ SYM_CODE_START(asm_exc_nmi) /* Not on SYSENTER stack. */ call exc_nmi + CLEAR_CPU_BUFFERS jmp .Lnmi_return .Lnmi_from_sysenter_stack: