From: sashiko-bot@kernel.org
To: "Fuad Tabba" <fuad.tabba@linux.dev>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH 2/4] KVM: arm64: Do not clear VM-wide SVE feature on vCPU init failure
Date: Tue, 25 Aug 2026 09:18:16 +0000 [thread overview]
Message-ID: <20260825091816.F361E1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260825085948.1674721-3-fuad.tabba@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Hypervisor DoS via WARN_ON() upon page table allocation failure
--
--- Patch [2]: [PATCH 2/4] KVM: arm64: Do not clear VM-wide SVE feature on vCPU init failure ---
commit 1188c411e2a65143d7371d1038c2752c0f2de6c0
Author: Fuad Tabba <fuad.tabba@linux.dev>
KVM: arm64: Do not clear VM-wide SVE feature on vCPU init failure
pkvm_vcpu_init_sve() clears KVM_ARM_VCPU_SVE in kvm->arch.vcpu_features
when it fails, but vcpu_has_sve() tests KVM_ARCH_FLAG_GUEST_HAS_SVE,
which is left set. Later vCPUs on that VM then skip the SVE setup and
register with a NULL sve_state, which the guest's first FP access hands
to sve_load_state().
Return the error without touching vcpu_features.
> diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> index c31b9d46b8b60..4340b13ee295b 100644
> --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
> +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
[ ... ]
> @@ -462,24 +462,19 @@ static int pkvm_vcpu_init_sve(struct pkvm_hyp_vcpu *hyp_vcpu, struct kvm_vcpu *h
> sve_max_vl = min(READ_ONCE(host_vcpu->arch.sve_max_vl), kvm_host_sve_max_vl);
> sve_state = kern_hyp_va(READ_ONCE(host_vcpu->arch.sve_state));
>
> - if (!sve_vl_valid(sve_max_vl) || !sve_state) {
> - ret = -EINVAL;
> - goto err;
> - }
> + if (!sve_vl_valid(sve_max_vl) || !sve_state)
> + return -EINVAL;
>
> sve_state_size = sve_state_size_from_vl(sve_max_vl);
>
> ret = hyp_pin_shared_mem(sve_state, sve_state + sve_state_size);
> if (ret)
> - goto err;
> + return ret;
[Severity: High]
This is a pre-existing issue, but can the call to hyp_pin_shared_mem()
trigger a hypervisor panic if EL2 memory is exhausted?
Looking at hyp_pin_shared_mem() in arch/arm64/kvm/hyp/nvhe/mem_protect.c,
it wraps the mapping allocation in a WARN_ON:
if (p->refcount == 1)
WARN_ON(pkvm_create_mappings_locked((void *)cur,
(void *)cur + PAGE_SIZE,
PAGE_HYP));
At EL2 under nVHE/pKVM, WARN_ON() expands to a BRK instruction which panics
the hypervisor and brings down the host.
Since host userspace can repeatedly invoke KVM ioctls to create VMs or vCPUs
and exhaust the bounded EL2 memory pool, pkvm_create_mappings_locked()
might eventually fail and return -ENOMEM.
Does this allow an unprivileged host process to hit the WARN_ON and crash
the host system?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260825085948.1674721-1-fuad.tabba@linux.dev?part=2
next prev parent reply other threads:[~2026-08-25 9:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 8:59 [PATCH 0/4] KVM: arm64: pKVM SVE vCPU init fixes Fuad Tabba
2026-08-25 8:59 ` [PATCH 1/4] KVM: arm64: Validate the SVE vector length in pkvm_vcpu_init_sve() Fuad Tabba
2026-08-25 8:59 ` [PATCH 2/4] KVM: arm64: Do not clear VM-wide SVE feature on vCPU init failure Fuad Tabba
2026-08-25 9:18 ` sashiko-bot [this message]
2026-08-25 9:24 ` Fuad Tabba
2026-08-25 8:59 ` [PATCH 3/4] KVM: arm64: Key unpin_host_sve_state() on the state it unpins Fuad Tabba
2026-08-25 8:59 ` [PATCH 4/4] KVM: arm64: Derive GUEST_HAS_SVE from the SVE feature bit at EL2 Fuad Tabba
2026-09-15 22:25 ` [PATCH 0/4] KVM: arm64: pKVM SVE vCPU init fixes 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=20260825091816.F361E1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=fuad.tabba@linux.dev \
--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