lkml.org 
[lkml]   [2022]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.18 0031/1095] KVM: Do not incorporate page offset into gfn=>pfn cache user address
    Date
    From: Sean Christopherson <seanjc@google.com>

    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 <seanjc@google.com>
    Message-Id: <20220429210025.3293691-6-seanjc@google.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    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;
    }

    /*

    \
     
     \ /
      Last update: 2022-08-15 22:23    [W:4.294 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site