diff options
author | Avi Kivity <avi@redhat.com> | 2012-06-07 10:06:10 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-07-09 07:19:01 -0400 |
commit | f0495f9b9992f80f82b14306946444b287193390 (patch) | |
tree | 407c142b0b1ac05c28962143ef3253b34d9f912c /arch/x86/kvm | |
parent | 510425ff3344df03a1f94bce49e659ae302e0d34 (diff) |
KVM: VMX: Relax check on unusable segment
Some userspace (e.g. QEMU 1.1) munge the d and g bits of segment
descriptors, causing us not to recognize them as unusable segments
with emulate_invalid_guest_state=1. Relax the check by testing for
segment not present (a non-present segment cannot be usable).
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r-- | arch/x86/kvm/vmx.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 486db2f9561b..82ab1fb2683e 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3198,7 +3198,7 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var) | |||
3198 | { | 3198 | { |
3199 | u32 ar; | 3199 | u32 ar; |
3200 | 3200 | ||
3201 | if (var->unusable) | 3201 | if (var->unusable || !var->present) |
3202 | ar = 1 << 16; | 3202 | ar = 1 << 16; |
3203 | else { | 3203 | else { |
3204 | ar = var->type & 15; | 3204 | ar = var->type & 15; |
@@ -3210,8 +3210,6 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var) | |||
3210 | ar |= (var->db & 1) << 14; | 3210 | ar |= (var->db & 1) << 14; |
3211 | ar |= (var->g & 1) << 15; | 3211 | ar |= (var->g & 1) << 15; |
3212 | } | 3212 | } |
3213 | if (ar == 0) /* a 0 value means unusable */ | ||
3214 | ar = AR_UNUSABLE_MASK; | ||
3215 | 3213 | ||
3216 | return ar; | 3214 | return ar; |
3217 | } | 3215 | } |