]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
KVM: PPC: Book3S: Fix incorrect guest-to-user-translation error handling
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Tue, 3 Sep 2019 20:16:27 +0000 (16:16 -0400)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
commitd9febbae794122d3020f796a0661981677bba582
tree52c212ff59d1acee35a450ea3c2c93086b33c179
parentdcec0eee49a51f1341878ac53ed5c15e56d83d2b
KVM: PPC: Book3S: Fix incorrect guest-to-user-translation error handling

BugLink: https://bugs.launchpad.net/bugs/1843338
[ Upstream commit ddfd151f3def9258397fcde7a372205a2d661903 ]

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 of TCEs, causing an early exit from the handler and leaving
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.

Cc: stable@vger.kernel.org # v4.11+
Fixes: 121f80ba68f1 ("KVM: PPC: VFIO: Add in-kernel acceleration for VFIO")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/powerpc/kvm/book3s_64_vio.c
arch/powerpc/kvm/book3s_64_vio_hv.c