From patchwork Tue May 25 15:25:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 102224 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 o4PFQDj1012702 for ; Tue, 25 May 2010 15:26:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758758Ab0EYP0K (ORCPT ); Tue, 25 May 2010 11:26:10 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:42667 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757090Ab0EYP0J (ORCPT ); Tue, 25 May 2010 11:26:09 -0400 Received: by wwe15 with SMTP id 15so1470061wwe.19 for ; Tue, 25 May 2010 08:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=UjgIAaiZPWDZikQTzPvP8+u5u6lnxbNUUEXSHywjnb0=; b=aHayd/jhNDsb85T1wpK5A5UplQ4i99BypsRgcJDxSh2nmKjDn7P7+/8U8AaxJ6RGzv 65+PnORk/cHr8cULNcazUcx+bphEu31TyFPIGCC2Af+uXGXSsFaaLXC7Z+lzIy4dKpcS Ou437yGcMrjVPNeKClAVnFKtCwtv6KlUM+Kzs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=e7M30WAqgUvznRD8G9EWlVxpxRRyol1kJXdecBr7+iwQZzVYRJWcCXEMmrcryk9jCE u+oe8AuyDJk6QURjvVBC2XjdnXlkGEh2TGxsvPZuxZiYGirzdg0oy5f/DzS3mfCRFmpL 4z4K6jMD2oSUODhCtsTsDjhPUr1YwjIPDFvRE= Received: by 10.216.89.135 with SMTP id c7mr4831021wef.132.1274801167413; Tue, 25 May 2010 08:26:07 -0700 (PDT) Received: from localhost ([41.239.68.72]) by mx.google.com with ESMTPS id g66sm1685373wej.13.2010.05.25.08.26.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 May 2010 08:26:06 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH v2] VMX: Properly return error to userspace on vmentry failure Date: Tue, 25 May 2010 18:25:57 +0300 Message-Id: <1274801157-5612-1-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 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]); Tue, 25 May 2010 15:26:13 +0000 (UTC) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 99ae513..33aa0cc 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3665,6 +3665,13 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu) if (enable_ept && is_paging(vcpu)) vcpu->arch.cr3 = vmcs_readl(GUEST_CR3); + if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) { + vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; + vcpu->run->fail_entry.hardware_entry_failure_reason + = exit_reason; + return 0; + } + if (unlikely(vmx->fail)) { vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; vcpu->run->fail_entry.hardware_entry_failure_reason