KVM: Make EFER reads safe when EFER does not exist
authorAvi Kivity <avi@redhat.com>
Sun, 3 May 2009 15:50:55 +0000 (18:50 +0300)
committerAvi Kivity <avi@redhat.com>
Mon, 11 May 2009 08:19:00 +0000 (11:19 +0300)
Some processors don't have EFER; don't oops if userspace wants us to
read EFER when we check NX.

Cc: stable@kernel.org
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index 834a7bf25e4888c7df71800de56ee388c607cc8e..49079a46687b740f2e91d2bbfbc31c1c5094c22a 100644 (file)
@@ -1121,9 +1121,9 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
 
 static int is_efer_nx(void)
 {
-       u64 efer;
+       unsigned long long efer = 0;
 
-       rdmsrl(MSR_EFER, efer);
+       rdmsrl_safe(MSR_EFER, &efer);
        return efer & EFER_NX;
 }