]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: arm64: Disable interrupts while walking userspace PTs
authorMarc Zyngier <maz@kernel.org>
Thu, 16 Mar 2023 17:45:45 +0000 (17:45 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2023 10:10:57 +0000 (12:10 +0200)
commite4ca4572de06013c6aeedb44c7fadbeec63fa4e7
treed6ac5e7a874dbe33b6532a0e974ead66a59f2b4c
parent051e660c8185e4c4bee6fb30d796cfe4ae2c345f
KVM: arm64: Disable interrupts while walking userspace PTs

commit e86fc1a3a3e9b4850fe74d738e3cfcf4297d8bba upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kvm/mmu.c