x86: Convert unreachable() to BUG()

[ Upstream commit 2190966fbc14ca2cd4ea76eefeb96a47d8e390df ]

Avoid unreachable() as it can (and will in the absence of UBSAN)
generate fallthrough code. Use BUG() so we get a UD2 trap (with
unreachable annotation).

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://lore.kernel.org/r/20241128094312.028316261@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Peter Zijlstra
2024-11-28 10:39:02 +01:00
committed by Greg Kroah-Hartman
parent e5ff8d825d
commit 910d55f7d6
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -838,7 +838,7 @@ void __noreturn stop_this_cpu(void *dummy)
#ifdef CONFIG_SMP
if (smp_ops.stop_this_cpu) {
smp_ops.stop_this_cpu();
unreachable();
BUG();
}
#endif
+1 -1
View File
@@ -883,7 +883,7 @@ static int crash_nmi_callback(unsigned int val, struct pt_regs *regs)
if (smp_ops.stop_this_cpu) {
smp_ops.stop_this_cpu();
unreachable();
BUG();
}
/* Assume hlt works */
+1 -1
View File
@@ -3833,7 +3833,7 @@ next_range:
goto next_range;
}
unreachable();
BUG();
}
static int __sev_snp_update_protected_guest_state(struct kvm_vcpu *vcpu)