Re: [PATCH v2 0/5] pid: add pidfd_open()

From: Linus Torvalds
Date: Sat Mar 30 2019 - 12:17:09 EST


On Sat, Mar 30, 2019 at 9:11 AM Daniel Colascione <dancol@xxxxxxxxxx> wrote:
>
> How do you propose that someone open the /proc/<pid>/status file in a
> race-free manner starting with the result of calling pidfd_open?

CXhrist.

If you want to open a /proc file, then open a /proc file. Don't use
pidfd_open().

Just open /proc/<pid>/

Then you can use openat() to open whatever sub-files you want.

You have two choices: either you use /proc, or you don't. Don't mix the two.

And no, we are *NOT* making pidfd_open() into some "let's expose /proc
even when it's not mounted" horror. Seriously. That's disgusting,
wrong, insecure and stupid.

Linus