Re: [RFC PATCH 0/5] KVM: guest_memfd: support for uffd missing
From: Peter Xu
Date: Wed Mar 12 2025 - 15:32:46 EST
On Wed, Mar 12, 2025 at 05:07:25PM +0000, Nikita Kalyazin wrote:
> However if MISSING is not registered, the kernel will auto-populate with a
> clear page, ie there is no way to inject custom content from userspace. To
> explain my use case a bit more, the population thread will be trying to copy
> all guest memory proactively, but there will inevitably be cases where a
> page is accessed through pgtables _before_ it gets populated. It is not
> desirable for such access to result in a clear page provided by the kernel.
IMHO populating with a zero page in the page cache is fine. It needs to
make sure all accesses will go via the pgtable, as discussed below in my
previous email [1], then nobody will be able to see the zero page, not
until someone updates the content then follow up with a CONTINUE to install
the pgtable entry.
If there is any way that the page can be accessed without the pgtable
installation, minor faults won't work indeed.
>
> > as long as the content can only be accessed from the pgtable (either via
> > mmap() or GUP on top of it), then afaiu it could work similarly like
> > MISSING faults, because anything trying to access it will be trapped.
[1]
--
Peter Xu