From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B2B1C49ED7 for ; Thu, 19 Sep 2019 22:28:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3EE1320640 for ; Thu, 19 Sep 2019 22:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568932122; bh=U9KKBQNOAwHAt0frMmHN8BQcjILp52lI9xWt6dpTVio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DtJt7sulQuz89mmml165zaEBZozxi+b98mMGPZ1DAfOTiAluzzmTwve3IgHdH+kg8 O67G+0mcJKfupASvAGypL0nT8Y9QEfow6vDltm/zu6Q8IwAvQZbaKGNLeV2cJR5jaP qaSHKvCFR/ZHh0IWqDxeptEMr2a78/cUcs7yGWe8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407324AbfISW2l (ORCPT ); Thu, 19 Sep 2019 18:28:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:60574 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406595AbfISWSx (ORCPT ); Thu, 19 Sep 2019 18:18:53 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72C2B217D6; Thu, 19 Sep 2019 22:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931532; bh=U9KKBQNOAwHAt0frMmHN8BQcjILp52lI9xWt6dpTVio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3htAd7lgsKBSQvPgNK1igQjd2TATuzn3sqAN66Sf2/69ZUqWC4wOSgYOZwRNdODP BGZZp6hCYWdHyQTL7tE4/Vm52H0FMprhp7KYGvQSAFxG5wCFJJRlFIYjZUEDyA36YF yYCXEkJPtqgQwFdiqdnm3M1xoiPtNWKlcTy83kgU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Bonzini Subject: [PATCH 4.9 20/74] KVM: nVMX: handle page fault in vmread Date: Fri, 20 Sep 2019 00:03:33 +0200 Message-Id: <20190919214806.593882437@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214800.519074117@linuxfoundation.org> References: <20190919214800.519074117@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paolo Bonzini commit f7eea636c3d505fe6f1d1066234f1aaf7171b681 upstream. The implementation of vmread to memory is still incomplete, as it lacks the ability to do vmread to I/O memory just like vmptrst. Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7639,6 +7639,7 @@ static int handle_vmread(struct kvm_vcpu unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); gva_t gva = 0; + struct x86_exception e; if (!nested_vmx_check_permission(vcpu) || !nested_vmx_check_vmcs12(vcpu)) @@ -7665,8 +7666,10 @@ static int handle_vmread(struct kvm_vcpu vmx_instruction_info, true, &gva)) return 1; /* _system ok, as nested_vmx_check_permission verified cpl=0 */ - kvm_write_guest_virt_system(vcpu, gva, &field_value, - (is_long_mode(vcpu) ? 8 : 4), NULL); + if (kvm_write_guest_virt_system(vcpu, gva, &field_value, + (is_long_mode(vcpu) ? 8 : 4), + NULL)) + kvm_inject_page_fault(vcpu, &e); } nested_vmx_succeed(vcpu);