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

From: stsp
Date: Mon Nov 25 2024 - 11:15:23 EST


25.11.2024 18:59, Peter Xu пишет:
I agree it's slightly confusing but it's intended. It's like that since
the start, so I think we should still keep the behavior.

The userapp needs to create one extra userfaultfd to detect supported
features in the kernel. To use it after a probe request, you'll need to
close() the fd, redo the userfaultfd syscall to create another fd.
Hi Peter, thanks for info.
Unfortunately man page doesn't
say that. In fact if it did, I won't be
using the second userfaultfd just
for that, anyway. :)

Man page clearly talks about
"the userfaultfd object" (one object)
when mandating the "two-step handshake".
I spent hours of head-scratching
before went looking into the sources,
and even then I was confident the man
page is right: people should always assume
documentation is correct, code is buggy.

Would it be possible to re-document
this part? As all test-cases in kernel
do not use 2-steps - how about just
removing that part from man page?
Suggesting another fd would be strange. :)