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

From: Linus Torvalds
Date: Sun Mar 31 2019 - 20:25:58 EST


On Sun, Mar 31, 2019 at 5:09 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> Ugh... Which vfsmount would you have to go with it?

I'd literally just do a lookup of "/proc" in the current root
directory in the lookup() function for that special pseudo-dentry.

If it's not mounted, or not a /proc filesystem, screw it.

> Except that we never let unattached _directory_ dentries out - if
> we can't reattach them to the tree, open-by-handle will tell you to
> take a hike.

Absolutely. Which is why I said it's _conceptually_ similar to the alias lookup.

And I suspect we can even use some of the same practical logic, but
it's definitely not _exactly_ the same. This thing very much involves
magic hooking into the lookup() function (but we then have to look up
the alias not for the path we're looking up, but for the _parent_
we're looking that path up in, which is very different from the normal
case).

> It's more than a tiny bit too clever for mine...

Fair enough. The whole "just do the whole lookup at pidfd creation
time" is certainly a whole lot simpler.

> Al, back to normal life and digging through several flamefests from
> hell...

Yeah, I would like to see the actual aio.c pull request and the
use-after-free fixes. All the patches look fine, I just don't have the
final end result..

And that takes precedence anyway. Right now the "open_pidfd()" is a
future discussion.

Linus