Re: [PATCH] kvm: cleanup CR8 handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avi Kivity wrote:
On 12/08/2010 01:27 PM, Andre Przywara wrote:
The handling of CR8 writes in KVM is currently somewhat cumbersome.
This patch makes it look like the other CR register handlers
and fixes a possible issue in VMX, where the RIP would be incremented
despite an injected #GP.

  unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu)
@@ -4104,7 +4098,7 @@ static int emulator_set_cr(int cr, unsigned long val, struct kvm_vcpu *vcpu)
  		res = kvm_set_cr4(vcpu, mk_cr_64(kvm_read_cr4(vcpu), val));
  		break;
  	case 8:
-		res = __kvm_set_cr8(vcpu, val&  0xfUL);
+		res = kvm_set_cr8(vcpu, val);
  		break;
  	default:
  		vcpu_printf(vcpu, "%s: unexpected cr %u\n", __func__, cr);

Why drop the mask?
Because it is checked in kvm_set_cr8 itself. If it is wrong, the caller should get a #GP as described in the manual. By masking this out we would never deliver the #GP to the guest.

Regards,
Andre.

--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 448-3567-12

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux