From: sashiko-bot@kernel.org
To: "Vincent Donnefort" <vdonnefort@google.com>
Cc: kvmarm@lists.linux.dev, "Oliver Upton" <oupton@kernel.org>,
"Marc Zyngier" <maz@kernel.org>
Subject: Re: [PATCH v5 11/18] KVM: arm64: Filter out non-kernel addresses in kern_hyp_va
Date: Tue, 01 Sep 2026 08:23:32 +0000 [thread overview]
Message-ID: <20260901082333.3CC681F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901080941.997769-12-vdonnefort@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] The patch modifies `__kern_hyp_va()` to return non-TTBR1 pointers unmodified, allowing a malicious host to trick the hypervisor into dereferencing EL2 private memory instead of host memory, completely bypassing pKVM isolation.
--
commit 1e2548767418379244f938decad822feafe32b7b
Author: Vincent Donnefort <vdonnefort@google.com>
KVM: arm64: Filter out non-kernel addresses in kern_hyp_va
This patch updates __kern_hyp_va() to filter out non-kernel addresses based
on PAGE_OFFSET. When protected mode is enabled, it returns the input address
unmodified if it is not a TTBR1 address, aiming to handle addresses from the
hypervisor private range.
> diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
> index 6eae7e7e2a684..d89864c4b961b 100644
> --- a/arch/arm64/include/asm/kvm_mmu.h
> +++ b/arch/arm64/include/asm/kvm_mmu.h
> @@ -126,6 +126,9 @@ static __always_inline unsigned long __kern_hyp_va(unsigned long v)
> * replace the instructions with `nop`s.
> */
> #ifndef __KVM_VHE_HYPERVISOR__
> + if (is_protected_kvm_enabled() && !is_ttbr1_addr(v))
> + return v;
> +
[Severity: Critical]
Does this bypass the mandatory translation for non-TTBR1 addresses, breaking
the guarantee that kern_hyp_va() always restricts the output to the EL2 linear
map?
Since the pKVM threat model treats the host kernel as an adversary against
hypervisor integrity and guest confidentiality, returning the address
unmodified could allow a malicious host to trick the hypervisor into
dereferencing EL2 private memory instead of host memory.
For instance, if a malicious host passes an EL2 private virtual address
(which is below PAGE_OFFSET) to a hypercall, is_ttbr1_addr() would evaluate
to false. The address would be returned unmodified, leading to potential
reads or writes in EL2 private memory.
Could this lead to exploitation in paths such as:
arch/arm64/kvm/hyp/nvhe/hyp-main.c:handle___kvm_tlb_flush_vmid_ipa() {
...
__kvm_tlb_flush_vmid_ipa(kern_hyp_va(mmu), ipa, level);
...
}
In this case, EL2 could read out of bounds from its own private memory.
Similarly, during a hypercall like __KVM_HOST_SMCCC_FUNC___vgic_v5_save_apr:
arch/arm64/kvm/hyp/nvhe/hyp-main.c:handle___vgic_v5_save_apr() {
...
__vgic_v5_save_apr(kern_hyp_va(cpu_if));
...
}
Could this result in __vgic_v5_save_apr() writing hypervisor registers into
EL2 private memory, allowing privilege escalation from EL1 to EL2?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901080941.997769-1-vdonnefort@google.com?part=11
next prev parent reply other threads:[~2026-09-01 8:23 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 8:09 [PATCH v5 00/18] KVM: arm64: Introduce pKVM hypervisor heap allocator Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 01/18] KVM: arm64: Add pkvm_private_va_range_pa Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 02/18] KVM: arm64: Add pkvm_remove_mappings Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 03/18] KVM: arm64: Add pkvm_map_private_va_range Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 04/18] KVM: arm64: Add a heap allocator for the pKVM hyp Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 05/18] KVM: arm64: Allow kvm_hyp_memcache usage outside of stage-2 Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 06/18] KVM: arm64: Add pkvm_hyp_req infrastructure Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 07/18] KVM: arm64: Add PKVM_HYP_REQ_HYP_ALLOC request Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 08/18] KVM: arm64: Add reclaim interface for the pKVM heap alloc Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 09/18] KVM: arm64: Add selftests for the pKVM heap allocator Vincent Donnefort
2026-09-01 8:27 ` sashiko-bot
2026-09-01 8:09 ` [PATCH v5 10/18] KVM: arm64: Add a shrinker for pKVM Vincent Donnefort
2026-09-01 17:30 ` Fuad Tabba
2026-09-01 8:09 ` [PATCH v5 11/18] KVM: arm64: Filter out non-kernel addresses in kern_hyp_va Vincent Donnefort
2026-09-01 8:23 ` sashiko-bot [this message]
2026-09-01 8:09 ` [PATCH v5 12/18] KVM: arm64: Move hyp_vm refcount into the structure Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 13/18] KVM: arm64: Alloc pkvm_hyp_vm using pKVM heap allocator Vincent Donnefort
2026-09-01 8:34 ` sashiko-bot
2026-09-01 8:09 ` [PATCH v5 14/18] KVM: arm64: Alloc pkvm_hyp_vcpu " Vincent Donnefort
2026-09-01 8:34 ` sashiko-bot
2026-09-01 8:09 ` [PATCH v5 15/18] KVM: arm64: Rename vCPU pkvm_memcache to stage2_mc Vincent Donnefort
2026-09-01 17:59 ` Fuad Tabba
2026-09-01 8:09 ` [PATCH v5 16/18] KVM: arm64: Reject hyp trace descriptors with fewer CPUs than hyp_nr_cpus Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 17/18] KVM: arm64: Reject hyp trace descriptors with fewer than 3 pages Vincent Donnefort
2026-09-01 8:09 ` [PATCH v5 18/18] KVM: arm64: Alloc simple_buffer_page using pKVM hyp allocator Vincent Donnefort
2026-09-01 8:35 ` sashiko-bot
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=20260901082333.3CC681F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.