[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zd-Icopo09aUmOvT@casper.infradead.org>
Date: Wed, 28 Feb 2024 19:24:34 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: Yosry Ahmed <yosryahmed@...gle.com>,
Sean Christopherson <seanjc@...gle.com>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
michael.roth@....com, isaku.yamahata@...el.com,
thomas.lendacky@....com
Subject: Re: [PATCH 17/21] filemap: add FGP_CREAT_ONLY
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.
Powered by blists - more mailing lists