Skip to content

Commit

Permalink
KVM: PPC: Book3S HV: Only accept host PVR value for guest PVR
Browse files Browse the repository at this point in the history
Since the guest can read the machine's PVR (Processor Version Register)
directly and see the real value, we should disallow userspace from
setting any value for the guest's PVR other than the real host value.
Therefore this makes kvm_arch_vcpu_set_sregs_hv() check the supplied
PVR value and return an error if it is different from the host value,
which has been put into vcpu->arch.pvr at vcpu creation time.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
  • Loading branch information
paulusmack authored and agraf committed Sep 22, 2014
1 parent b754c73 commit 9333e6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/kvm/book3s_hv.c
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,9 @@ static int kvm_arch_vcpu_ioctl_set_sregs_hv(struct kvm_vcpu *vcpu,
{
int i, j;

kvmppc_set_pvr_hv(vcpu, sregs->pvr);
/* Only accept the same PVR as the host's, since we can't spoof it */
if (sregs->pvr != vcpu->arch.pvr)
return -EINVAL;

j = 0;
for (i = 0; i < vcpu->arch.slb_nr; i++) {
Expand Down

0 comments on commit 9333e6c

Please sign in to comment.