[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e4cb19d9cbf1ef00b8b55ad46404a65d3438750.camel@infradead.org>
Date: Wed, 20 Mar 2024 08:20:41 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini
<pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+106a4f72b0474e1d1b33@...kaller.appspotmail.com, Paul Durrant
<paul@....org>
Subject: Re: [PATCH 1/3] KVM: Add helpers to consolidate gfn_to_pfn_cache's
page split check
On Tue, 2024-03-19 at 17:15 -0700, Sean Christopherson wrote:
> Add a helper to check that the incoming length for a gfn_to_pfn_cache is
> valid with respect to the cache's GPA and/or HVA. To avoid activating a
> cache with a bogus GPA, a future fix will fork the page split check in
> the inner refresh path into activate() and the public rerfresh() APIs, at
> which point KVM will check the length in three separate places.
>
> Deliberately keep the "page offset" logic open coded, as the only other
> path that consumes the offset, __kvm_gpc_refresh(), already needs to
> differentiate between GPA-based and HVA-based caches, and it's not obvious
> that using a helper is a net positive in overall code readability.
>
> Note, for GPA-based caches, this has a subtle side effect of using the GPA
> instead of the resolved HVA in the check() path, but that should be a nop
> as the HVA offset is derived from the GPA, i.e. the two offsets are
> identical, barring a KVM bug.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: David Woodhouse <dwmw@...zon.co.uk>
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)
Powered by blists - more mailing lists