From patchwork Wed Jan 20 17:20:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 74098 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o0KHOxhB007230 for ; Wed, 20 Jan 2010 17:24:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753621Ab0ATRY5 (ORCPT ); Wed, 20 Jan 2010 12:24:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753550Ab0ATRY4 (ORCPT ); Wed, 20 Jan 2010 12:24:56 -0500 Received: from goliath.siemens.de ([192.35.17.28]:19627 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752793Ab0ATRYz (ORCPT ); Wed, 20 Jan 2010 12:24:55 -0500 Received: from mail2.siemens.de (localhost [127.0.0.1]) by goliath.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o0KHOcYS001763; Wed, 20 Jan 2010 18:24:38 +0100 Received: from [139.25.109.167] (mchn012c.mchp.siemens.de [139.25.109.167] (may be forged)) by mail2.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o0KHObRr014206; Wed, 20 Jan 2010 18:24:37 +0100 From: Jan Kiszka Subject: [PATCH 1/5] KVM: VMX: Fix exceptions of mov to dr To: Avi Kivity , Marcelo Tosatti Cc: kvm@vger.kernel.org, Jan Kiszka Date: Wed, 20 Jan 2010 18:20:20 +0100 Message-ID: <20100120172020.25118.84906.stgit@mchn012c.ww002.siemens.net> In-Reply-To: <20100120172020.25118.349.stgit@mchn012c.ww002.siemens.net> References: <20100120172020.25118.349.stgit@mchn012c.ww002.siemens.net> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 9f56110..4903b41 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3049,6 +3049,7 @@ static int handle_dr(struct kvm_vcpu *vcpu) unsigned long val; int dr, reg; + /* Do not handle if the CPL > 0, will trigger GP on re-entry */ if (!kvm_require_cpl(vcpu, 0)) return 1; dr = vmcs_readl(GUEST_DR7); @@ -3103,20 +3104,22 @@ static int handle_dr(struct kvm_vcpu *vcpu) vcpu->arch.eff_db[dr] = val; break; case 4 ... 5: - if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) + if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) { kvm_queue_exception(vcpu, UD_VECTOR); + return 1; + } break; case 6: if (val & 0xffffffff00000000ULL) { - kvm_queue_exception(vcpu, GP_VECTOR); - break; + kvm_inject_gp(vcpu, 0); + return 1; } vcpu->arch.dr6 = (val & DR6_VOLATILE) | DR6_FIXED_1; break; case 7: if (val & 0xffffffff00000000ULL) { - kvm_queue_exception(vcpu, GP_VECTOR); - break; + kvm_inject_gp(vcpu, 0); + return 1; } vcpu->arch.dr7 = (val & DR7_VOLATILE) | DR7_FIXED_1; if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) {