From patchwork Thu Jan 21 13:28:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 74322 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 o0LDSp2p013866 for ; Thu, 21 Jan 2010 13:28:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752645Ab0AUN2t (ORCPT ); Thu, 21 Jan 2010 08:28:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752412Ab0AUN2t (ORCPT ); Thu, 21 Jan 2010 08:28:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5383 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932116Ab0AUN2s (ORCPT ); Thu, 21 Jan 2010 08:28:48 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0LDSlZ9029342 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 21 Jan 2010 08:28:47 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0LDSk2V013340; Thu, 21 Jan 2010 08:28:46 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 0DA8B1336CF; Thu, 21 Jan 2010 15:28:46 +0200 (IST) Date: Thu, 21 Jan 2010 15:28:46 +0200 From: Gleb Natapov To: avi@redhat.com, mtosatti@redhat.com Cc: kvm@vger.kernel.org, martignlo@gmail.com Subject: [PATCH] fix checking of cr0 validity Message-ID: <20100121132846.GB17813@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 47c6e23..1df691d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -430,12 +430,16 @@ void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) { cr0 |= X86_CR0_ET; - if (cr0 & CR0_RESERVED_BITS) { +#ifdef CONFIG_X86_64 + if (cr0 & 0xffffffff00000000lu) { printk(KERN_DEBUG "set_cr0: 0x%lx #GP, reserved bits 0x%lx\n", cr0, kvm_read_cr0(vcpu)); kvm_inject_gp(vcpu, 0); return; } +#endif + + cr0 &= ~CR0_RESERVED_BITS; if ((cr0 & X86_CR0_NW) && !(cr0 & X86_CR0_CD)) { printk(KERN_DEBUG "set_cr0: #GP, CD == 0 && NW == 1\n");