Re: [PATCH 17/21] filemap: add FGP_CREAT_ONLY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 28, 2024 at 02:28:45PM +0100, Paolo Bonzini wrote:
> Since you're here: KVM would like to add a ioctl to encrypt and
> install a page into guest_memfd, in preparation for launching an
> encrypted guest. For this API we want to rule out the possibility of
> overwriting a page that is already in the guest_memfd's filemap,
> therefore this API would pass FGP_CREAT_ONLY|FGP_CREAT
> into__filemap_get_folio. Do you think this is bogus...

Would it work to start out by either asserting the memfd is empty of
pages, or by evicting any existing pages?  Both those seem nicer than
starting, realising you've got some unencrypted memory and aborting.

> > This looks bogus to me, and if it's not bogus, it's incomplete.
> 
> ... or if not, what incompleteness can you spot?

The part where we race another caller passing FGP_CREAT_ONLY and one gets
an EEXIST back from filemap_add_folio().  Maybe that's not something
that can happen in your use case, but it's at least semantics that
need documenting.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux