aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 18:17:41 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-10 18:17:41 -0700
commit64fb6d9aa01a523bcd70f836bf1374dcb22759a9 (patch)
treefb335b128d83be4e6e299cbe4c3265b533d4b330 /arch/x86
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc (diff)
parentKVM: VMX: mark unusable segment as nonpresent (diff)
downloadlinux-dev-64fb6d9aa01a523bcd70f836bf1374dcb22759a9.tar.xz
linux-dev-64fb6d9aa01a523bcd70f836bf1374dcb22759a9.zip
Merge tag 'kvm-3.11-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull more KVM changes from Gleb Natapov: "A fix for a bug that prevents some guests from working on old Intel CPUs and a patch that integrates ARM64 KVM, merged via ARM64 tree, into Kconfig." * tag 'kvm-3.11-2' of git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: VMX: mark unusable segment as nonpresent arm64: KVM: Kconfig integration
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kvm/vmx.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index a7e18551c968..064d0be67ecc 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3404,15 +3404,22 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu,
var->limit = vmx_read_guest_seg_limit(vmx, seg);
var->selector = vmx_read_guest_seg_selector(vmx, seg);
ar = vmx_read_guest_seg_ar(vmx, seg);
+ var->unusable = (ar >> 16) & 1;
var->type = ar & 15;
var->s = (ar >> 4) & 1;
var->dpl = (ar >> 5) & 3;
- var->present = (ar >> 7) & 1;
+ /*
+ * Some userspaces do not preserve unusable property. Since usable
+ * segment has to be present according to VMX spec we can use present
+ * property to amend userspace bug by making unusable segment always
+ * nonpresent. vmx_segment_access_rights() already marks nonpresent
+ * segment as unusable.
+ */
+ var->present = !var->unusable;
var->avl = (ar >> 12) & 1;
var->l = (ar >> 13) & 1;
var->db = (ar >> 14) & 1;
var->g = (ar >> 15) & 1;
- var->unusable = (ar >> 16) & 1;
}
static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg)