[patch 44/51] KVM: Make EFER reads safe when EFER does not exist

Greg KH
2009-05-14T23:00:42Z

[-- Attachment #1: kvm-make-efer-reads-safe-when-efer-does-not-exist.patch --]
[-- Type: text/plain, Size: 755 bytes --]

2.6.29-stable review patch. If anyone has any objections, please let us know.

------------------

From: Avi Kivity <avi@redhat.com>

commit e286e86e6d2042d67d09244aa0e05ffef75c9d54 upstream.

Some processors don't have EFER; don't oops if userspace wants us to
read EFER when we check NX.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
arch/x86/kvm/x86.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1075,9 +1075,9 @@ void kvm_arch_vcpu_put(struct kvm_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;
}