diff options
| author | Dan Carpenter <dan@cryspen.com> | 2026-11-10 09:14:20 +0300 |
|---|---|---|
| committer | Marc Zyngier <maz@kernel.org> | 2026-11-11 10:09:04 +0000 |
| commit | 93dc3df29b2a63271b294a1ad0740f7aee24fb59 (patch) | |
| tree | 6697c1dcfca72fd6818e69ca87dda66418480c18 /scripts | |
| parent | e1c5c6db6cc5e0314a773a08a2a7e50021596eee (diff) | |
KVM: arm64: nv: Invalidate whole L1 blocks on TLBI RIPAS2E1
The shadow stage-2 can map one of the L1's stage-2 blocks with several
smaller leaves. This happens when the host backs the memory with
smaller pages, when the memslot is dirty logging, or when the L1 block
size falls between two host block sizes.
When the L1 invalidates part of such a block, handle_ripas2e1is() only
unmaps the requested range, so the shadow leaves for the rest of the
block stay valid. A TLBI must remove every TLB entry for a block it
touches, including the parts outside the range. The L1 does not need
to issue another TLBI before reusing the rest of the block, so the L2
can still reach those pages through the stale shadow entries.
Use compute_tlb_inval_range() in s2_mmu_unmap_range() to find the L1
block size, the same as the IPAS2E1 path does, and widen the range to
whole L1 blocks. The other caller, handle_vmalls12e1is(), unmaps the
whole IPA space, so the widening does not change anything there.
This only affects nested virtualization: the host must be booted with
kvm-arm.mode=nested and the VM must be given a virtual EL2. In such a
VM it breaks the isolation that the L1 hypervisor provides. An L2 can
keep reading and writing pages that the L1 has taken back and reused,
either for itself or for another L2. The host, other VMs and VMs
without nested virtualization are not affected, because the shadow
stage-2 only maps the L1 VM's own memory.
Fixes: 5d476ca57d7d ("KVM: arm64: nv: Add handling of range-based TLBI operations")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan@cryspen.com>
Link: https://patch.msgid.link/6817d113e5f0a9cafe0ce5bc0847276b7f14aacc.1794210561.git.dan@cryspen.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
