Skip to content

Commit d89c69f

Browse files
committed
KVM: PPC: Book3S HV: Don't do ultravisor calls on systems without ultravisor
Commit 2294568 ("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: 2294568 ("KVM: PPC: Book3S HV: Support reset of secure guest") Signed-off-by: Paul Mackerras <[email protected]>
1 parent 7d73710 commit d89c69f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/powerpc/kvm/book3s_hv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4983,7 +4983,8 @@ static void kvmppc_core_destroy_vm_hv(struct kvm *kvm)
49834983
if (nesting_enabled(kvm))
49844984
kvmhv_release_all_nested(kvm);
49854985
kvm->arch.process_table = 0;
4986-
uv_svm_terminate(kvm->arch.lpid);
4986+
if (kvm->arch.secure_guest)
4987+
uv_svm_terminate(kvm->arch.lpid);
49874988
kvmhv_set_ptbl_entry(kvm->arch.lpid, 0, 0);
49884989
}
49894990

0 commit comments

Comments
 (0)