mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
KVM: arm64: Drop %pB on nVHE panic when stage-2 is active
With pKVM, the host stage-2 is lazily mapped. kallsyms, accessed via
the modifier %pB is therefore potentially unmapped. If the hyp panic
occurred while the host stage-2 lock was held, handling this fault
deadlocks.
Skip %pB formatting unless the host stage-2 is disabled.
Fixes: 6ccf9cb557 ("KVM: arm64: Symbolize the nVHE HYP addresses")
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260803093906.3531699-1-vdonnefort@google.com
Signed-off-by: Oliver Upton <oupton@kernel.org>
This commit is contained in:
parent
43347154e7
commit
2ad524c5e2
|
|
@ -507,10 +507,20 @@ void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index)
|
|||
kvm_handle_guest_serror(vcpu, kvm_vcpu_get_esr(vcpu));
|
||||
}
|
||||
|
||||
static bool nvhe_hyp_panic_host_s2_disabled(void)
|
||||
{
|
||||
return !is_protected_kvm_enabled() ||
|
||||
IS_ENABLED(CONFIG_PKVM_DISABLE_STAGE2_ON_PANIC);
|
||||
}
|
||||
|
||||
static void print_nvhe_hyp_panic(const char *name, u64 panic_addr)
|
||||
{
|
||||
kvm_err("nVHE hyp %s at: [<%016llx>] %pB!\n", name, panic_addr,
|
||||
(void *)(panic_addr + kaslr_offset()));
|
||||
/* Kallsyms might not be mapped in the host stage-2 */
|
||||
if (nvhe_hyp_panic_host_s2_disabled())
|
||||
kvm_err("nVHE hyp %s at: [<%016llx>] %pB!\n", name, panic_addr,
|
||||
(void *)(panic_addr + kaslr_offset()));
|
||||
else
|
||||
kvm_err("nVHE hyp %s at: %016llx!\n", name, panic_addr);
|
||||
}
|
||||
|
||||
static void kvm_nvhe_report_cfi_failure(u64 panic_addr)
|
||||
|
|
@ -538,8 +548,7 @@ void __noreturn __cold nvhe_hyp_panic_handler(u64 esr, u64 spsr,
|
|||
unsigned int line = 0;
|
||||
|
||||
/* All hyp bugs, including warnings, are treated as fatal. */
|
||||
if (!is_protected_kvm_enabled() ||
|
||||
IS_ENABLED(CONFIG_PKVM_DISABLE_STAGE2_ON_PANIC)) {
|
||||
if (nvhe_hyp_panic_host_s2_disabled()) {
|
||||
struct bug_entry *bug = find_bug(elr_in_kimg);
|
||||
|
||||
if (bug)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user