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 v6 08/11] KVM: arm64: CCA: Advertise private memory support for Realms
Date: Fri, 04 Dec 2026 12:23:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-249783@kernel.org> (raw)
In-Reply-To: <20261204115725.45272-9-steven.price@arm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] KVM: arm64: gmem_in_place_conversion bypasses non-Realm gmem
guards
--
commit 2c356668c26ea5656ad67c30240060dbb5dec9b6
Author: Steven Price <steven.price@arm.com>
KVM: arm64: CCA: Advertise private memory support for Realms
This commit defines kvm_arch_has_private_mem() to identify Realm VMs as
supporting private memory, which also enables gmem_in_place_conversion on
arm64.
> diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
> index 3ddeddfacd062..55673d08e3ebc 100644
> --- a/arch/arm64/include/asm/kvm_host.h
> +++ b/arch/arm64/include/asm/kvm_host.h
> @@ -1607,6 +1607,8 @@ struct kvm *kvm_arch_alloc_vm(void);
>
> #define kvm_vm_is_realm(kvm) ((kvm)->arch.vm_flavor == VM_REALM)
>
> +#define kvm_arch_has_private_mem(kvm) kvm_vm_is_realm(kvm)
> +
> #define kvm_has_mte(kvm) \
> (system_supports_mte() && \
> test_bit(KVM_ARCH_FLAG_MTE_ENABLED, &(kvm)->arch.flags))
[Severity: Medium]
Does enabling gmem_in_place_conversion bypass the non-Realm guest_memfd
guard in kvm_arch_prepare_memory_region() and allow non-Realm VMs to fault
private guest_memfd pages?
Defining kvm_arch_has_private_mem() makes gmem_in_place_conversion true
for all arm64 VMs, so kvm_gmem_prepare_memory_region() unconditionally
sets KVM_MEMSLOT_GMEM_ONLY before kvm_arch_prepare_memory_region() runs.
The !kvm_memslot_is_gmem_only(new) check there becomes dead code.
Binding a non-mappable guest_memfd (flags == 0, initialized as private)
to a non-Realm VM now succeeds instead of returning -EINVAL.
On a fault, neither gmem_abort() nor kvm_translate_vncr() checks
kvm_is_private_gfn() before calling kvm_gmem_get_pfn(). The VM therefore
silently maps KVM_MEMORY_ATTRIBUTE_PRIVATE pages into stage-2 instead of
exiting with KVM_EXIT_MEMORY_FAULT.
Should kvm_arch_prepare_memory_region() still reject non-mappable
guest_memfd slots on non-Realm VMs, and should gmem_abort() and
kvm_translate_vncr() check kvm_is_private_gfn()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204115725.45272-1-steven.price@arm.com?part=8
next prev parent reply other threads:[~2026-12-04 12:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 11:57 [PATCH v6 00/11] KVM: arm64: CCA: Prepare Realm memory management Steven Price
2026-12-04 11:57 ` [PATCH v6 01/11] KVM: arm64: CCA: Introduce Realms Steven Price
2026-12-04 16:07 ` Kohei Enju
2026-12-04 17:05 ` Steven Price
2026-12-04 11:57 ` [PATCH v6 02/11] KVM: arm64: Pass range filter to stage2_unmap_range Steven Price
2026-12-04 11:57 ` [PATCH v6 03/11] KVM: arm64: Dispatch stage-2 destruction by VM flavor Steven Price
2026-12-04 11:57 ` [PATCH v6 04/11] KVM: arm64: CCA: Add basic infrastructure for creating a realm Steven Price
2026-12-04 12:15 ` sashiko-bot
2026-12-04 11:57 ` [PATCH v6 05/11] KVM: arm64: CCA: Add Realm RTT mapping and invalidation helpers Steven Price
2026-12-04 12:28 ` sashiko-bot
2026-12-04 11:57 ` [PATCH v6 06/11] KVM: arm64: CCA: Destroy RTTs Steven Price
2026-12-04 12:28 ` sashiko-bot
2026-12-04 11:57 ` [PATCH v6 07/11] KVM: arm64: CCA: Restrict Realm memslots to the lower IPA half Steven Price
2026-12-04 15:48 ` Kohei Enju
2026-12-04 16:27 ` Steven Price
2026-12-04 11:57 ` [PATCH v6 08/11] KVM: arm64: CCA: Advertise private memory support for Realms Steven Price
2026-12-04 12:23 ` sashiko-bot [this message]
2026-12-04 11:57 ` [PATCH v6 09/11] KVM: arm64: Select protected VM behaviour by VM flavour Steven Price
2026-12-04 13:21 ` Fuad Tabba
2026-12-04 11:57 ` [PATCH v6 10/11] KVM: arm64: CCA: Support runtime faulting of memory Steven Price
2026-12-04 12:39 ` sashiko-bot
2026-12-04 15:32 ` Kohei Enju
2026-12-04 16:27 ` Steven Price
2026-12-04 11:57 ` [PATCH v6 11/11] KVM: arm64: CCA: Add Realm stage-2 MMU operations Steven Price
2026-12-04 12:44 ` sashiko-bot
2026-12-04 16:30 ` [PATCH v6 00/11] KVM: arm64: CCA: Prepare Realm memory management Kohei Enju
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-249783@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