Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp384227rdh; Sat, 23 Sep 2023 15:12:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/qF7/Z7H/bhNFNtXg64oAUWlVG116DEiRj7deCzldHDgsg+m6FtHWNuJg+WgOnAc2L+v5 X-Received: by 2002:a17:903:22c7:b0:1c4:48dc:4825 with SMTP id y7-20020a17090322c700b001c448dc4825mr2604878plg.7.1695507152489; Sat, 23 Sep 2023 15:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695507152; cv=none; d=google.com; s=arc-20160816; b=EwmBM6KC/XsISx/t1T6N7o4oKlid6KstJSHKI059PXmyIOtUubqwBhsebSvaOZyhd3 QVisSWnq+JRVPcEO4PZUrdMDGjBkDCwNSOfDUXDxRTsfvv4vuwKeHdG5DsqeIVuNtQOA cxAojPjHHB+wH+Lt7w26BzAcTXSvAoNl5sk/LqgFOCfaNBio1rLOM14/s5oLPcEI28nv fVW0AWLMj2ontsOzSW3N661GVKAKauypNV9xxQPoXSkAdL/NSvaz90cohFGjIjriEJty otx5fc61+LQ/BgopFvYAo0vHPvUJnEVTQrfYUXSjwU1APlVyvqJ5P6gSa4y6QfAIryZ6 sgKg== 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=VEmQgi1pQRdOwNG9lah0w2o9Pb4UGTHzkbxyE7O5E1o=; fh=TJa98jjcJcAUyvo2yQiOqi+wukdLlQU80th5XskGe8U=; b=JK2EUim7RHDx1fzp5tNB4alyX2YQWh1DuZvWQHB4fgu8TIxFUm0LWv1/8Hfh6Ry/7Y 3uYPESMtXuUb//61MlmvlzF8X0Ih5t2MzHcsTmWQhkiHGhGGM+Dp42amhZoABX1vkeFs usMT9ABvrDXHzNIh4ZgIPZDAyRXvr0HEkJhihNKTLb5WCscgVgZ8kUUHDgdeDYQ22TLA 87p4dWhrso+4/hoLtUvv5X/vnAUnBk4dvx1Brtp8EQxonH8PLfpiQkpzMU3ZAG+C62df y8wZ+00D5Z5UKH58d+lvdp+bWyWN5yI4DRz9bEn41nROkeArcLHwC492A4Ij461iKxPn vNYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bJh9xjja; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=1b5vT6xh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id y12-20020a170903010c00b001c5f9de7a35si2224703plc.109.2023.09.23.15.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Sep 2023 15:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=bJh9xjja; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=1b5vT6xh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 0D00A8084587; Sat, 23 Sep 2023 05:20:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231786AbjIWMUp (ORCPT + 99 others); Sat, 23 Sep 2023 08:20:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231660AbjIWMUY (ORCPT ); Sat, 23 Sep 2023 08:20:24 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E981AD; Sat, 23 Sep 2023 05:20:12 -0700 (PDT) Date: Sat, 23 Sep 2023 12:20:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695471611; 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=VEmQgi1pQRdOwNG9lah0w2o9Pb4UGTHzkbxyE7O5E1o=; b=bJh9xjja/zw2sngYC9jYaoGeGIjfJ9BY0ZQ3qvCN2hGullOwNDFnTmAnXW+U1kFvI+MhlF RK9A5XthgyXsnEz2AxBXABJ14bDOIzTQSnxyHyYYXUauwD96RPKU9qI1hx1igZC2LgdPR+ Cacr4WcLzrOBMSQ4/XSLegno5Uk9VJOrFthLeNDutucHckEERST9gksn7w3VTPQovAABIr FkxE5q/X6VNJRyPcK1tOBSzA7K8dueM5td74cc/2SMvGN7J+qWxQ8Z8AvcDNRjUqKU2zJr ZEDgjGaay20Ducp5yNdggzcAbqvgmgfHI4OQjE4S1XmrK3tzUmTxNF+10mKEaA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695471611; 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=VEmQgi1pQRdOwNG9lah0w2o9Pb4UGTHzkbxyE7O5E1o=; b=1b5vT6xhXACKusjm8osAZkCAMXIMPleq636ccASqWjME/WJXvZRkTx/G5G0EQsJRHQd2/R u8zKcKtZiOfM7ICA== 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: <169547161094.27769.6858742541545309571.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: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 (howler.vger.email [0.0.0.0]); Sat, 23 Sep 2023 05:20:58 -0700 (PDT) The following commit has been merged into the x86/bugs branch of tip: Commit-ID: ae56e67426368016b4ff9083842210d5e0a09015 Gitweb: https://git.kernel.org/tip/ae56e67426368016b4ff9083842210d5e0a09015 Author: Josh Poimboeuf AuthorDate: Mon, 04 Sep 2023 22:04:53 -07:00 Committer: Ingo Molnar CommitterDate: Sat, 23 Sep 2023 14:13:02 +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 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