Re: [PATCH v10 09/41] KVM: guest_memfd: Filter both shared and private when invalidating

Michael Roth <[email protected]>
Newsgroups org.kernel.vger.kvm,dev.linux.lists.linux-coco,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-trace-kernel,org.kvack.linux-mm
Message-ID <meww2a2uf3yeevsfpicyrlg3hch2x4bsdqv2lsv3vfjxg4qzes@co5eogmhkxrk>
On Wed, Aug 26, 2026 at 12:13:47AM +0800, Xiaoyao Li wrote:
> On 8/20/2026 9:32 AM, Sean Christopherson wrote:
> > And vice versa, a PUNCH_HOLE on a SHARED gmem (if userspace is
> > using an INIT_SHARED gmem for the shared branch of a memslot) could invalidate the
> > PRIVATE mappings (of a different gmem instance).
> 
> I'm wondering now how this could happen.
> 
> the requirement for PUNCH_HOLE on gmem to trigger mapping invalidation is
> the gmem is bound with the memslot. But how can a memslot bound with two
> gmem instances?

I think this is for when userspace uses an mmap'able guest_memfd instance
to handle shared memory, and a 'normal' guest_memfd instance for private
memory. Each instance is bound to the same memslot/GPA range, and
KVM_SET_MEMORY_ATTRIBUTES handles switching between the 2.

-Mike
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.