From: Sean Christopherson <seanjc@google.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
David Hildenbrand <david@kernel.org>,
Shivank Garg <shivankg@amd.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH v2] KVM: guest_memfd: take the invalidate lock when unbinding a dying file
Date: Thu, 24 Sep 2026 14:51:57 -0700 [thread overview]
Message-ID: <179028369935.2007941.14069102369239125063.b4-ty@b4> (raw)
In-Reply-To: <20260901-gmem-unbind-fix-v2-1-12febe1d2216@amd.com>
On Tue, 01 Sep 2026 07:20:38 +0000, Shivank Garg wrote:
> kvm_gmem_unbind() takes mapping->invalidate_lock only if the
> get_file_active() succeeds. When the guest_memfd file is dying, its
> reference count is already zero so get_file_active fails and the binding
> is removed without holding the invalidate lock.
>
> kvm_gmem_invalidate_{start,end}() checks f->bindings independently to
> decide whether to begin or end KVM MMU invalidation. So, the bindings
> must therefore remain stable between the two calls. Otherwise, unbind
> can remove a binding after start increments mmu_invalidate_in_progress,
> but before end finds the binding and decrements it.
> Example, unbind race with memory failure:
>
> [...]
Applied to kvm-x86 coco, thanks!
[1/1] KVM: guest_memfd: take the invalidate lock when unbinding a dying file
https://github.com/kvm-x86/linux/commit/0ee2c883b62d
--
https://github.com/kvm-x86/linux/tree/next
prev parent reply other threads:[~2026-09-24 21:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 7:20 Shivank Garg
2026-09-10 8:43 ` David Hildenbrand (Arm)
2026-09-24 21:51 ` Sean Christopherson [this message]
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=179028369935.2007941.14069102369239125063.b4-ty@b4 \
--to=seanjc@google.com \
--cc=david@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sashiko-bot@kernel.org \
--cc=shivankg@amd.com \
--cc=stable@vger.kernel.org \
/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®