From patchwork Fri Jun 19 14:30:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223776 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=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 776CEC433E0 for ; Fri, 19 Jun 2020 16:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D90D217BA for ; Fri, 19 Jun 2020 16:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592584048; bh=1A5mgssrvA3C+KZPzFjWGfGOyB9XKTvZZzMVoOXwNnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tfuSCc7+UiMyFkd0PI3af/IiI9iwTmvauwNBYYAPk3oTXfh9lPAkVEZStjPaURpkQ WjDxFMstmKYcNj8jOi3FSh1ZMfwbHZVbBqWu1CsFF1nzFdXjdhklxsjJKyoioHb4PA kNB6xzVGSdSJR0ZqKIr6v/DYujGRd9HVdrN+p5ok= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390043AbgFSQ1W (ORCPT ); Fri, 19 Jun 2020 12:27:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:50992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390025AbgFSO4F (ORCPT ); Fri, 19 Jun 2020 10:56:05 -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 800BC2158C; Fri, 19 Jun 2020 14:56:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578565; bh=1A5mgssrvA3C+KZPzFjWGfGOyB9XKTvZZzMVoOXwNnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zW1N8YuNp+ILdDpnnjo4JQBNzxFgBt3XPwyFb9fLWWTZvQmchyWlYes+m61Gj5hpL 21M2JMM6Oq+TOTQkk3oXgDIfTixvph9NszcePOkfTZbAqV2GTAjys2vUV3teQf8TfG 7DMaT6I3kAtwNnioPohNKQH5C4XvryhlqnMwaJbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 4.19 071/267] KVM: nSVM: fix condition for filtering async PF Date: Fri, 19 Jun 2020 16:30:56 +0200 Message-Id: <20200619141652.304477872@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@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: Paolo Bonzini commit a3535be731c2a343912578465021f50937f7b099 upstream. Async page faults have to be trapped in the host (L1 in this case), since the APF reason was passed from L0 to L1 and stored in the L1 APF data page. This was completely reversed: the page faults were passed to the guest, a L2 hypervisor. Cc: stable@vger.kernel.org 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 @@ -3229,8 +3229,8 @@ static int nested_svm_exit_special(struc return NESTED_EXIT_HOST; break; case SVM_EXIT_EXCP_BASE + PF_VECTOR: - /* When we're shadowing, trap PFs, but not async PF */ - if (!npt_enabled && svm->vcpu.arch.apf.host_apf_reason == 0) + /* Trap async PF even if not shadowing */ + if (!npt_enabled || svm->vcpu.arch.apf.host_apf_reason) return NESTED_EXIT_HOST; break; default: