From nobody Mon Feb 9 03:34:15 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A406C1AACB; Sun, 14 Apr 2024 09:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713086377; cv=none; b=sbMrlRe4zvfRxGev/q/MegIUidwD8+l4Zv/bfjkXWpQYsM8FsZ5I6r9EuGoeiE15g+GncUvRtzzq5YoDBuR31WVlte/zxKL/LcP8VyfT9oD68FWd5TRlQZZp/I7W6Ll8EWF7HVV+8/cgnQ5GLzmFMpFqvhUuRS0oOQIUlAn5hDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713086377; c=relaxed/simple; bh=lnii2kZ8IUvaZdbR0jQA4QKCoeVDNlBUw1Zj8Jm+CSI=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ZWN/JsneHkCj1Sb5OJPIe3skNktr8T0x0f097Aqm++ucqeC+069bdbEuSdAOLv2/r9mrvQkmxa14RCqwuejPAXvsumB/FfRdpuzNWbOTTE27G/qb3RNZXaFiT9tV/tfRrCSjc8kHw/FKjQ3KDLPqVjijvgRFlTnmgIb1zlGPrFM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=v+zPO3NB; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=/R9VLDvu; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="v+zPO3NB"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="/R9VLDvu" Date: Sun, 14 Apr 2024 09:19:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1713086373; 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=NZFwphc8SHYVbPnkWi5EsmyxN8HbgaWmtnfTFBlfG2c=; b=v+zPO3NBl+tOpY3Gaa72M2N78iAfXLIyevqEEBWTNi9nQ4GyWdAa3inddo0OiaWI0uEynB I2hpVDIKTJk4xJ7sbM0MdcfFEgPw5MuSd5pqmfp0Pe3STGPH5IV4oNcN7iyCLoMR7jRHkO aVyZrUbXJtmtu26sXxssgfyAzQc3SpQK5nFfUwfqm9TuM9RfFVLHTOxRU3FTo0nWQ4VwFn usbll9gf3oIuRQLIIZKRTD02EDSVesO/OkPj1pycqjC8MVlKknRfIxiSWBnzW7reuis9Rv y/95iDuuGC+JNX0Qez3hk4ScGNQAw7Mo2EQzVmg69Lqxa3GvjF+sH+qTBRitVA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1713086373; 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=NZFwphc8SHYVbPnkWi5EsmyxN8HbgaWmtnfTFBlfG2c=; b=/R9VLDvuW1MdHw2em5hXToeU3yOsOLRAWusGogzGe914o418BIQ236z4Hx6Dvh9OEYplKZ T8EklU8FDWr2fJCQ== 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/urgent] x86/bugs: Fix BHI retpoline check Cc: Josh Poimboeuf , Ingo Molnar , Pawan Gupta , Borislav Petkov , Linus Torvalds , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171308637277.10875.5583955178829069240.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/urgent branch of tip: Commit-ID: 69129794d94c544810e68b2b4eaa7e44063f9bf2 Gitweb: https://git.kernel.org/tip/69129794d94c544810e68b2b4eaa7e440= 63f9bf2 Author: Josh Poimboeuf AuthorDate: Fri, 12 Apr 2024 11:10:33 -07:00 Committer: Ingo Molnar CommitterDate: Sun, 14 Apr 2024 11:10:05 +02:00 x86/bugs: Fix BHI retpoline check Confusingly, X86_FEATURE_RETPOLINE doesn't mean retpolines are enabled, as it also includes the original "AMD retpoline" which isn't a retpoline at all. Also replace cpu_feature_enabled() with boot_cpu_has() because this is before alternatives are patched and cpu_feature_enabled()'s fallback path is slower than plain old boot_cpu_has(). Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob") Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Reviewed-by: Pawan Gupta Cc: Borislav Petkov Cc: Linus Torvalds Link: https://lore.kernel.org/r/ad3807424a3953f0323c011a643405619f2a4927.17= 12944776.git.jpoimboe@kernel.org --- arch/x86/kernel/cpu/bugs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index ca295b0..ab18185 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1652,7 +1652,8 @@ static void __init bhi_select_mitigation(void) return; =20 /* Retpoline mitigates against BHI unless the CPU has RRSBA behavior */ - if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) { + if (boot_cpu_has(X86_FEATURE_RETPOLINE) && + !boot_cpu_has(X86_FEATURE_RETPOLINE_LFENCE)) { spec_ctrl_disable_kernel_rrsba(); if (rrsba_disabled) return; @@ -2804,11 +2805,13 @@ static const char *spectre_bhi_state(void) { if (!boot_cpu_has_bug(X86_BUG_BHI)) return "; BHI: Not affected"; - else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW)) + else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_HW)) return "; BHI: BHI_DIS_S"; - else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP)) + else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP)) return "; BHI: SW loop, KVM: SW loop"; - else if (boot_cpu_has(X86_FEATURE_RETPOLINE) && rrsba_disabled) + else if (boot_cpu_has(X86_FEATURE_RETPOLINE) && + !boot_cpu_has(X86_FEATURE_RETPOLINE_LFENCE) && + rrsba_disabled) return "; BHI: Retpoline"; else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT)) return "; BHI: Vulnerable, KVM: SW loop";