[PATCH v2 0/2] KVM: arm64: nv: Fix stale and duplicate guest S2 tracking entries

From: Colton Lewis

Date: Mon Nov 23 2026 - 18:27:07 EST


When an L1 guest issues TLBI IPAS2E1 with a TTL hint smaller than the
actual mapping, KVM clears the entire block from the shadow stage-2
page table while leaving the stale tracking entry in guest_s2_mappings.
Patch 1 drops undersized TTL hints in compute_tlb_inval_range() and
falls through to the unhinted path so the unmap and tracking removal
cover the same range. This follows Marc's suggestion [2] on Dan
Carpenter's sub-page TTL patch [1] (which Patch 1 overlaps with and
subsumes), fixing WARN_ON(size & ~PAGE_MASK) on 16kB/64kB hosts as well.

Patch 2 avoids inserting identical duplicate entries in
kvm_record_guest_s2_mapping().

Tool-generated content:
- Initial bug discovery: automated LLM-assisted audit of the arm64
nested stage-2 tracking code.
- Patch and text drafting: interactive Gemini session (patches, commit
messages, and cover letter).

Changes since v1:
- Drop the kvm_remove_guest_s2_mappings() change; discard undersized TTL
hints in compute_tlb_inval_range() and fall through to the unhinted
path (Marc Zyngier).
- Split duplicate suppression in kvm_record_guest_s2_mapping() into a
separate patch, call kfree() under guard(spinlock), and drop the Fixes
tag (Wei-Lin Chang).
- Rewrite the commit messages and cover letter.

Link to v1: https://lore.kernel.org/r/20261119185105.626343-1-coltonlewis@xxxxxxxxxx
[1] https://lore.kernel.org/r/20261123-inval_range-v1-1-815e15797089@xxxxxxxx
[2] https://lore.kernel.org/r/86h5h7zn5a.wl-maz@xxxxxxxxxx

Colton Lewis (2):
KVM: arm64: nv: Discard undersized TTL hints in
compute_tlb_inval_range()
KVM: arm64: nv: Avoid duplicate guest stage-2 mapping entries

arch/arm64/kvm/nested.c | 105 ++++++++++++++++++++++++++++++++--------
1 file changed, 84 insertions(+), 21 deletions(-)


base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
--
2.56.1.839.g22a8290db9-goog