提交 e286e86e 编写于 作者: A Avi Kivity

KVM: Make EFER reads safe when EFER does not exist

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: NAvi Kivity <avi@redhat.com>
上级 334b8ad7
...@@ -1121,9 +1121,9 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) ...@@ -1121,9 +1121,9 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
static int is_efer_nx(void) 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; return efer & EFER_NX;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册