[PATCH] arm64: proton-pack: Don't query firmware for Spectre-v4 on SSBS CPUs
From: Breno Leitao
Date: Thu Nov 12 2026 - 13:54:38 EST
On a CPU that implements SSBS, booting with mitigations=off or
ssbd=force-off makes spectre_v4_enable_hw_mitigation() set DSSBS and
PSTATE.SSBS and return SPECTRE_VULNERABLE. spectre_v4_enable_mitigation()
then treats the CPU like one without a hardware mitigation and queries
firmware for SMCCC_ARCH_WORKAROUND_2.
Firmware answers that query about its own mitigation. For a CPU with
SSBS it can report that none is needed, as
SMCCC_ARCH_WORKAROUND_RET_UNAFFECTED or SMCCC_RET_NOT_REQUIRED.
spectre_v4_get_cpu_fw_mitigation_state() turns both into
SPECTRE_UNAFFECTED, so spectre_v4_state keeps its initial
SPECTRE_UNAFFECTED value. The kernel logs "detected: Spectre-v4", then
reports "Not affected" in sysfs and PR_SPEC_NOT_AFFECTED from prctl(),
although every CPU runs with SSBS set. KVM follows spectre_v4_state and
tells guests that ARCH_WORKAROUND_2 is not required.
Before commit c28762070ca6 ("arm64: Rewrite Spectre-v4 mitigation code"),
a CPU with SSBS never queried firmware, and the same configuration
reported "Vulnerable", which seems the correct approach, given
mitigation=off ?! Same for prctl().
Only fall back to firmware on CPUs without SSBS. When
spectre_v4_enable_hw_mitigation() returns SPECTRE_VULNERABLE for a CPU
with SSBS, the mitigation was disabled on the command line, whatever
firmware says.
Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
arch/arm64/kernel/proton-pack.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/proton-pack.c b/arch/arm64/kernel/proton-pack.c
index 3bcf86154d95cd..80c5f6a198241c 100644
--- a/arch/arm64/kernel/proton-pack.c
+++ b/arch/arm64/kernel/proton-pack.c
@@ -638,7 +638,7 @@ void spectre_v4_enable_mitigation(const struct arm64_cpu_capabilities *__unused)
WARN_ON(preemptible());
state = spectre_v4_enable_hw_mitigation();
- if (state == SPECTRE_VULNERABLE)
+ if (state == SPECTRE_VULNERABLE && !this_cpu_has_cap(ARM64_SSBS))
state = spectre_v4_enable_fw_mitigation();
update_mitigation_state(&spectre_v4_state, state);
---
base-commit: aaa2f954c21b205a0bcd0961e5b2be4e82e58455
change-id: 20261112-arm64-spectre-v4-off-707f3d74308b
Best regards,
--
Breno Leitao <leitao@xxxxxxxxxx>