Skip to content

Commit 2190966

Browse files
author
Peter Zijlstra
committed
x86: Convert unreachable() to BUG()
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
1 parent c837de3 commit 2190966

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

arch/x86/kernel/process.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ void __noreturn stop_this_cpu(void *dummy)
838838
#ifdef CONFIG_SMP
839839
if (smp_ops.stop_this_cpu) {
840840
smp_ops.stop_this_cpu();
841-
unreachable();
841+
BUG();
842842
}
843843
#endif
844844

arch/x86/kernel/reboot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ static int crash_nmi_callback(unsigned int val, struct pt_regs *regs)
883883

884884
if (smp_ops.stop_this_cpu) {
885885
smp_ops.stop_this_cpu();
886-
unreachable();
886+
BUG();
887887
}
888888

889889
/* Assume hlt works */

arch/x86/kvm/svm/sev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3820,7 +3820,7 @@ static int snp_begin_psc(struct vcpu_svm *svm, struct psc_buffer *psc)
38203820
goto next_range;
38213821
}
38223822

3823-
unreachable();
3823+
BUG();
38243824
}
38253825

38263826
static int __sev_snp_update_protected_guest_state(struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)