KVM: arm64: Disable interrupts while walking userspace PTs
authorMarc Zyngier <maz@kernel.org>
Thu, 16 Mar 2023 17:45:45 +0000 (17:45 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 16 Mar 2023 23:42:56 +0000 (23:42 +0000)
commite86fc1a3a3e9b4850fe74d738e3cfcf4297d8bba
tree8410fd952f117ae041367126894dd8e05c9c26a3
parent13ec9308a85702af7c31f3638a2720863848a7f2
KVM: arm64: Disable interrupts while walking userspace PTs

We walk the userspace PTs to discover what mapping size was
used there. However, this can race against the userspace tables
being freed, and we end-up in the weeds.

Thankfully, the mm code is being generous and will IPI us when
doing so. So let's implement our part of the bargain and disable
interrupts around the walk. This ensures that nothing terrible
happens during that time.

We still need to handle the removal of the page tables before
the walk. For that, allow get_user_mapping_size() to return an
error, and make sure this error can be propagated all the way
to the the exit handler.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230316174546.3777507-2-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/mmu.c