lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z0Ssq15MQd3rimBr@x1n>
Date: Mon, 25 Nov 2024 11:58:19 -0500
From: Peter Xu <peterx@...hat.com>
To: stsp <stsp2@...dex.ru>
Cc: Linux kernel <linux-kernel@...r.kernel.org>,
	Muhammad Usama Anjum <usama.anjum@...labora.com>,
	Axel Rasmussen <axelrasmussen@...gle.com>,
	Mike Rapoport <rppt@...nel.org>
Subject: Re: userfaultfd: two-step UFFDIO_API always gives -EINVAL

On Mon, Nov 25, 2024 at 07:15:10PM +0300, stsp wrote:
> 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. :)

But AFAIU that's the only way to probe kernel userfaultfd features.. so if
we need a probe we need to have two fds.

> 
> 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.

Hmm yes.  I didn't pay much attention initially, but then after I read the
latest man-pages/, especially "UFFDIO_API(2const)" I found it looks indeed
wrong in the doc.

In this case we can't change the code because we need to keep it working
like before to not break ABI.  We may still update the doc.

IIUC the two-step was mentioned since this patch:

https://lore.kernel.org/lkml/20230919190206.388896-6-axelrasmussen@google.com/#t

So I also copied Axel and Mike, just to make sure I didn't miss something.

> 
> 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. :)

I would actually suggest mention another fd is needed for probing features.
But you can wait for some comment from either Axel or Mike to double check
that should be either removed or proposed.

For man-pages contribution in case you're interested, see:

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING

Thanks,

-- 
Peter Xu


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ