Skip to contentSkip to conversation

arm64: proton-pack: Fix hard lockup when !MITIGATE_SPECTRE_BRANCH_HISTORY

PATCH In review Jonathan Marek 3 participants 4 messages Nov 17, 2025 – Nov 27, 2025 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: proton-pack: Fix hard lockup when !MITIGATE_SPECTRE_BRANCH_HISTORY

The "drop print" commit removed the whole branch and not just the print. For some ARM64 cpus, this leads to hard lockup when CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not enabled.

Fixes 62e72463ca71 ("arm64: proton-pack: Drop print when !CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY")
---
 arch/arm64/kernel/proton-pack.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/kernel/proton-pack.c +2 -0
index c7d70d04c164c..80a580e019c50 100644
@@ -1032,6 +1032,8 @@ void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry)
 
 	if (arm64_get_spectre_v2_state() == SPECTRE_VULNERABLE) {
 		/* No point mitigating Spectre-BHB alone. */
+	} else if (!IS_ENABLED(CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY)) {
+		/* Do nothing */
 	} else if (supports_ecbhb(SCOPE_LOCAL_CPU)) {
 		state = SPECTRE_MITIGATED;
 		set_bit(BHB_HW, &system_bhb_mitigations);
Signature · 1 line
2.51.0
#1 lore raw

Can you pick this up? Its an urgent fix..

And looks like I forgot it, you can add:

Quoted 23 lines · Jonathan Marek

The "drop print" commit removed the whole branch and not just the print. For some ARM64 cpus, this leads to hard lockup when CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not enabled.

Fixes 62e72463ca71 ("arm64: proton-pack: Drop print when !CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY")
---
  arch/arm64/kernel/proton-pack.c | 2 ++
  1 file changed, 2 insertions(+)
arch/arm64/kernel/proton-pack.c +2 -0
index c7d70d04c164c..80a580e019c50 100644
@@ -1032,6 +1032,8 @@ void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry)
 
  	if (arm64_get_spectre_v2_state() == SPECTRE_VULNERABLE) {
  		/* No point mitigating Spectre-BHB alone. */
+	} else if (!IS_ENABLED(CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY)) {
+		/* Do nothing */
  	} else if (supports_ecbhb(SCOPE_LOCAL_CPU)) {
  		state = SPECTRE_MITIGATED;
  		set_bit(BHB_HW, &system_bhb_mitigations);
maintainer
#2 lore raw
In reply to Jonathan Marek
Quoted 5 lines · Jonathan Marek

The "drop print" commit removed the whole branch and not just the print. For some ARM64 cpus, this leads to hard lockup when CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not enabled.

Applied (with your SoB) to arm64 (for-next/fixes), thanks!

[1/1] arm64: proton-pack: Fix hard lockup when !MITIGATE_SPECTRE_BRANCH_HISTORY

      https://git.kernel.org/arm64/c/165eb13e485c

I'd be inclined to remove CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY entirely (i.e. make it unconditional) given the number of CPUs affected and the dynamic controls we already have for the mitigation.

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
Reviewed-by Tested-by on v1 1/1
#3 lore raw
In reply to Jonathan Marek
Quoted 14 lines · Jonathan Marek

The "drop print" commit removed the whole branch and not just the print. For some ARM64 cpus, this leads to hard lockup when CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is not enabled.

Fixes 62e72463ca71 ("arm64: proton-pack: Drop print when !CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY")
---
  arch/arm64/kernel/proton-pack.c | 2 ++
  1 file changed, 2 insertions(+)
arch/arm64/kernel/proton-pack.c +0 -0
index c7d70d04c164c..80a580e019c50 100644

arch/arm64/kernel/proton-pack.c void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry) · line 1039

Quoted 8 lines
arch/arm64/kernel/proton-pack.c +2 -0
@@ -1032,6 +1032,8 @@ void spectre_bhb_enable_mitigation(const struct arm64_cpu_capabilities *entry)
 
  	if (arm64_get_spectre_v2_state() == SPECTRE_VULNERABLE) {
  		/* No point mitigating Spectre-BHB alone. */
+	} else if (!IS_ENABLED(CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY)) {
+		/* Do nothing */
  	} else if (supports_ecbhb(SCOPE_LOCAL_CPU)) {
  		state = SPECTRE_MITIGATED;
  		set_bit(BHB_HW, &system_bhb_mitigations);

If CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY is unset, the fix is needed to boot Linux on Lantronix SM8450-HDK and SM8550-HDK boards, which are otherwise broken since v6.18-rc6.

Signature · 2 lines
Best wishes,
Vladimir