[PATCH 0/3] KVM: arm64: nv: Fix AT emulation for nested virtualization
Dan Carpenter
dan at pereq.eu
Fri Nov 27 07:31:37 PST 2026
This series fixes 3 issues found by our formal analysis at Pereq.
* VMs were potentially using the TCR2 bits which weren't intended for
them.
* It turns out that guests could write to the TCR2 bits even when those
bits are "hidden".
* The VMID wasn't handled correctly. Roll over could happen before or
during the AT execution leading to invalid results.
Changes in v3:
In v2 patches 2 and 3 added traps to prevent writes to hidden TCR2
bits. Marc didn't like this approach and to be honest, the patch
had other issues as well. Marc suggested that we load load
PIR/PIRE0/POR unconditionally instead and that's the approach here
in patch 2.
The other thing is that I have been trying to improve my review
process so I ended up fixing a bug handling POR_EL0 in __kvm_at_s1e01_fast().
That fix is now merged into patch 1 since it feels very related and
it gets backported to the same kernel.
Changes in v2:
1) Sashiko pointed out that we need to restore the original TCR2
bits at the end of the AT command.
2) Clean up based on Marc's feedback.
3) Trap the writes to the TCR2 registers (normal and nested)
Signed-off-by: Dan Carpenter <dan at pereq.eu>
---
Dan Carpenter (3):
KVM: arm64: nv: Fix AT emulation for TCR2_EL1
KVM: arm64: Load no-access permissions when S1PIE or S1POE is hidden
KVM: arm64: nv: Update the shadow MMU's VMID for AT emulation
arch/arm64/kvm/at.c | 61 ++++++++++++++++++++++++++++--
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 40 +++++++++++++++-----
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 15 +++++---
3 files changed, 97 insertions(+), 19 deletions(-)
---
base-commit: 5a7235e9adff42aa043ac9473dbeb0354dca0967
change-id: 20261127-nv-tcr2-v3-53ec5459333a
Best regards,
--
Dan Carpenter <dan at pereq.eu>
More information about the linux-arm-kernel
mailing list