From nobody Fri Apr 17 22:31:12 2026 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 2620EC43334 for ; Thu, 21 Jul 2022 08:38:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232424AbiGUIi3 (ORCPT ); Thu, 21 Jul 2022 04:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232500AbiGUIhw (ORCPT ); Thu, 21 Jul 2022 04:37:52 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 849817E80B; Thu, 21 Jul 2022 01:37:50 -0700 (PDT) Date: Thu, 21 Jul 2022 08:37:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1658392669; 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=5o+4QMkI67u2Hw+y0j+cXcs6ICCQywYpJN6i2wwGmMs=; b=k5FvpTirnqhGyUnvlGNVQoreD+Cs7WbPm8soiBZMch9Dp/tRVrFDYQbDBT6v/pZJbW7kxE caOWnADfXnIY2l1Q/yTTmvTw4hAURQdS6YaqYGbE+aTavv7TMdxf2WVYSIHbosLCFNljbJ /oRfhN1roiFE5eqiwjWW+YnhoYiPOwlR6j6ZklnoHUq9dDbyNp0ykThJUfKr3w3KB7XzDn dzS1CrUhTlEdSZi+TT9RbQ50o9KIzFdAn678O1HWJRl9PpL4scU0i3RJDy6n5vxZ4Mcruh ABBE5WTcaWwzN8gdaZx9ymhBt3pqnV2oSz1MZNPQt8GfOgttdwfjRHPoU+FNSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1658392669; 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=5o+4QMkI67u2Hw+y0j+cXcs6ICCQywYpJN6i2wwGmMs=; b=EPE7yms5qpl16ggD7HzLD0zcIUAj9uMlyzg1bYA/n57xrSVf4KNDc5v1GJyzMUSBsOSZfk RvZ6sGwR8oGpvIBA== From: "tip-bot2 for Pawan Gupta" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/urgent] x86/bugs: Warn when "ibrs" mitigation is selected on Enhanced IBRS parts Cc: Pawan Gupta , "Peter Zijlstra (Intel)" , Thadeu Lima de Souza Cascardo , stable@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: =?utf-8?q?=3C2a5eaf54583c2bfe0edc4fea64006656256cca17=2E16578?= =?utf-8?q?14857=2Egit=2Epawan=2Ekumar=2Egupta=40linux=2Eintel=2Ecom=3E?= References: =?utf-8?q?=3C2a5eaf54583c2bfe0edc4fea64006656256cca17=2E165781?= =?utf-8?q?4857=2Egit=2Epawan=2Ekumar=2Egupta=40linux=2Eintel=2Ecom=3E?= MIME-Version: 1.0 Message-ID: <165839266798.15455.828459830184697183.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/urgent branch of tip: Commit-ID: eb23b5ef9131e6d65011de349a4d25ef1b3d4314 Gitweb: https://git.kernel.org/tip/eb23b5ef9131e6d65011de349a4d25ef1= b3d4314 Author: Pawan Gupta AuthorDate: Thu, 14 Jul 2022 16:15:35 -07:00 Committer: Peter Zijlstra CommitterDate: Wed, 20 Jul 2022 19:24:53 +02:00 x86/bugs: Warn when "ibrs" mitigation is selected on Enhanced IBRS parts IBRS mitigation for spectre_v2 forces write to MSR_IA32_SPEC_CTRL at every kernel entry/exit. On Enhanced IBRS parts setting MSR_IA32_SPEC_CTRL[IBRS] only once at boot is sufficient. MSR writes at every kernel entry/exit incur unnecessary performance loss. When Enhanced IBRS feature is present, print a warning about this unnecessary performance loss. Signed-off-by: Pawan Gupta Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Thadeu Lima de Souza Cascardo Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/2a5eaf54583c2bfe0edc4fea64006656256cca17.16= 57814857.git.pawan.kumar.gupta@linux.intel.com --- arch/x86/kernel/cpu/bugs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 78c9082..6454bc7 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -975,6 +975,7 @@ static inline const char *spectre_v2_module_string(void= ) { return ""; } #define SPECTRE_V2_LFENCE_MSG "WARNING: LFENCE mitigation is not recommend= ed for this CPU, data leaks possible!\n" #define SPECTRE_V2_EIBRS_EBPF_MSG "WARNING: Unprivileged eBPF is enabled w= ith eIBRS on, data leaks possible via Spectre v2 BHB attacks!\n" #define SPECTRE_V2_EIBRS_LFENCE_EBPF_SMT_MSG "WARNING: Unprivileged eBPF i= s enabled with eIBRS+LFENCE mitigation and SMT, data leaks possible via Spe= ctre v2 BHB attacks!\n" +#define SPECTRE_V2_IBRS_PERF_MSG "WARNING: IBRS mitigation selected on Enh= anced IBRS CPU, this may cause unnecessary performance loss\n" =20 #ifdef CONFIG_BPF_SYSCALL void unpriv_ebpf_notify(int new_state) @@ -1415,6 +1416,8 @@ static void __init spectre_v2_select_mitigation(void) =20 case SPECTRE_V2_IBRS: setup_force_cpu_cap(X86_FEATURE_KERNEL_IBRS); + if (boot_cpu_has(X86_FEATURE_IBRS_ENHANCED)) + pr_warn(SPECTRE_V2_IBRS_PERF_MSG); break; =20 case SPECTRE_V2_LFENCE: