From patchwork Mon Feb 10 12:34:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 231808 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable 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 3C0FEC352A3 for ; Mon, 10 Feb 2020 13:10:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 157952070A for ; Mon, 10 Feb 2020 13:10:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581340259; bh=iBJV8z6P+Zf94LXo81DFHALHM43z37b15SOTOjepXZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=n+fAiasjA8ZREuaVAY+iSLtkz2CUohe0U84tv8AM0PCtmFYPRxPBxKjkdEoSg+7B/ r/KXaraTirIRg/IJtUl8sLUGx9rfwmzsB5teh7l0IZY5GCgpRmWOtZEkKdzgH747oA FcbwYrwYSrAHCJGVhfDM1Yo+lXXgnxP9Uj5vDZzs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729312AbgBJMjG (ORCPT ); Mon, 10 Feb 2020 07:39:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:36054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729308AbgBJMjF (ORCPT ); Mon, 10 Feb 2020 07:39:05 -0500 Received: from localhost (unknown [209.37.97.194]) (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 E84AA2080C; Mon, 10 Feb 2020 12:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338345; bh=iBJV8z6P+Zf94LXo81DFHALHM43z37b15SOTOjepXZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r4FlRD0nm+g+Igt0FUrhfIL3WtNOPNkf9JuEdwCnZiA7yYM53DFyz7oAKSEFUaVRv JH9FgGNk/CmCcJ97uZdtz3L+BVIyVKfXvzHuZi/le1s1x8dLsMEia2/8AvK9mwO68t L7o1ifk8OMzkgDTdOkU+jw0ueyd+pHzBdDQwa6gY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liran Alon , Miaohe Lin , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.4 299/309] KVM: nVMX: vmread should not set rflags to specify success in case of #PF Date: Mon, 10 Feb 2020 04:34:15 -0800 Message-Id: <20200210122435.577795320@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122406.106356946@linuxfoundation.org> References: <20200210122406.106356946@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miaohe Lin [ Upstream commit a4d956b9390418623ae5d07933e2679c68b6f83c ] In case writing to vmread destination operand result in a #PF, vmread should not call nested_vmx_succeed() to set rflags to specify success. Similar to as done in VMPTRST (See handle_vmptrst()). Reviewed-by: Liran Alon Signed-off-by: Miaohe Lin Cc: stable@vger.kernel.org Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/vmx/nested.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index d0523741fb037..931d3b5f3acd4 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4663,8 +4663,10 @@ static int handle_vmread(struct kvm_vcpu *vcpu) vmx_instruction_info, true, len, &gva)) return 1; /* _system ok, nested_vmx_check_permission has verified cpl=0 */ - if (kvm_write_guest_virt_system(vcpu, gva, &field_value, len, &e)) + if (kvm_write_guest_virt_system(vcpu, gva, &field_value, len, &e)) { kvm_inject_page_fault(vcpu, &e); + return 1; + } } return nested_vmx_succeed(vcpu);