[PATCH] KVM: arm64: nv: Hold mmu_lock when invalidating VNCR SW-TLB before translating

Oliver Upton oliver.upton at linux.dev
Tue May 20 07:44:49 PDT 2025


On Tue, May 20, 2025 at 03:41:16PM +0100, Marc Zyngier wrote:
> When translating a VNCR translation fault, we start by marking the
> current SW-managed TLB as invalid, so that we can populate it
> in place. This is, however, done without the mmu_lock held.
> 
> A consequence of this is that another CPU dealing with TLBI
> emulation can observe a translation still flagged as valid, but
> with invalid walk results (such as pgshift being 0). Bad things
> can result from this, such as a BUG() in pgshift_level_to_ttl().
> 
> Fix it by taking the mmu_lock for write to perform this local
> invalidation, and use invalidate_vncr() instead of open-coding
> the write to the 'valid' flag.
> 
> Fixes: 069a05e535496 ("KVM: arm64: nv: Handle VNCR_EL2-triggered faults")
> Signed-off-by: Marc Zyngier <maz at kernel.org>

Reviewed-by: Oliver Upton <oliver.upton at linux.dev>

Thanks,
Oliver



More information about the linux-arm-kernel mailing list