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]
Date:   Wed, 20 Jul 2022 20:14:09 +0000
From:   Nadav Amit <namit@...are.com>
To:     Axel Rasmussen <axelrasmussen@...gle.com>
CC:     Peter Xu <peterx@...hat.com>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "Dmitry V . Levin" <ldv@...linux.org>,
        Gleb Fotengauer-Malinovskiy <glebfm@...linux.org>,
        Hugh Dickins <hughd@...gle.com>, Jan Kara <jack@...e.cz>,
        Jonathan Corbet <corbet@....net>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Mike Rapoport <rppt@...nel.org>, Shuah Khan <shuah@...nel.org>,
        Suren Baghdasaryan <surenb@...gle.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        zhangyi <yi.zhang@...wei.com>,
        "linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux MM <linux-mm@...ck.org>,
        "linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH v4 2/5] userfaultfd: add /dev/userfaultfd for fine grained
 access control

On Jul 20, 2022, at 1:10 PM, Axel Rasmussen <axelrasmussen@...gle.com> wrote:

> On Wed, Jul 20, 2022 at 10:42 AM Nadav Amit <namit@...are.com> wrote:
>> On Jul 19, 2022, at 7:32 PM, Peter Xu <peterx@...hat.com> wrote:
>> 
>>> ⚠ External Email
>>> 
>>> On Tue, Jul 19, 2022 at 11:55:21PM +0000, Nadav Amit wrote:
>>>> Anyhow, I do want to clarify a bit about the “cross-process support”
>>>> userfaultfd situation. Basically, you can already get cross-process support
>>>> today, by using calling userfaultfd() on the controlled process and calling
>>>> pidfd_open() from another process. It does work and I do not remember any
>>>> issues that it introduced (in contrast, for instance, to io-uring, that
>>>> would break if you use userfaultfd+iouring+fork today).
>>> 
>>> Do you mean to base it on pidof_getfd()?
>> 
>> autocorrect? :)
>> 
>> I did refer to pidfd_getfd() as a syscall that can be used today by one
>> process to control the address space of another process. I did not intend to
>> use it for the actual implementation.
>> 
>>> Just want to mention that this will still need collaboration of the target
>>> process as userfaultfd needs to be created explicitly there.  From that POV
>>> it's still more similar to general SCM_RIGHTS trick to pass over the fd but
>>> just to pass it in a different way.
>> 
>> There are also some tricks you can do with ptrace in order not to need the
>> collaboration, but they are admittedly fragile.
>> 
>>> IMHO the core change about having /proc/pid/userfaultfd is skipping that
>>> only last step to create the handle.
>> 
>> Yes. The point that I was trying to make is that there are no open issues
>> with adding support for remote process control through
>> /proc/pid/userfaultfd. This is in contrast, for example, for using io-uring
>> with userfaultfd. For instance, if you try to use io-uring TODAY with
>> userfaultfd (without the async support that I need to add), and you try to
>> monitor the fork event, things would break (the new userfaultfd file
>> descriptor after fork would be installed on the io-worker thread).
>> 
>> This is all to say that it is really simple to add support for one process
>> monitoring userfaultfd of another process, since I understood that Axel had
>> concerned that this might be utterly broken…
> 
> Mostly I was worried it would be nontrivial to implement, and it isn't
> a use case I plan to use so I was hoping to ignore it and defer it to
> some future patches. ;)
> 
> But, if it "just works" I'm happy to include it in v5.

There is a problem though, since for many use-cases you do need
process_madvisev(MADV_DONTNEED) which is unsupported, and you also need - in
some use-cases - to be able to skip pinned pages. These are patches that I
still need to send.

So I leave it to you to make up your mind whether it is reasonable to add it
now without this support.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ