Re: userfaultfd: two-step UFFDIO_API always gives -EINVAL

From: stsp
Date: Tue Nov 26 2024 - 02:32:48 EST


25.11.2024 21:44, Muhammad Usama Anjum пишет:
The UFFD_FEATURE_WP_ASYNC was designed for exactly this case.
The IOCTL will return you the modified pages. An example of usage
can be found in selftest/mm/pagemap_ioctl.c.
Thank you!
I studied the examples.
They are quite clear and good
for copy/pasting purposes.

I had yet another "problem":
I tried to create the usefaultfd,
then register the API and fork()
the process. In child I do UFFDIO_REGISTER,
but the parent can't see that.
So instead of copy by fork, I
had to use SCM_RIGHTS.
Is this expected, or should it
work fine with forked fd? That
would be a bit simpler than to
apply to SCM_RIGHTS tricks.