Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1066187ybl; Wed, 14 Aug 2019 10:09:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwP48AINwDNHuVVzxs5N5JbDY7AKZDA8mEImBdpqC3JGMXlpIS1YV16d9RNDHKVAXAEQ23N X-Received: by 2002:a17:902:28c9:: with SMTP id f67mr415985plb.19.1565802576352; Wed, 14 Aug 2019 10:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802576; cv=none; d=google.com; s=arc-20160816; b=i3mGoKCRifZ4y2ZI2tbsuCC19pCddihJZZnaVGZ0aoZQ1JUP7OTutTAGWhj7bc6weA oAFSTK4rUV2+SzE/Mddc8IDzrgy2GO3PNsVnq/6kO1NS+pg1Q+DtC9OSt4MW4/e4MJd5 CjTp4yx8RFfG4nt9I3N0Wz1zkK6p0Q0VMtQVBj3usAXSV4zjzvOcboYyoauIsfk18T3X BvtWy3f6CwLh/79iqCILI5AUNpyepj7VQJ7yhzc97RIRaoYo+woz6P94szOY+clXnjWp Ht/tpRpKWGxL8wCVxILcej4CLanfs79Yjw8hkBJKZrYsU49u8ro1Pgmt3mah5URYz5oA ouOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eplo9xeA9X9yF5bxL3yZJJ3p6ELHl5/0QzrnO1hevio=; b=e4HawY3RS2VqkuD6Wrc4e3vPOEBLaSZiySQM+fKXY2EQq26G9lLcb4JrDHGDsjnMfE 5l1QCDB+sffBlmec2vhz7UPGebmO6OTTZambtBA0Kdf6gUL/cLNja0nOUfeZNdIlscRl Akh31FMYlsvjZPVAoOF4wD/AKSMAFn0zjKHhBByVYeQ8sKCA7ZplO4hqEX0hFxZnYs+O Ur5gjTzAa4kHf45z5enzvUGGNGn+Bq9lKlFExNwMwtNipU6zJbgE/pdxUvAb4Zqh2QKz IAhccSxMNoImYL5E/iyLua4iEOXc/MRlTv3M3xNm9O52lFRK9umHe0a/5IqtOTH4Zub2 icoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a3joxSzB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l186si176590pge.215.2019.08.14.10.09.20; Wed, 14 Aug 2019 10:09:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=a3joxSzB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730089AbfHNRIM (ORCPT + 99 others); Wed, 14 Aug 2019 13:08:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:58070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730078AbfHNRIL (ORCPT ); Wed, 14 Aug 2019 13:08:11 -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 22924214DA; Wed, 14 Aug 2019 17:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802490; bh=Xdpt2zY/imvHs4oLSI3d+hTOzAVL2o8s930jvI2QNU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a3joxSzBpv6z2kbF8sm/ceIeoK1K58N+k+EchUCAeVkidY3M8PBq29VCKugTX85Tf 3m0RuNEDSDNblSs7jkbqDllr+ksmvKLPskPiZfoSDQKJToqqOrH9OMqFvelay19JOJ iCTn4X14zakZB/9mbjnE2DwjX2pYoeQyHN3lB+YM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.2 120/144] KVM/nSVM: properly map nested VMCB Date: Wed, 14 Aug 2019 19:01:16 +0200 Message-Id: <20190814165804.946479142@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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: Vitaly Kuznetsov commit 8f38302c0be2d2daf3b40f7d2142ec77e35d209e upstream. Commit 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory") broke nested SVM completely: kvm_vcpu_map()'s second parameter is GFN so vmcb_gpa needs to be converted with gpa_to_gfn(), not the other way around. Fixes: 8c5fbf1a7231 ("KVM/nSVM: Use the new mapping API for mapping guest memory") Signed-off-by: Vitaly Kuznetsov Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/svm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -3290,7 +3290,7 @@ static int nested_svm_vmexit(struct vcpu vmcb->control.exit_int_info_err, KVM_ISA_SVM); - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(svm->nested.vmcb), &map); + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(svm->nested.vmcb), &map); if (rc) { if (rc == -EINVAL) kvm_inject_gp(&svm->vcpu, 0); @@ -3580,7 +3580,7 @@ static bool nested_svm_vmrun(struct vcpu vmcb_gpa = svm->vmcb->save.rax; - rc = kvm_vcpu_map(&svm->vcpu, gfn_to_gpa(vmcb_gpa), &map); + rc = kvm_vcpu_map(&svm->vcpu, gpa_to_gfn(vmcb_gpa), &map); if (rc) { if (rc == -EINVAL) kvm_inject_gp(&svm->vcpu, 0);