From patchwork Wed Feb 10 01:50:34 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takuya Yoshikawa X-Patchwork-Id: 78271 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 o1A1lnRG012564 for ; Wed, 10 Feb 2010 01:47:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753365Ab0BJBrs (ORCPT ); Tue, 9 Feb 2010 20:47:48 -0500 Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:38810 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752046Ab0BJBrr (ORCPT ); Tue, 9 Feb 2010 20:47:47 -0500 Received: from serv2.oss.ntt.co.jp (localhost [127.0.0.1]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id BDA902481C7; Wed, 10 Feb 2010 10:47:46 +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 ACB7D2481C2; Wed, 10 Feb 2010 10:47:46 +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 86FCD11C098; Wed, 10 Feb 2010 10:47:46 +0900 (JST) Date: Wed, 10 Feb 2010 10:50:34 +0900 From: Takuya Yoshikawa To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH v2 1/8] KVM: Fix load_guest_segment_descriptor() to inject page fault Message-Id: <20100210105034.21644f5b.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:47:50 +0000 (UTC) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b2f91b9..38cb488 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4655,6 +4655,7 @@ static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, { struct descriptor_table dtable; u16 index = selector >> 3; + int ret; get_segment_descriptor_dtable(vcpu, selector, &dtable); @@ -4662,7 +4663,11 @@ static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc); return X86EMUL_PROPAGATE_FAULT; } - return kvm_read_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu); + ret = kvm_read_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu); + if (ret == X86EMUL_PROPAGATE_FAULT) + kvm_inject_page_fault(vcpu, dtable.base + index*8, 0); + + return ret; } /* allowed just for 8 bytes segments */