From patchwork Fri Oct 20 11:37:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 156028 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp990594vqb; Fri, 20 Oct 2023 04:38:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlN8WROHgpEnCs8r8ptUKi4XmKrjxnLAL6D4OnYF5y5a3XQxFyvZpSH3yRXjebQKMwAN/Z X-Received: by 2002:a05:6870:c49:b0:1ea:385:518b with SMTP id lf9-20020a0568700c4900b001ea0385518bmr1886044oab.3.1697801895337; Fri, 20 Oct 2023 04:38:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697801895; cv=none; d=google.com; s=arc-20160816; b=mJ5DBC+4cg1jQ91diajWkz06hZ2lwJigWFTTtEVFdebb1p4YPusvgzSjotLEsCMCai Yb58KQosv66eh2ICBkp0OpZZ4LA3TVYe6DSXqLcXu4O64m7pnOGRrTaklrEEUrBwl6i/ 33uxofWCXLyeiAUrIuufk+AFeWywt32j98ho8aL4RZOtNKotpKkF6M+1NypvnBZi00+o xvZjq1Witb0HuwBAQGYGdkBTJLzWEqMnEMpcJcCphE6SeO8D7fTlP/0dtWQ7PavxZSOr nZ0lP2X5lsiSz5SCNS17pF8C5VcwFaP+yCENgoriDvOLtK1SQH8uXnMXtSMWuy1pk8bh XvqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=Jwgrd907MJF0rWbpAM7WU3Q9N1KJwdZxQq0QxjY+oy8=; fh=TJa98jjcJcAUyvo2yQiOqi+wukdLlQU80th5XskGe8U=; b=h9oIR3cBhsJulAfYm6aKna/2jcIo3HbbnBj8jbJlKu5ixgOzm+4vwMB2EGw94W9cr9 qxICZ9+D/hFywKGrMajKoOteQ9G5RyxYQ1ybQ1z0I774ZhqZuYegT46337b6/z9XTUwL c02NdM1UlYFfvnoa4s21OHS94uJ98RQ3PpkBtxozCEPLj2tSMIQqEpS22OdGnxMd4sUB 6RcMuYYyIAMFeMnSlHxHln35ByXoL3zWiHWnZ/XyX3k06Zro5ExgS1R8X6rJfeO+tZbN Nh/mFtYFFYO+kAchG9ViZbTDmFYMLNCLasJ++6xPhrTKkvIUv2R/hK8jmfbArJ+Pd7ff UBHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=axZVygzi; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4rIT8eU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k70-20020a633d49000000b00584b293d17fsi1656340pga.550.2023.10.20.04.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 04:38:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=axZVygzi; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4rIT8eU3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 47D4882F08C0; Fri, 20 Oct 2023 04:38:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377229AbjJTLiH (ORCPT + 25 others); Fri, 20 Oct 2023 07:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377201AbjJTLh1 (ORCPT ); Fri, 20 Oct 2023 07:37:27 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E664D60; Fri, 20 Oct 2023 04:37:23 -0700 (PDT) Date: Fri, 20 Oct 2023 11:37:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697801841; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jwgrd907MJF0rWbpAM7WU3Q9N1KJwdZxQq0QxjY+oy8=; b=axZVygzi3YwvUxS0tacL4XSp2h3d4/4hdifXWCdf0ScJwfpj0zmXIf9pJpA6kB/QguIVqu EQhUfAuue2WUqBX3a549FGcQ/XIU+z8hGj+BPRujxdcR+8EH/4cKg4uiRWPqlgjZDcPr3H X2MTItQKEKQQutnddJbNR2Tid6Wlo82GqQL1FlmTexNzE5e/t5iWoqROnLofllulE3E8lK 7I3oFyNLUS9Vt0WuslTf65tFFFxEM8K+b25gOlcKGLXsGqbW8EP0EXy0tVAeP3UbLi65BJ EppF/Sf+XhtVpAIHvGkSwFB771kzSextG4i+ObMyFULQY7xrf5m3V208+JhjOA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697801841; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jwgrd907MJF0rWbpAM7WU3Q9N1KJwdZxQq0QxjY+oy8=; b=4rIT8eU3BWn3b+P/pExHcmYfFQszB83SNxtQsc15iQAK9mp2dMfzN6dUYySc37197Lm49I WfJ9iaJcttc81oAQ== From: "tip-bot2 for Josh Poimboeuf" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/bugs] x86/srso: Fix unret validation dependencies Cc: Josh Poimboeuf , Ingo Molnar , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <299fb7740174d0f2335e91c58af0e9c242b4bac1.1693889988.git.jpoimboe@kernel.org> References: <299fb7740174d0f2335e91c58af0e9c242b4bac1.1693889988.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <169780184131.3135.15040541825670995118.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails 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_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 20 Oct 2023 04:38:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777471840117211040 X-GMAIL-MSGID: 1780274320202246142 The following commit has been merged into the x86/bugs branch of tip: Commit-ID: eeb9f34df065f42f0c9195b322ba6df420c9fc92 Gitweb: https://git.kernel.org/tip/eeb9f34df065f42f0c9195b322ba6df420c9fc92 Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:04:53 -07:00 Committer: Borislav Petkov (AMD) CommitterDate: Fri, 20 Oct 2023 11:46:59 +02:00 x86/srso: Fix unret validation dependencies CONFIG_CPU_SRSO isn't dependent on CONFIG_CPU_UNRET_ENTRY (AMD Retbleed), so the two features are independently configurable. Fix several issues for the (presumably rare) case where CONFIG_CPU_SRSO is enabled but CONFIG_CPU_UNRET_ENTRY isn't. Fixes: fb3bd914b3ec ("x86/srso: Add a Speculative RAS Overflow mitigation") Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Signed-off-by: Borislav Petkov (AMD) Acked-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/299fb7740174d0f2335e91c58af0e9c242b4bac1.1693889988.git.jpoimboe@kernel.org --- arch/x86/include/asm/nospec-branch.h | 4 ++-- include/linux/objtool.h | 3 ++- scripts/Makefile.vmlinux_o | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h index c55cc24..197ff4f 100644 --- a/arch/x86/include/asm/nospec-branch.h +++ b/arch/x86/include/asm/nospec-branch.h @@ -271,7 +271,7 @@ .Lskip_rsb_\@: .endm -#ifdef CONFIG_CPU_UNRET_ENTRY +#if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO) #define CALL_UNTRAIN_RET "call entry_untrain_ret" #else #define CALL_UNTRAIN_RET "" @@ -312,7 +312,7 @@ .macro UNTRAIN_RET_FROM_CALL #if defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_IBPB_ENTRY) || \ - defined(CONFIG_CALL_DEPTH_TRACKING) + defined(CONFIG_CALL_DEPTH_TRACKING) || defined(CONFIG_CPU_SRSO) VALIDATE_UNRET_END ALTERNATIVE_3 "", \ CALL_UNTRAIN_RET, X86_FEATURE_UNRET, \ diff --git a/include/linux/objtool.h b/include/linux/objtool.h index 03f82c2..b5440e7 100644 --- a/include/linux/objtool.h +++ b/include/linux/objtool.h @@ -130,7 +130,8 @@ * it will be ignored. */ .macro VALIDATE_UNRET_BEGIN -#if defined(CONFIG_NOINSTR_VALIDATION) && defined(CONFIG_CPU_UNRET_ENTRY) +#if defined(CONFIG_NOINSTR_VALIDATION) && \ + (defined(CONFIG_CPU_UNRET_ENTRY) || defined(CONFIG_CPU_SRSO)) .Lhere_\@: .pushsection .discard.validate_unret .long .Lhere_\@ - . diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index 0edfdb4..25b3b58 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -37,7 +37,8 @@ objtool-enabled := $(or $(delay-objtool),$(CONFIG_NOINSTR_VALIDATION)) vmlinux-objtool-args-$(delay-objtool) += $(objtool-args-y) vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable -vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr $(if $(CONFIG_CPU_UNRET_ENTRY), --unret) +vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) += --noinstr \ + $(if $(or $(CONFIG_CPU_UNRET_ENTRY),$(CONFIG_CPU_SRSO)), --unret) objtool-args = $(vmlinux-objtool-args-y) --link