Skip to content

Commit

Permalink
KVM: Do not incorporate page offset into gfn=>pfn cache user address
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sean Christopherson authored and Paolo Bonzini committed May 25, 2022
1 parent 3dddf65 commit 3ba2c95
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions virt/kvm/pfncache.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ int kvm_gfn_to_pfn_cache_refresh(struct kvm *kvm, struct gfn_to_pfn_cache *gpc,
ret = -EFAULT;
goto out;
}

gpc->uhva += page_offset;
}

/*
Expand Down

0 comments on commit 3ba2c95

Please sign in to comment.