Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3023738rwb; Mon, 15 Aug 2022 16:21:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR7CvG3yo1l23NN2DPGarIIcuVGmPl7e2VEHaQ4TmXb+sMBCTs09JuvXw/DwUEISod9h2lnU X-Received: by 2002:a17:907:a40d:b0:733:17c1:a246 with SMTP id sg13-20020a170907a40d00b0073317c1a246mr11785769ejc.132.1660605679924; Mon, 15 Aug 2022 16:21:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605679; cv=none; d=google.com; s=arc-20160816; b=S6L7HPg95JYvIzD/t00hPnA0qZGViy6kRE4h62oVR0G4uwShsf9LEG8rZuAFh7Nf62 LjkWDitzMBW0BCFMhXnD2ZvBVtOp39QYtpFmwPV8IqUFNbVfZYJBWkIsUZkiprn9xn2F 8//CGsr8TwR0RWZU3X1XrZJgj14OalnCB2iONbxGD5Zi2iVBmPt9ZU44VV40FpOFnKGn 8oiHY8fTpCDaiXhjEP3He973ZAwjlCv74eVwEtdsB0uzVOqcoiB5gE3C/xDrN47kqgyQ uAdPwHRmxnmQnJHUkyBvkay1uqCihRaMmWnRsMAhKDDchNa4GdaNxUimGS5fuSECMgzZ IpsA== 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=Adw3Yc3DPOp1j9JV0vKH7UHDPhz48lreKhEN6SzBuLI=; b=PqgTK5nxk3M5WC1537yVkQ4GtSm0l5awcYxTlJOd0f/8OeMgl4ndKgVmYa2bM/NHs1 8JwHAxYzcvHRxEaNJL6MZ3ExiaazfB7Ks2utpcFQRKf+oyFuRvvE5s5j8wEyGKwVtKiA +JW0fo2EnN9GtBU0TGfnI/kvc1Pd93yR+PGmvqJoxS6Z6wwDBoaaRT6wfcTeGMNhLXGg fdgPlL6ILRfTlwSqj2ntJ8luOIXsaZpdTNPWYNI2AnF3RhfiCXrOCqqos2N2uoAYeEJN UHDh1nN06a/vlJIL+G+IKiya+IS7wv7Dkih2BTNfoWw0gruCv/Wyop6SoR6T+S2xwqNv q2Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eK2fZO45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y20-20020a056402271400b0043e16a07ebasi9590416edd.70.2022.08.15.16.20.55; Mon, 15 Aug 2022 16:21:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eK2fZO45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344657AbiHOVxR (ORCPT + 99 others); Mon, 15 Aug 2022 17:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349871AbiHOVsz (ORCPT ); Mon, 15 Aug 2022 17:48:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2842F65D; Mon, 15 Aug 2022 12:32:06 -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 ams.source.kernel.org (Postfix) with ESMTPS id B731EB8107A; Mon, 15 Aug 2022 19:32:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13883C433C1; Mon, 15 Aug 2022 19:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591923; bh=gzYtX3jUM3PkHakrG20VtWROjOwHdudeIMY7TqfKmB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eK2fZO45Fr4D7MoUcA0In4H/wCKXBzGAq5jg1a5dBZSMzV82qJkT2hPvnZBnHFBHN DJzvhOZI1DSmo+d1ZSjzceyNXYNztl2mWijojMABinAuVPS5VmjwITwlJUoUYXYB70 0CLYnH5+yOEEQqnzgE8/lwHKjsR+2IihM6Ss7234= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.19 0031/1157] KVM: Do not incorporate page offset into gfn=>pfn cache user address Date: Mon, 15 Aug 2022 19:49:47 +0200 Message-Id: <20220815180440.683624915@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: Sean Christopherson commit 3ba2c95ea180740b16281fa43a3ee5f47279c0ed upstream. Don't adjust the userspace address in the gfn=>pfn cache by the page offset from the gpa. KVM should never use the user address directly, and all KVM operations that translate a user address to something else require the user address to be page aligned. Ignoring the offset will allow the cache to reuse a gfn=>hva translation in the unlikely event that the page offset of the gpa changes, but the gfn does not. And more importantly, not having to (un)adjust the user address will simplify a future bug fix. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220429210025.3293691-6-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- virt/kvm/pfncache.c | 2 -- 1 file changed, 2 deletions(-) --- a/virt/kvm/pfncache.c +++ b/virt/kvm/pfncache.c @@ -274,8 +274,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct ret = -EFAULT; goto out; } - - gpc->uhva += page_offset; } /*