Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3009152rwb; Mon, 15 Aug 2022 16:04:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR4HmoNg2bgH1XseGlRnYgaSWJaDiBo4wZSsSVL20Tfzr4VKPPjuiXmgZMH12Yq9Zcr0NKf9 X-Received: by 2002:a17:906:6a09:b0:730:e9bc:e243 with SMTP id qw9-20020a1709066a0900b00730e9bce243mr11745783ejc.177.1660604670492; Mon, 15 Aug 2022 16:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660604670; cv=none; d=google.com; s=arc-20160816; b=E2en5cfCAIUkpxZsGlJYtyNEl6L/PxJ6J127eJ9Fxhb6kNSjYNMrabRvVD8LO6N3po t+DSNI6gZRGk7I04J3BYUBkJCy6QsisFNgSR2U6BvMd2ekGEr+iW9ztKDf3n/vVLewG5 gjakaPLmDrK+XQNp+sA4XnVSIZXcrtlipPBxfivncOwW9ti20FlvPwFkXIzISQ4h8I9D FxaPzJwFLwhB0lt0LsWbSFI5hhLLCAN965++Wr6x8yqipv9tlD05F+ZNR/HCjqVzLGl+ S6yETFXDAJdJl2LfMco1XIYznsqVsNZJchUk2YlIwt6Kj8cYDs79SAHlpnfZHhvPUI8E PhcA== 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=Y4UVhsrs0PJpvwHhbXrBR9SIFSN1+jGUtwWkKlaCpRF3mpMRrT/5v1zoACcwE+ro52 /HzEgz7IionWKZWB8j2G9t99T2HkZ3jrLrHweM86Qqo7ycd5p4QK03w4XHSGh+7CWdWu q8tETphjiwYiN+JkZ96a2cUdzJKyog2ahCk4/SrzzJKzcaAi6PGzeiX34w0UAyMDnE1p kMzHYJYjZJcia16pi2IB5XziU/vXLWkE95Q1f1FDAkjluR4Dl8PxcNdCfq16SAUKOydy EEhYheoo+IgaXw1MQYzkthNdtR0IFxpUO7FxHyzwnSRk8jsAE58h4FRXZc2nP9BhKY+Y 5tIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eF9+YqtI; 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 hz5-20020a1709072ce500b00730ed690a72si10253111ejc.630.2022.08.15.16.04.04; Mon, 15 Aug 2022 16:04:30 -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=eF9+YqtI; 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 S244527AbiHOUUR (ORCPT + 99 others); Mon, 15 Aug 2022 16:20:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346233AbiHOULF (ORCPT ); Mon, 15 Aug 2022 16:11:05 -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 73F6AB851; Mon, 15 Aug 2022 11:57:15 -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 2EC36B810A2; Mon, 15 Aug 2022 18:57:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F002C433D6; Mon, 15 Aug 2022 18:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589832; bh=gzYtX3jUM3PkHakrG20VtWROjOwHdudeIMY7TqfKmB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eF9+YqtInlOupS+mxqqmxYFJrNBG5bIZhlwP6ImxI0emnSOle/Nrq0zIYPa6VUhm9 U0ITn0AwismzK8yhE9PPRryQawbLTi0aq7ASQ4MKZjjjFwvwzhyV3dAXjWK2BnNGya DKTFE00FAuPYdBLPK2o2xUWMs7e3eUrCM2OIBDKg= 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.18 0031/1095] KVM: Do not incorporate page offset into gfn=>pfn cache user address Date: Mon, 15 Aug 2022 19:50:30 +0200 Message-Id: <20220815180430.657525381@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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; } /*