From: sashiko-bot@kernel.org
To: "Steven Price" <steven.price@arm.com>,
kvm@vger.kernel.org, kvmarm@lists.linux.dev
Cc: "Oliver Upton" <oupton@kernel.org>, "Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v4 01/11] KVM: arm64: guest_memfd: Check mmap support when preparing memslot
Date: Mon, 23 Nov 2026 11:04:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-229096@kernel.org> (raw)
In-Reply-To: <20261123104233.95710-2-steven.price@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] KVM: arm64: kvm_arch_prepare_memory_region() rejects non-mmap
guest_memfd
--
commit a0665f8dc612d05686ef019cc8462841573fe88c
Author: Steven Price <steven.price@arm.com>
KVM: arm64: guest_memfd: Check mmap support when preparing memslot
This commit introduces kvm_gmem_slot_supports_mmap() and uses it in
kvm_arch_prepare_memory_region() to require that all guest_memfd-backed
memslots on arm64 come from files created with GUEST_MEMFD_FLAG_MMAP.
> diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c
> index 1db10d8d6db73..2825fccd2a197 100644
> --- a/arch/arm64/kvm/mmu.c
> +++ b/arch/arm64/kvm/mmu.c
> @@ -2839,10 +2839,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
> return -EFAULT;
>
> /*
> - * Only support guest_memfd backed memslots with mappable memory, since
> - * there aren't any CoCo VMs that support only private memory on arm64.
> + * All VMs need mappable guest_memfd memory, as the memslot's HVA may be
> + * used to access shared memory even if guest faults use guest_memfd.
> */
> - if (kvm_slot_has_gmem(new) && !kvm_memslot_is_gmem_only(new))
> + if (kvm_slot_has_gmem(new) && !kvm_gmem_slot_supports_mmap(new))
> return -EINVAL;
>
> /* guest_memfd is incompatible with MTE. */
[Severity: Medium]
As reported by Suzuki K Poulose on v2 [1], should
kvm_arch_prepare_memory_region() drop this guest_memfd check altogether
rather than rejecting memslots backed by a guest_memfd created without
GUEST_MEMFD_FLAG_MMAP?
Both gmem_abort() and realm_gmem_abort() fault in guest_memfd pages via
kvm_gmem_get_pfn() without using new->userspace_addr, and
kvm_arch_prepare_memory_region() does not verify that new->userspace_addr
maps the guest_memfd or any valid VMA. Requiring GUEST_MEMFD_FLAG_MMAP
here fails KVM_SET_USER_MEMORY_REGION2 with -EINVAL for VMs (such as
Realms) that bind private-only guest_memfd instances without allowing host
userspace mmap, and on v3 the guest_memfd maintainer noted that this check
is unnecessary and should be removed rather than exposing
kvm_gmem_slot_supports_mmap().
[1] https://lore.kernel.org/r/26a29420-8d27-4069-bbd5-28692c9e8542@arm.com
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123104233.95710-1-steven.price@arm.com?part=1
next prev parent reply other threads:[~2026-11-23 11:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 10:42 [PATCH v4 00/11] KVM: arm64: CCA: Prepare Realm memory management Steven Price
2026-11-23 10:42 ` [PATCH v4 01/11] KVM: arm64: guest_memfd: Check mmap support when preparing memslot Steven Price
2026-11-23 11:04 ` sashiko-bot [this message]
2026-11-23 10:42 ` [PATCH v4 02/11] KVM: arm64: CCA: Introduce Realms Steven Price
2026-11-23 10:42 ` [PATCH v4 03/11] KVM: arm64: Pass range filter to stage2_unmap_range Steven Price
2026-11-23 10:42 ` [PATCH v4 04/11] KVM: arm64: Dispatch stage-2 destruction by VM flavor Steven Price
2026-11-23 10:42 ` [PATCH v4 05/11] KVM: arm64: CCA: Add basic infrastructure for creating a realm Steven Price
2026-11-23 10:42 ` [PATCH v4 06/11] KVM: arm64: CCA: Destroy RTTs Steven Price
2026-11-23 11:00 ` sashiko-bot
2026-11-23 10:42 ` [PATCH v4 07/11] KVM: arm64: CCA: Add Realm RTT mapping and invalidation helpers Steven Price
2026-11-23 11:12 ` sashiko-bot
2026-11-23 10:42 ` [PATCH v4 08/11] KVM: Allow architectures to reject memslot changes before invalidation Steven Price
2026-11-23 10:42 ` [PATCH v4 09/11] KVM: arm64: CCA: Prevent memslot modifications after Realm creation Steven Price
2026-11-23 10:42 ` [PATCH v4 10/11] KVM: arm64: CCA: Support runtime faulting of memory Steven Price
2026-11-23 11:14 ` sashiko-bot
2026-11-23 10:42 ` [PATCH v4 11/11] KVM: arm64: CCA: Add Realm stage-2 MMU operations Steven Price
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=sashiko-outbox-229096@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=steven.price@arm.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