Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp112172iof; Sun, 5 Jun 2022 22:45:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQUF2GbIH2d6IIutFG379MFJrDUZH7RwYvJDOBP1TSC5iwubDPDOpwaGEBCQIM791Kvj+0 X-Received: by 2002:a17:90b:4c0f:b0:1e6:9e44:edcb with SMTP id na15-20020a17090b4c0f00b001e69e44edcbmr20896842pjb.2.1654494314701; Sun, 05 Jun 2022 22:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654494314; cv=none; d=google.com; s=arc-20160816; b=WVMhOy8e6YGvtPi+d7Oq2yDYTte2A8YHijFopltFzLj4L/nJ2qV7DIau4wcBCZu85k zXxsydTCLKWrhuWbVglRRoerHL1Wcgh/54nY19xCf6lvF8ciNkiSBZYsmkGd9YxWSr5B kv9sSubcJC2hOi4rPIMOcjnBhjLpjoYNNohKzbSB92TIAbPUl8O0FMy1oY/jkMOLC89+ 1WwrlgVY1LvwdHATyoBIbrOXxINS/EMyQl+plkSD2sQ/WCM4v3bUgXPeMJiNAxhHKADI 23JYKLc0r8lsIZHeJWyFtf5+boqplhufWpi955TCctjofXN2zpRXcTiUkmrmwdf63CeA Uf0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V+EiqnbbBtuSLoxA0bmuLtNQMVFjzU0hP4UGgly5XE0=; b=wGzYfhfEi35HM4CKtDQODhcSsR8njpWCn+6on1OcV/5lZCa0khiQA6sdnhbjjleDJc vDVApi+ETls8+JdOfPI5kWcq7CTewNSgPbs+fqyXh4epCs/ub+7a0XWZKIIuGbpArepx OPiRGCGe//CmdbSFL9+KpP453W0ytqpdNoYQiUrJGJggDLZ0cY/5pjyjhwYHvb7ecRG0 wFNmh2b5Uyoy9rQcXvWocql1F8yRbJNTpwyRFpyOdrIwDLih8t2sWyM6+ynEAjqqxU3C M4W0gjLUWNoe1RTS3HXC/FW0wgj0TbiAu/aP3qsKx+Jo+zgCDeJ5lRdnU/s84uMbJkyu ABDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gRtcUx1f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s25-20020a639e19000000b003aa90e6d50bsi21423446pgd.45.2022.06.05.22.45.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 22:45:14 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gRtcUx1f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 724C195DE7; Sun, 5 Jun 2022 21:35:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347108AbiFCSPV (ORCPT + 99 others); Fri, 3 Jun 2022 14:15:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346808AbiFCSAf (ORCPT ); Fri, 3 Jun 2022 14:00:35 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4922712631; Fri, 3 Jun 2022 10:56:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 0C043CE233B; Fri, 3 Jun 2022 17:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F41EC385A9; Fri, 3 Jun 2022 17:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654279006; bh=TQMi84fPYBbRRevC3hnf7QvIdSkLuhB46VbI3kQbPvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gRtcUx1ffKSdECKDabZ86nJy5TUp56Rg6wsCx7jhW7zfuhKj2F79LHdPQki+TcUqu hivRIgkpoZoAhFIIZMV3tDecL0p2w9uQwfHGiryDZwIg8eXvkhFtLwRjQustkqpPX+ lyhiZ1R/6zS2wqlRyVCNyG395U97rB9qQxZEqb1Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Sean Christopherson , Vitaly Kuznetsov , Paolo Bonzini Subject: [PATCH 5.18 22/67] KVM: x86: fix typo in __try_cmpxchg_user causing non-atomicness Date: Fri, 3 Jun 2022 19:43:23 +0200 Message-Id: <20220603173821.365331799@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603173820.731531504@linuxfoundation.org> References: <20220603173820.731531504@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Levitsky commit 33fbe6befa622c082f7d417896832856814bdde0 upstream. This shows up as a TDP MMU leak when running nested. Non-working cmpxchg on L0 relies makes L1 install two different shadow pages under same spte, and one of them is leaked. Fixes: 1c2361f667f36 ("KVM: x86: Use __try_cmpxchg_user() to emulate atomic accesses") Signed-off-by: Maxim Levitsky Message-Id: <20220512101420.306759-1-mlevitsk@redhat.com> Reviewed-by: Sean Christopherson Reviewed-by: Vitaly Kuznetsov Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7268,7 +7268,7 @@ static int emulator_cmpxchg_emulated(str goto emul_write; hva = kvm_vcpu_gfn_to_hva(vcpu, gpa_to_gfn(gpa)); - if (kvm_is_error_hva(addr)) + if (kvm_is_error_hva(hva)) goto emul_write; hva += offset_in_page(gpa);