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  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:   Sun, 31 Mar 2019 14:09:03 -0600
From:   Andy Lutomirski <>
To:     Linus Torvalds <>
Cc:     Christian Brauner <>,
        Daniel Colascione <>,
        Jann Horn <>,
        Andrew Lutomirski <>,
        David Howells <>,
        "Serge E. Hallyn" <>,
        Linux API <>,
        Linux List Kernel Mailing <>,
        Arnd Bergmann <>,
        "Eric W. Biederman" <>,
        Konstantin Khlebnikov <>,
        Kees Cook <>,
        Alexey Dobriyan <>,
        Thomas Gleixner <>,
        Michael Kerrisk-manpages <>,
        Jonathan Kowalski <>,
        "Dmitry V. Levin" <>,
        Andrew Morton <>,
        Oleg Nesterov <>,
        Nagarathnam Muthusamy <>,
        Aleksa Sarai <>,
        Al Viro <>,
        Joel Fernandes <>
Subject: Re: [PATCH v2 0/5] pid: add pidfd_open()

> On Mar 30, 2019, at 11:24 AM, Linus Torvalds <> wrote:
>> On Sat, Mar 30, 2019 at 10:12 AM Christian Brauner <> wrote:
>> To clarify, what the Android guys really wanted to be part of the api is
>> a way to get race-free access to metadata associated with a given pidfd.
>> And the idea was that *if and only if procfs is mounted* you could do:
>> int pidfd = pidfd_open(1234, 0);
>> int procfd = open("/proc", O_RDONLY | O_CLOEXEC);
>> int procpidfd = ioctl(pidfd, PIDFD_TO_PROCFD, procfd);
> And my claim is that this is three system calls - one of them very
> hacky - to just do
>    int pidfd = open("/proc/%d", O_PATH);

Hi Linus-

I want to re-check this because I think Christian’s example was bad.  I proposed these ioctls, but that wasn’t the intended use.  The real point is:

int pidfd = new_improved_clone(...);

To be useful, this type of API *must* work without proc mounted.

And, later:

openat(fd to pidfd’s proc directory, “status”, ...);

And we want a non-utterly-crappy way to do this.  The ioctl is certainly ugly, but it *works*.

Another approach is:

pid_t pid = pidfd_get_pid(pidfd);
sprintf(buf, “/proc/%d”, pid);
int procfd = open(buf, O_PATH);
if (pidfd_get_pid(pidfd) != pid) {
  we lose;

But this is clunky.

Do you think the clunky version is okay, or do you have a suggestion for making it better?


Powered by blists - more mailing lists