From patchwork Wed Feb 10 01:53:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 78273 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1A1otma020733 for ; Wed, 10 Feb 2010 01:50:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753864Ab0BJBux (ORCPT ); Tue, 9 Feb 2010 20:50:53 -0500 Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:38968 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753034Ab0BJBux (ORCPT ); Tue, 9 Feb 2010 20:50:53 -0500 Received: from serv2.oss.ntt.co.jp (localhost [127.0.0.1]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id BD245248214; Wed, 10 Feb 2010 10:50:51 +0900 (JST) Received: from serv1.oss.ntt.co.jp (serv1.oss.ntt.co.jp [172.19.0.2]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id AD15B2481C7; Wed, 10 Feb 2010 10:50:51 +0900 (JST) Received: from yshtky3.kern.oss.ntt.co.jp (unknown [172.17.1.159]) by serv1.oss.ntt.co.jp (Postfix) with SMTP id 853D611C098; Wed, 10 Feb 2010 10:50:51 +0900 (JST) Date: Wed, 10 Feb 2010 10:53:39 +0900 From: Takuya Yoshikawa To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH v2 2/8] Fix kvm_load_segment_descriptor()'s fault propagation Message-Id: <20100210105339.8636a8a0.yoshikawa.takuya@oss.ntt.co.jp> In-Reply-To: <20100210104541.e0f1fdd1.yoshikawa.takuya@oss.ntt.co.jp> References: <20100210104541.e0f1fdd1.yoshikawa.takuya@oss.ntt.co.jp> X-Mailer: Sylpheed 2.6.0 (GTK+ 2.16.1; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 10 Feb 2010 01:50:56 +0000 (UTC) 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,