From nobody Tue Dec 16 23:59:11 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 480FDEE49B5 for ; Fri, 25 Aug 2023 10:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244542AbjHYKU4 (ORCPT ); Fri, 25 Aug 2023 06:20:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244406AbjHYKUK (ORCPT ); Fri, 25 Aug 2023 06:20:10 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 870A3210A; Fri, 25 Aug 2023 03:19:51 -0700 (PDT) Date: Fri, 25 Aug 2023 10:19:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1692958772; 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=5a7AzYGD7AcB/nfvl6ajIxpBcup4uYjTKiTxQHpuNm8=; b=kQ3ycgj5NAz6Bq3ho72FBsvpldC3EUU5WKBuLa0rPGjAuSb0fqtV44HsMdDumGPi1hXYl4 JqdYXagD/Elqm1DBHk4gPfoPSI6iFTH3pU6gfnI/uyUqzMv8KF+moZgGc6SL+cMKDp5Vag 5kNJjp4h5VTUYBx3qEptvv4qGzqirs47FinboPVZi1D/5nwG9b0pUaVeAi97KXCBR6DAcQ oWdXRAj/SIfFTPzbXxX49wjq+9zWktTfg7dar+Plqqg1fN6/HDn61QDZt/QsnESuG/oSvb Iy7vWODNVRBRjIPpIV5PZQEMxgJbxt3CP0YYFcKYJt1t/lMmNO8KSyRqHhctWg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1692958772; 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=5a7AzYGD7AcB/nfvl6ajIxpBcup4uYjTKiTxQHpuNm8=; b=jXaL19M6F9jgYjmAsGxE7hh0KCOXCy43iXxBpgnrCEwQV9YG1ZDc9sVWqRj7liGfWFVK5L LMvpodjGkbDFRVBA== 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 , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <6d3818c914d04684ec9a01397b0ef229c93d5fdf.1692919072.git.jpoimboe@kernel.org> References: <6d3818c914d04684ec9a01397b0ef229c93d5fdf.1692919072.git.jpoimboe@kernel.org> MIME-Version: 1.0 Message-ID: <169295877211.27769.3547120654273584881.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/bugs branch of tip: Commit-ID: a31dddd6a76dcfb65940d1c3252df771f850e547 Gitweb: https://git.kernel.org/tip/a31dddd6a76dcfb65940d1c3252df771f= 850e547 Author: Josh Poimboeuf AuthorDate: Fri, 25 Aug 2023 00:01:42 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 25 Aug 2023 11:21: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 Link: https://lore.kernel.org/r/6d3818c914d04684ec9a01397b0ef229c93d5fdf.16= 92919072.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/no= spec-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 =20 -#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 @@ =20 .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 :=3D $(or $(delay-objtool),$(CONFIG_NOINS= TR_VALIDATION)) =20 vmlinux-objtool-args-$(delay-objtool) +=3D $(objtool-args-y) vmlinux-objtool-args-$(CONFIG_GCOV_KERNEL) +=3D --no-unreachable -vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) +=3D --noinstr $(if $(CO= NFIG_CPU_UNRET_ENTRY), --unret) +vmlinux-objtool-args-$(CONFIG_NOINSTR_VALIDATION) +=3D --noinstr \ + $(if $(or $(CONFIG_CPU_UNRET_ENTRY),$(CONFIG_CPU_SRSO)), --unret) =20 objtool-args =3D $(vmlinux-objtool-args-y) --link