]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Update page shift if stage 2 block mapping not supported
authorAlexandru Elisei <alexandru.elisei@arm.com>
Tue, 1 Sep 2020 13:33:56 +0000 (14:33 +0100)
committerMarc Zyngier <maz@kernel.org>
Fri, 4 Sep 2020 09:53:48 +0000 (10:53 +0100)
commit066be0958686f2c849bc78a712b5c3dc6d7e6e8e
treeb242c183acca16b689fec6d5b7c2b34e9e593967
parentac0507500adf3800f69d13823d3c4f5145cc1387
KVM: arm64: Update page shift if stage 2 block mapping not supported

Commit 4405434f6ef18 (" KVM: arm/arm64: Signal SIGBUS when stage2 discovers
hwpoison memory") modifies user_mem_abort() to send a SIGBUS signal when
the fault IPA maps to a hwpoisoned page. Commit 3d8e6655d49e ("KVM:
arm/arm64: Re-check VMA on detecting a poisoned page") changed
kvm_send_hwpoison_signal() to use the page shift instead of the VMA because
at that point the code had already released the mmap lock, which means
userspace could have modified the VMA.

If userspace uses hugetlbfs for the VM memory, user_mem_abort() tries to
map the guest fault IPA using block mappings in stage 2. That is not always
possible, if, for example, userspace uses dirty page logging for the VM.
Update the page shift appropriately in those cases when we downgrade the
stage 2 entry from a block mapping to a page.

Fixes: 3d8e6655d49e ("KVM: arm/arm64: Re-check VMA on detecting a poisoned page")
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Link: https://lore.kernel.org/r/20200901133357.52640-2-alexandru.elisei@arm.com
arch/arm64/kvm/mmu.c