]> git.baikalelectronics.ru Git - kernel.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)
commit785462c876104c09b3f21402871f8dbb2b4f8247
treed6ac5e7a874dbe33b6532a0e974ead66a59f2b4c
parentfa9b41707a1a33adf186eac42c49b5817128cb6e
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