From: sashiko-bot@kernel.org
To: "Tian Zheng" <zhengtian10@huawei.com>
Cc: "Marc Zyngier" <maz@kernel.org>,
"Oliver Upton" <oupton@kernel.org>,
kvmarm@lists.linux.dev, kvm@vger.kernel.org
Subject: Re: [PATCH v5 09/15] KVM: arm64: Handle HDBSS faults
Date: Tue, 29 Sep 2026 10:53:48 +0000 [thread overview]
Message-ID: <20260929105348.E3CB21F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929103655.85107-10-zhengtian10@huawei.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] arm64: KVM checks DABT-specific HDBSSF bit on Instruction Aborts
- [High] KVM: guest-reachable WARN_ON_ONCE assertions in HDBSS fault handler
--
commit 93c9cd523cd96ee876cb40ad4d3ecad32cc8aeff
Author: Eillon <yezhenyu2@huawei.com>
KVM: arm64: Handle HDBSS faults
This commit introduces handling for hardware stopped promoting writable-clean
descriptors, which raises a stage-2 Permission fault with ESR_EL2.ISS2.HDBSSF.
It dispatches these from kvm_handle_guest_abort() via a new helper to clear
the fault and report -EFAULT.
> diff --git a/arch/arm64/kvm/dirty_bit.c b/arch/arm64/kvm/dirty_bit.c
> index be0d12555c848..893a8c4248bcc 100644
> --- a/arch/arm64/kvm/dirty_bit.c
> +++ b/arch/arm64/kvm/dirty_bit.c
[ ... ]
> +int kvm_handle_hdbss_fault(struct kvm_vcpu *vcpu)
> +{
> + u64 prod;
> + u64 fsc;
> +
> + if (WARN_ON_ONCE(!system_supports_hdbss()))
> + return -EFAULT;
> +
> + if (WARN_ON_ONCE(!vcpu_hdbss_enabled(vcpu)))
> + return -EFAULT;
[Severity: High]
Are these WARN_ON_ONCE assertions safe to expose on a guest-reachable path?
If a guest manages to inadvertently route execution here (for instance, via
an Instruction Abort matching the HDBSSF bit in its ISS2 field), these
assertions can be triggered directly by the guest.
If the host has panic_on_warn enabled, this could lead to a host kernel
panic and a complete denial of service. Should these be standard error
returns without the warnings instead?
> +
> + prod = read_sysreg_s(SYS_HDBSSPROD_EL2);
> + fsc = FIELD_GET(HDBSSPROD_EL2_FSC_MASK, prod);
> +
> + if (fsc == HDBSSPROD_EL2_FSC_OK)
> + /* Buffer full: the exit path drained it before handle_exit. */
> + return 1;
> +
> + if (fsc != HDBSSPROD_EL2_FSC_ExternalAbort &&
> + fsc != HDBSSPROD_EL2_FSC_GPF)
> + WARN_ONCE(1,
[Severity: High]
Similarly, could this WARN_ONCE be triggered by a guest-driven event?
> + "Unexpected HDBSS fault type, FSC: 0x%llx (prod=0x%llx, vcpu=%d)\n",
> + fsc, prod, vcpu->vcpu_id);
> +
> + /* Clear FSC so hardware dirty state updates can resume. */
> + write_sysreg_s(prod & ~HDBSSPROD_EL2_FSC_MASK, SYS_HDBSSPROD_EL2);
> + return -EFAULT;
> +}
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 85a98d2c23a99..7bf82d65041c8 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
[ ... ]
> @@ -2315,6 +2316,9 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
>
> is_iabt = kvm_vcpu_trap_is_iabt(vcpu);
>
> + if (esr_iss2_is_hdbssf(esr))
> + return kvm_handle_hdbss_fault(vcpu);
> +
[Severity: High]
Does this inadvertently check the HDBSSF bit for Instruction Aborts?
The esr_iss2_is_hdbssf() helper in arch/arm64/include/asm/esr.h extracts
the ISS2 bit without verifying the Exception Class. Because the ISS layout
is per-EC, an Instruction Abort's ISS2 field might coincidentally have this
bit set for an entirely unrelated reason.
If that happens, a valid Instruction Abort would be misidentified as a
HDBSS fault, routing execution into kvm_handle_hdbss_fault() and causing
guest breakage. Should this check be gated by !is_iabt or a specific
Exception Class check?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260929103655.85107-1-zhengtian10@huawei.com?part=9
next prev parent reply other threads:[~2026-09-29 10:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 10:36 [PATCH v5 00/15] KVM: arm64: FEAT_HDBSS support for stage-2 dirty tracking Tian Zheng
2026-09-29 10:36 ` [PATCH v5 01/15] KVM: arm64: pgtables: Change write bit from S2AP_W to DBM Tian Zheng
2026-09-30 0:25 ` Oliver Upton
2026-09-30 2:44 ` Tian Zheng
2026-09-29 10:36 ` [PATCH v5 02/15] KVM: arm64: Add KVM_PGTABLE_PROT_DIRTY Tian Zheng
2026-09-30 0:35 ` Oliver Upton
2026-09-30 2:57 ` Tian Zheng
2026-09-29 10:36 ` [PATCH v5 03/15] KVM: arm64: Introduce a dedicated walker for stage2 write-protect Tian Zheng
2026-09-29 10:36 ` [PATCH v5 04/15] KVM: arm64: Add KVM_REQ_RELOAD_STAGE2 Tian Zheng
2026-09-29 10:50 ` sashiko-bot
2026-09-30 1:44 ` Tian Zheng
2026-09-29 10:36 ` [PATCH v5 05/15] KVM: arm64: Harvest stage-2 dirty state into the host folio account Tian Zheng
2026-09-29 10:36 ` [PATCH v5 06/15] KVM: arm64: Add support for FEAT_HDBSS Tian Zheng
2026-09-29 10:36 ` [PATCH v5 07/15] KVM: arm64: Add HDBSS per-vCPU buffer management Tian Zheng
2026-09-29 10:36 ` [PATCH v5 08/15] KVM: arm64: Flush the HDBSS buffer on VM exit Tian Zheng
2026-09-29 10:36 ` [PATCH v5 09/15] KVM: arm64: Handle HDBSS faults Tian Zheng
2026-09-29 10:53 ` sashiko-bot [this message]
2026-09-29 10:36 ` [PATCH v5 10/15] KVM: Add kvm_arch_dirty_ring_size_updated() hook Tian Zheng
2026-09-29 10:52 ` sashiko-bot
2026-09-29 10:36 ` [PATCH v5 11/15] KVM: arm64: Reserve dirty ring space for the HDBSS buffer Tian Zheng
2026-09-29 11:00 ` sashiko-bot
2026-09-29 10:36 ` [PATCH v5 12/15] KVM: arm64: Derive the VM hardware dirty mode from dirty logging Tian Zheng
2026-09-29 11:16 ` sashiko-bot
2026-09-30 8:27 ` Tian Zheng
2026-09-29 10:36 ` [PATCH v5 13/15] KVM: arm64: Add HDBSS buffer size ioctl for dirty-bitmap mode Tian Zheng
2026-09-29 10:36 ` [PATCH v5 14/15] KVM: arm64: Document HDBSS buffer size ioctl Tian Zheng
2026-09-29 11:06 ` sashiko-bot
2026-09-29 10:36 ` [PATCH v5 15/15] KVM: arm64: selftests: Add HDBSS buffer size ioctl interface test Tian Zheng
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=20260929105348.E3CB21F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=oupton@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhengtian10@huawei.com \
/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