OSDN Git Service

KVM: PPC: Book3S HV: Don't do ultravisor calls on systems without ultravisor
authorPaul Mackerras <paulus@ozlabs.org>
Wed, 18 Dec 2019 00:43:06 +0000 (11:43 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Wed, 18 Dec 2019 04:46:34 +0000 (15:46 +1100)
commitd89c69f42bf0fe42d1f52ea9b3dca15b1ade7601
treea1a27270ba9f4cc28303477f42c41433e1221777
parent7d73710d9ca2564f29d291d0b3badc09efdf25e9
KVM: PPC: Book3S HV: Don't do ultravisor calls on systems without ultravisor

Commit 22945688acd4 ("KVM: PPC: Book3S HV: Support reset of secure
guest") added a call to uv_svm_terminate, which is an ultravisor
call, without any check that the guest is a secure guest or even that
the system has an ultravisor.  On a system without an ultravisor,
the ultracall will degenerate to a hypercall, but since we are not
in KVM guest context, the hypercall will get treated as a system
call, which could have random effects depending on what happens to
be in r0, and could also corrupt the current task's kernel stack.
Hence this adds a test for the guest being a secure guest before
doing uv_svm_terminate().

Fixes: 22945688acd4 ("KVM: PPC: Book3S HV: Support reset of secure guest")
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/kvm/book3s_hv.c