From: Yan Zhao <yan.y.zhao@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
David Hildenbrand <david@kernel.org>, <kvm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Vishal Annapurve <vannapurve@google.com>
Subject: Re: [PATCH v2] KVM: guest_memfd: Elaborate on how release() vs. get_pfn() is safe against UAF
Date: Tue, 22 Sep 2026 11:47:10 +0800 [thread overview]
Message-ID: <arH6Poitg29eapcM@yzhao56-desk.sh.intel.com> (raw)
In-Reply-To: <arE0mEJaW44HA39e@google.com>
On Mon, Sep 21, 2026 at 06:43:52AM -0700, Sean Christopherson wrote:
> On Mon, Sep 21, 2026, Sean Christopherson wrote:
> > On Sun, Sep 20, 2026, Yan Zhao wrote:
> > > On Wed, Aug 26, 2026 at 09:56:47AM -0700, Sean Christopherson wrote:
> > > Do we need to update the code comment in __kvm_gmem_unbind() from
> > > /*
> > > * synchronize_srcu(&kvm->srcu) ensured that kvm_gmem_get_pfn()
> > > * cannot see this memslot.
> > > */
> > > to
> > > /*
> > > * synchronize_srcu_expedited() in kvm_swap_active_memslots() ensured
> > > * that kvm_gmem_get_pfn() cannot see this memslot.
> > > */
> > >
> > > to align with the above comment.
> >
> > How about this? Because the "rule" is that kvm_gmem_unbind() can only be called
> > on a memslot that is unreachable, either by synchronizing SRCU after uninstalling
> > the memslot *or* because the memslot was never installed. Simply stating that
> > synchronize_srcu_expedited() makes everything safe isn't the whole story, as it's
> > specifically synchronzing after removing/deleting/deactivating the slot that
> > makes this safe.
> >
> > /*
> > * Note, the caller is responsible for ensuring the slot is unreachable
> > * before unbinding, e.g. by synchronizing SRCU after deleting the slot.
> > */
>
> Hmm, though it's probably a good idea to preserve the connection to kvm_gmem_get_pfn():
>
> /*
> * Note, the caller is responsible for ensuring the slot is unreachable
> * before unbinding, e.g. by synchronizing SRCU after deleting the slot,
> * to guarantee kvm_gmem_get_pfn() can't see the slot+file.
> */
LGTM.
next prev parent reply other threads:[~2026-09-22 3:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 16:56 Sean Christopherson
2026-09-20 12:55 ` Yan Zhao
2026-09-21 13:40 ` Sean Christopherson
2026-09-21 13:43 ` Sean Christopherson
2026-09-22 3:47 ` Yan Zhao [this message]
2026-09-22 3:45 ` Yan Zhao
2026-09-22 14:22 ` Sean Christopherson
2026-09-23 5:01 ` Yan Zhao
2026-09-24 21:51 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=arH6Poitg29eapcM@yzhao56-desk.sh.intel.com \
--to=yan.y.zhao@intel.com \
--cc=david@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vannapurve@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®