mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 04:28:10 -04:00
KVM: arm64: Handle UBSAN faults
As now UBSAN can be enabled, handle brk64 exits from UBSAN. Re-use the decoding code from the kernel, and panic with UBSAN message. Signed-off-by: Mostafa Saleh <smostafa@google.com> Reviewed-by: Kees Cook <kees@kernel.org> Link: https://lore.kernel.org/r/20250430162713.1997569-5-smostafa@google.com Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
committed by
Marc Zyngier
parent
61b38f7591
commit
446692759b
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <linux/kvm.h>
|
||||
#include <linux/kvm_host.h>
|
||||
#include <linux/ubsan.h>
|
||||
|
||||
#include <asm/esr.h>
|
||||
#include <asm/exception.h>
|
||||
@@ -474,6 +475,11 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
|
||||
print_nvhe_hyp_panic("BUG", panic_addr);
|
||||
} else if (IS_ENABLED(CONFIG_CFI_CLANG) && esr_is_cfi_brk(esr)) {
|
||||
kvm_nvhe_report_cfi_failure(panic_addr);
|
||||
} else if (IS_ENABLED(CONFIG_UBSAN_KVM_EL2) &&
|
||||
ESR_ELx_EC(esr) == ESR_ELx_EC_BRK64 &&
|
||||
esr_is_ubsan_brk(esr)) {
|
||||
print_nvhe_hyp_panic(report_ubsan_failure(esr & UBSAN_BRK_MASK),
|
||||
panic_addr);
|
||||
} else {
|
||||
print_nvhe_hyp_panic("panic", panic_addr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user