Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vincent Donnefort" <vdonnefort@google.com>
Cc: kvmarm@lists.linux.dev, "Marc Zyngier" <maz@kernel.org>,
	"Oliver Upton" <oupton@kernel.org>
Subject: Re: [PATCH v2 06/18] KVM: arm64: Add topup interface for the pKVM heap allocator
Date: Mon, 06 Jul 2026 18:14:08 +0000	[thread overview]
Message-ID: <20260706181409.0E14F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706175415.2604046-7-vdonnefort@google.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] Unused static function `pkvm_hyp_topup` causes build failure.

Pre-existing issues:
- [High] `__pkvm_host_donate_hyp()` handles allocator failures with `WARN_ON()`, allowing userspace to trivially panic the hypervisor on memory exhaustion.
--

commit ed5697a7fc612043a616e5de99f36c231db3d5dd
Author: Vincent Donnefort <vdonnefort@google.com>

KVM: arm64: Add topup interface for the pKVM heap allocator

Introduce a host HVC interface and a host side helper to allow refilling
the pKVM heap allocator.

> diff --git a/arch/arm64/kvm/pkvm.c b/arch/arm64/kvm/pkvm.c
> index 8324a6a1bc48b..e2c8714e8ccc0 100644
> --- a/arch/arm64/kvm/pkvm.c
> +++ b/arch/arm64/kvm/pkvm.c
[ ... ]
> @@ -85,6 +85,33 @@ void __init kvm_hyp_reserve(void)
>  		 hyp_mem_base);
>  }
>  
> +static int pkvm_hyp_topup(enum pkvm_topup_id id, unsigned long nr_pages)
> +{
> +	struct kvm_hyp_memcache mc;
> +	struct arm_smccc_res res;

[Severity: Low]
Does this cause a build failure with CONFIG_WERROR=y?

This static function is added here but doesn't appear to be called anywhere
in this patch, which usually triggers a -Wunused-function warning. While it
may be used in a subsequent patch in the series, each patch should compile
independently to preserve git bisectability.

[Severity: High]
This is a pre-existing issue, but can host userspace crash the hypervisor
by exhausting EL2 memory?

In arch/arm64/kvm/hyp/nvhe/mem_protect.c:__pkvm_host_donate_hyp():

    WARN_ON(pkvm_create_mappings_locked(virt, virt + size, PAGE_HYP));
    WARN_ON(host_stage2_set_owner_locked(phys, size, PKVM_ID_HYP));

At EL2 in nVHE/pKVM, WARN_ON() expands to BRK and panics the hypervisor. If
pkvm_create_mappings_locked() requires a new page table level and the EL2
buddy allocator is exhausted, it returns -ENOMEM. 

By wrapping this in WARN_ON(), a fallible allocator outcome is transformed
into a fatal EL2 panic. This allows host userspace to trivially panic the
host kernel by exhausting EL2 memory, such as by creating numerous VMs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260706175415.2604046-1-vdonnefort@google.com?part=6

  reply	other threads:[~2026-07-06 18:14 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 17:53 [PATCH v2 00/18] KVM: arm64: Introduce pKVM hypervisor heap allocator Vincent Donnefort
2026-07-06 17:53 ` [PATCH v2 01/18] KVM: arm64: Add __pkvm_private_range_pa Vincent Donnefort
2026-07-14 16:59   ` Fuad Tabba
2026-07-06 17:53 ` [PATCH v2 02/18] KVM: arm64: Add pkvm_remove_mappings Vincent Donnefort
2026-07-14 17:48   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 03/18] KVM: arm64: Add __hyp_allocator_map for the pKVM hyp Vincent Donnefort
2026-07-14 17:53   ` Fuad Tabba
2026-07-15  8:58     ` Vincent Donnefort
2026-07-15  9:24       ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 04/18] KVM: arm64: Add a heap allocator " Vincent Donnefort
2026-07-06 18:12   ` sashiko-bot
2026-07-08 15:54     ` Vincent Donnefort
2026-07-14 18:35   ` Fuad Tabba
2026-07-15 10:59     ` Fuad Tabba
2026-07-20 12:30       ` Vincent Donnefort
2026-07-06 17:54 ` [PATCH v2 05/18] KVM: arm64: Allow kvm_hyp_memcache usage outside of stage-2 Vincent Donnefort
2026-07-14 19:00   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 06/18] KVM: arm64: Add topup interface for the pKVM heap allocator Vincent Donnefort
2026-07-06 18:14   ` sashiko-bot [this message]
2026-07-14 19:28   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 07/18] KVM: arm64: Add pkvm_hyp_req infrastructure Vincent Donnefort
2026-07-14 19:45   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 08/18] KVM: arm64: Handle PKVM_HYP_REQ_HYP_ALLOC request Vincent Donnefort
2026-07-15  6:28   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 09/18] KVM: arm64: Add reclaim interface for the pKVM heap alloc Vincent Donnefort
2026-07-14 20:10   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 10/18] KVM: arm64: Add selftests for the pKVM heap allocator Vincent Donnefort
2026-07-15 11:07   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 11/18] KVM: arm64: Add a shrinker for pKVM Vincent Donnefort
2026-07-06 18:13   ` sashiko-bot
2026-07-15 11:20   ` Fuad Tabba
2026-07-15 11:35     ` Vincent Donnefort
2026-07-06 17:54 ` [PATCH v2 12/18] KVM: arm64: Filter out non-kernel addresses in kern_hyp_va Vincent Donnefort
2026-07-15 11:30   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 13/18] KVM: arm64: Move hyp_vm refcount into the structure Vincent Donnefort
2026-07-15 11:35   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 14/18] KVM: arm64: Use noclear for PGD in __pkvm_init_vm error path Vincent Donnefort
2026-07-06 18:17   ` sashiko-bot
2026-07-15 12:09   ` Fuad Tabba
2026-07-20 13:41     ` Vincent Donnefort
2026-07-06 17:54 ` [PATCH v2 15/18] KVM: arm64: Alloc pkvm_hyp_vm using pKVM heap allocator Vincent Donnefort
2026-07-06 18:24   ` sashiko-bot
2026-07-15 12:33   ` Fuad Tabba
2026-07-15 12:55     ` Vincent Donnefort
2026-07-15 12:58       ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 16/18] KVM: arm64: Alloc pkvm_hyp_vcpu " Vincent Donnefort
2026-07-06 18:24   ` sashiko-bot
2026-07-15 13:12   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 17/18] KVM: arm64: Reject hyp trace descriptors with fewer CPUs than hyp_nr_cpus Vincent Donnefort
2026-07-15 13:54   ` Fuad Tabba
2026-07-06 17:54 ` [PATCH v2 18/18] KVM: arm64: Alloc simple_buffer_page using pKVM hyp allocator Vincent Donnefort
2026-07-06 18:19   ` sashiko-bot
2026-07-15 15:07   ` Fuad Tabba
2026-07-20 14:04     ` Vincent Donnefort
2026-07-20 14:10       ` Vincent Donnefort

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=20260706181409.0E14F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vdonnefort@google.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