summaryrefslogtreecommitdiff
path: root/arch/arm64/kvm/hyp/nvhe/psci-relay.c
diff options
context:
space:
mode:
authorOliver Upton <oliver.upton@linux.dev>2023-06-27 23:54:05 +0000
committerOliver Upton <oliver.upton@linux.dev>2023-07-12 20:10:40 +0000
commitdf6556adf27b7372cfcd97e1c0afb0d516c8279f (patch)
tree8f0da1e0576081ebf5ebae2cab8a272892592bc0 /arch/arm64/kvm/hyp/nvhe/psci-relay.c
parent970dee09b230895fe2230d2b32ad05a2826818c6 (diff)
downloadlwn-df6556adf27b7372cfcd97e1c0afb0d516c8279f.tar.gz
lwn-df6556adf27b7372cfcd97e1c0afb0d516c8279f.zip
KVM: arm64: Correctly handle page aging notifiers for unaligned memslot
Userspace is allowed to select any PAGE_SIZE aligned hva to back guest memory. This is even the case with hugepages, although it is a rather suboptimal configuration as PTE level mappings are used at stage-2. The arm64 page aging handlers have an assumption that the specified range is exactly one page/block of memory, which in the aforementioned case is not necessarily true. All together this leads to the WARN() in kvm_age_gfn() firing. However, the WARN is only part of the issue as the table walkers visit at most a single leaf PTE. For hugepage-backed memory in a memslot that isn't hugepage-aligned, page aging entirely misses accesses to the hugepage beyond the first page in the memslot. Add a new walker dedicated to handling page aging MMU notifiers capable of walking a range of PTEs. Convert kvm(_test)_age_gfn() over to the new walker and drop the WARN that caught the issue in the first place. The implementation of this walker was inspired by the test_clear_young() implementation by Yu Zhao [*], but repurposed to address a bug in the existing aging implementation. Cc: stable@vger.kernel.org # v5.15 Fixes: 056aad67f836 ("kvm: arm/arm64: Rework gpa callback handlers") Link: https://lore.kernel.org/kvmarm/20230526234435.662652-6-yuzhao@google.com/ Co-developed-by: Yu Zhao <yuzhao@google.com> Signed-off-by: Yu Zhao <yuzhao@google.com> Reported-by: Reiji Watanabe <reijiw@google.com> Reviewed-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Shaoqin Huang <shahuang@redhat.com> Link: https://lore.kernel.org/r/20230627235405.4069823-1-oliver.upton@linux.dev Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Diffstat (limited to 'arch/arm64/kvm/hyp/nvhe/psci-relay.c')
0 files changed, 0 insertions, 0 deletions