From: sashiko-bot@kernel.org
To: "Fuad Tabba" <fuad.tabba@linux.dev>
Cc: kvmarm@lists.linux.dev, "Marc Zyngier" <maz@kernel.org>,
"Oliver Upton" <oupton@kernel.org>
Subject: Re: [PATCH] KVM: arm64: Validate the SVE vector length in pkvm_vcpu_init_sve()
Date: Tue, 18 Aug 2026 09:43:04 +0000 [thread overview]
Message-ID: <20260818094305.828891F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260818093117.2379344-1-fuad.tabba@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] A fallible memory allocation failure inside `hyp_pin_shared_mem()` triggers a `WARN_ON()`, which results in a fatal hypervisor panic.
--
--- Patch [1]: [PATCH] KVM: arm64: Validate the SVE vector length in pkvm_vcpu_init_sve() ---
commit f011c5300d433db59b3f2b97e822b9e148c39b84
Author: Fuad Tabba <fuad.tabba@linux.dev>
KVM: arm64: Validate the SVE vector length in pkvm_vcpu_init_sve()
This commit updates pkvm_vcpu_init_sve() to validate the host-provided
SVE vector length before deriving its state size. This prevents an invalid
length from reaching the sve_state_size_from_vl() macro and triggering a
fatal EL2 WARN_ON().
> diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c
> --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c
> +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c
[ ... ]
> @@ -460,14 +460,15 @@ static int pkvm_vcpu_init_sve(struct pkvm_hyp_vcpu *hyp_vcpu, struct kvm_vcpu *h
[ ... ]
> + sve_state_size = sve_state_size_from_vl(sve_max_vl);
> +
> ret = hyp_pin_shared_mem(sve_state, sve_state + sve_state_size);
[Severity: Critical]
This is a pre-existing issue, but looking at hyp_pin_shared_mem(), could a
memory allocation failure here trigger a fatal hypervisor panic?
If host userspace repeatedly creates VMs and vCPUs to exhaust the
hypervisor's memory pool, pkvm_create_mappings_locked() can return
-ENOMEM.
Because hyp_pin_shared_mem() wraps this fallible call in a WARN_ON():
arch/arm64/kvm/hyp/nvhe/mem_protect.c:hyp_pin_shared_mem() {
...
for (cur = start; cur < end; cur += PAGE_SIZE) {
p = hyp_virt_to_page(cur);
hyp_page_ref_inc(p);
if (p->refcount == 1)
WARN_ON(pkvm_create_mappings_locked((void *)cur,
(void *)cur + PAGE_SIZE,
PAGE_HYP));
}
...
}
And since WARN_ON() is fatal at EL2, does this allow unprivileged host
userspace to intentionally crash the host system if the allocation fails?
> if (ret)
> goto err;
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260818093117.2379344-1-fuad.tabba@linux.dev?part=1
next prev parent reply other threads:[~2026-08-18 9:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 9:31 [PATCH] KVM: arm64: Validate the SVE vector length in pkvm_vcpu_init_sve() Fuad Tabba
2026-08-18 9:43 ` sashiko-bot [this message]
2026-08-18 10:21 ` Fuad Tabba
2026-08-18 12:51 ` Marc Zyngier
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=20260818094305.828891F000E9@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