From: Vincent Donnefort <vdonnefort@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvmarm@lists.linux.dev, Oliver Upton <oupton@kernel.org>,
Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH v2] KVM: arm64: Drop %pB on nVHE panic when stage-2 is active
Date: Mon, 3 Aug 2026 10:53:08 +0100 [thread overview]
Message-ID: <anBk9amSO_MuXY-h@google.com> (raw)
In-Reply-To: <20260803095017.4A9D01F000E9@smtp.kernel.org>
On Mon, Aug 03, 2026 at 09:50:16AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
>
> Pre-existing issues:
> - [High] Incomplete fix for host stage-2 deadlock in nVHE hyp panic handler.
> --
>
> --- Patch [1]: [PATCH v2] KVM: arm64: Drop %pB on nVHE panic when stage-2 is active ---
> commit 6bd2e7dd3552f4e44146bf3e1065ca1511de7411
> Author: Vincent Donnefort <vdonnefort@google.com>
>
> KVM: arm64: Drop %pB on nVHE panic when stage-2 is active
>
> This patch introduces nvhe_hyp_panic_host_s2_disabled() to skip %pB
> formatting during a hyp panic when host stage-2 is active. It aims to prevent
> deadlocks that occur if the host stage-2 lock is held and a fault happens
> when accessing lazily mapped kallsyms data.
>
> > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c
> > index 54aedf93c78b6..88dcb8cb36f3c 100644
> > --- a/arch/arm64/kvm/handle_exit.c
> > +++ b/arch/arm64/kvm/handle_exit.c
> [ ... ]
> > @@ -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)
>
> [Severity: High]
> This is a pre-existing issue, but does this fully resolve the host stage-2
> deadlock?
>
> Further down in this same function, the backtrace and instruction dumpers
> are called unconditionally:
>
> /* Dump the nVHE hypervisor backtrace */
> kvm_nvhe_dump_backtrace(hyp_offset);
>
> /* Dump the faulting instruction */
> dump_kernel_instr(panic_addr + kaslr_offset());
>
> kvm_nvhe_dump_backtrace() iterates over stack frames and calls
> kvm_nvhe_dump_backtrace_entry(), which uses the exact same %pB formatter
> to print the frames:
>
> arch/arm64/kvm/stacktrace.c:kvm_nvhe_dump_backtrace_entry() {
> ...
> kvm_err(" [<%016lx>] %pB\n", where, (void *)(where + kaslr_offset()));
> ...
> }
stacktrace depends on CONFIG_PKVM_DISABLE_STAGE2_ON_PANIC already...
>
> Similarly, dump_kernel_instr() reads the faulting instruction directly from
> kernel memory, which could trigger a stage-2 data abort if the page is not
> present in the lazy host stage-2 page tables:
>
> arch/arm64/kernel/traps.c:dump_kernel_instr() {
> ...
> bad = aarch64_insn_read(&((u32 *)kaddr)[i], &val);
> ...
> }
We actively maps .hyp.text in the host stage-2 at boot.
>
> If a panic occurs while the host stage-2 lock is held, won't these
> unconditional calls still trigger the stage-2 fault and deadlock that
> this patch is trying to avoid?
>
> Should these operations also be gated by nvhe_hyp_panic_host_s2_disabled()?
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260803093906.3531699-1-vdonnefort@google.com?part=1
--
Vincent
next prev parent reply other threads:[~2026-08-03 9:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 9:39 [PATCH v2] KVM: arm64: Drop %pB on nVHE panic when stage-2 is active Vincent Donnefort
2026-08-03 9:50 ` sashiko-bot
2026-08-03 9:53 ` Vincent Donnefort [this message]
2026-08-13 6:49 ` Oliver Upton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anBk9amSO_MuXY-h@google.com \
--to=vdonnefort@google.com \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox