]> asedeno.scripts.mit.edu Git - linux.git/commit
KVM: PPC: Book3S: Fix incorrect guest-to-user-translation error handling
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 26 Aug 2019 04:55:20 +0000 (14:55 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 29 Aug 2019 23:40:14 +0000 (09:40 +1000)
commit4f916593be9da38c5cf0d3a5c386b57beb70f422
tree4355102b215462c3f8242b808cf640fa5b7ae113
parentda15c03b047dca891d37b9f4ef9ca14d84a6484f
KVM: PPC: Book3S: Fix incorrect guest-to-user-translation error handling

H_PUT_TCE_INDIRECT handlers receive a page with up to 512 TCEs from
a guest. Although we verify correctness of TCEs before we do anything
with the existing tables, there is a small window when a check in
kvmppc_tce_validate might pass and right after that the guest alters
the page with TCEs which can cause early exit from the handler and
leave srcu_read_lock(&vcpu->kvm->srcu) (virtual mode) or lock_rmap(rmap)
(real mode) locked.

This fixes the bug by jumping to the common exit code with an appropriate
unlock.

Fixes: 121f80ba68f1 ("KVM: PPC: VFIO: Add in-kernel acceleration for VFIO")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190826045520.92153-1-aik@ozlabs.ru
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/kvm/book3s_64_vio_hv.c