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

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: NAvi Kivity <avi@redhat.com>
上级 510425ff
...@@ -3198,7 +3198,7 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var) ...@@ -3198,7 +3198,7 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var)
{ {
u32 ar; u32 ar;
if (var->unusable) if (var->unusable || !var->present)
ar = 1 << 16; ar = 1 << 16;
else { else {
ar = var->type & 15; ar = var->type & 15;
...@@ -3210,8 +3210,6 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var) ...@@ -3210,8 +3210,6 @@ static u32 vmx_segment_access_rights(struct kvm_segment *var)
ar |= (var->db & 1) << 14; ar |= (var->db & 1) << 14;
ar |= (var->g & 1) << 15; ar |= (var->g & 1) << 15;
} }
if (ar == 0) /* a 0 value means unusable */
ar = AR_UNUSABLE_MASK;
return ar; return ar;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册