This patch makes kvm_load_segment_descriptor() to propagate
faults generated by load_guest_segment_descriptor().

We have confirmed that unless we change x86_emulate_insn() to
handle this propagated faults, this patch has no effect.


Signed-off-by: Takuya Yoshikawa <[email protected]>
---
 arch/x86/kvm/x86.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 38cb488..feed085 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4717,7 +4717,7 @@ static int kvm_load_realmode_segment(struct kvm_vcpu 
*vcpu, u16 selector, int se
                .unusable = 0,
        };
        kvm_x86_ops->set_segment(vcpu, &segvar, seg);
-       return 0;
+       return X86EMUL_CONTINUE;
 }
 
 static int is_vm86_segment(struct kvm_vcpu *vcpu, int seg)
@@ -4741,12 +4741,15 @@ int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, 
u16 selector,
 {
        struct kvm_segment kvm_seg;
        struct desc_struct seg_desc;
+       int ret;
 
        if (is_vm86_segment(vcpu, seg) || !is_protmode(vcpu))
                return kvm_load_realmode_segment(vcpu, selector, seg);
 
-       if (load_guest_segment_descriptor(vcpu, selector, &seg_desc))
-               return 1;
+       ret = load_guest_segment_descriptor(vcpu, selector, &seg_desc);
+       if (ret != X86EMUL_CONTINUE)
+               return ret;
+
        seg_desct_to_kvm_desct(&seg_desc, selector, &kvm_seg);
 
        kvm_check_segment_descriptor(vcpu, seg, selector);
@@ -4763,7 +4766,7 @@ int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, 
u16 selector,
                seg_desc.type |= 1;
                save_guest_segment_descriptor(vcpu, selector, &seg_desc);
        }
-       return 0;
+       return X86EMUL_CONTINUE;
 }
 
 static void save_state_to_tss32(struct kvm_vcpu *vcpu,
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to