Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp362458imw; Thu, 14 Jul 2022 02:47:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vkt1nwiDKdctWrAn3tDK05Q1ru8UmyiPE/4fTHJQ/WT0IrUWTTGsKqRddbduGyyNTKVbHf X-Received: by 2002:a63:3807:0:b0:40c:73a7:b6cf with SMTP id f7-20020a633807000000b0040c73a7b6cfmr6675435pga.240.1657792053535; Thu, 14 Jul 2022 02:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657792053; cv=none; d=google.com; s=arc-20160816; b=OAyzzjTPmdgtvdmJQNlKiS+K/5yIUBBcajwCQRaSbYrgYmia1f+nGTIH3YUvsXlBXR LbSMdIzP83+lD9EL0qp7puuvB2PzRf/rshQq8CzPYggIKPmoRPJQSdmaqryZlgI/HQ0k lhZk5Rl1YZD0grAyy5AtE+PIWVGRYJ3Cf952DWX8OzsosT/fQJiB6T8gD58kE+y4ANE1 PVYM0oG8m5WT+HcvkZiqng2wpVwvyzAmpwWiGH3bC//uVpGbydyKSR2EQL9REWrVLnaj dkURR/SgjqZOiEpG7GvrGejahWbyWDQQMeNzzCEbmskFetaj9OO6W5zlbpOHxiNC+NkT Evrg== 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=mo2Q939l1SKna16jkIoy7R6Mn2lotxlYpDlgge+GjVo=; b=ywTXufrRtRbGS2z5yvp05xfhdut+sPgz/3nbK7JlyoJj5zPGC8iexKY9yoGPJspgVK qdTanWPl29zOdvumDIjupfyTlkADUGYnxVuIG86E3VaYL31FyKXXxAVAbuytGd51Drro swG7K4goUK0DveOF9XcHOv3aLySgkjf/bSGiC2MbAHsURttYEPkcHnQDZIq/XccCiwoD Nh9pWs1tMFUHPHJ6rFfvI3e/EQ7/VO8vm155pE0ozbof9TRrsYK62b6cRf8Cw0J8umRm 8XAsJoSmqqPvBBwO7i2WFGBGKnEMmXAHinXefjkXNsi2H+j7SSVXnZ3QDe2QfxIrHD1/ MXxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KHdxs8wa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a63f546000000b004124d9d99f7si1348240pgk.453.2022.07.14.02.47.22; Thu, 14 Jul 2022 02:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KHdxs8wa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238384AbiGNJmB (ORCPT + 99 others); Thu, 14 Jul 2022 05:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbiGNJl6 (ORCPT ); Thu, 14 Jul 2022 05:41:58 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D9C3286E8 for ; Thu, 14 Jul 2022 02:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mo2Q939l1SKna16jkIoy7R6Mn2lotxlYpDlgge+GjVo=; b=KHdxs8wav0Y5pvpax5w0I6Gn1K dXyuxfq5tep40UxWVOSBgaU9cv1pTmFzGLyEiTioQ8m+n20dBevOvstHfDUS1onPgr6zPb7IEZXYk XSRMeDxTb5EcosKSi2Q1E4DuacZO6FbHN24vCjttW3dK3eo5yZwUdSMje29ZIAd6r9mg2OBTCn8N4 z+tGKfetk1RRQyUmc64969DX4YDWSh0UiT6ID5cUNhDLwwKvEsHbU86ZVdjwW3UOoKX3dUG7zaGBL FLswFjX2PfEP+5qd3Mc9KZNTliB8RJlS+f3JiwX0HIYDglYrGR+/L3u/iaYoyjw/IY1ahpHS1BxI7 lC6dC9JQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBvLw-003oIA-2Q; Thu, 14 Jul 2022 09:41:48 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id DB62D980120; Thu, 14 Jul 2022 11:41:46 +0200 (CEST) Date: Thu, 14 Jul 2022 11:41:46 +0200 From: Peter Zijlstra To: Alexandre Chartre Cc: bp@alien8.de, x86@kernel.org, linux-kernel@vger.kernel.org, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, ankur.a.arora@oracle.com, maciej.szmigiero@oracle.com Subject: Re: [PATCH] x86/entry: Remove UNTRAIN_RET from native_irq_return_ldt Message-ID: References: <20220713195808.452394-1-alexandre.chartre@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220713195808.452394-1-alexandre.chartre@oracle.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 13, 2022 at 09:58:08PM +0200, Alexandre Chartre wrote: > UNTRAIN_RET is not needed in native_irq_return_ldt because ret untrain > has already be done at this point. In addition, when the RETBleed > mitigation is IBPB, UNTRAIN_RET clobbers several registers (AX, CX, DX) > so here it trashes user values which are in these registers. > > Signed-off-by: Alexandre Chartre Acked-by: Peter Zijlstra (Intel) > --- > arch/x86/entry/entry_64.S | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > index 285e043a3e40..9953d966d124 100644 > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -727,7 +727,6 @@ native_irq_return_ldt: > pushq %rdi /* Stash user RDI */ > swapgs /* to kernel GS */ > SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi /* to kernel CR3 */ > - UNTRAIN_RET > > movq PER_CPU_VAR(espfix_waddr), %rdi > movq %rax, (0*8)(%rdi) /* user RAX */ > -- > 2.31.1 >