Re: [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net

From: Al Viro
Date: Thu Sep 29 2022 - 17:21:14 EST


On Thu, Sep 29, 2022 at 02:13:57PM -0700, Linus Torvalds wrote:
> On Thu, Sep 29, 2022 at 12:34 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Apparmor takes mount+dentry and turns that into pathname. Then acts
> > upon the resulting string. *AFTER* the original had been resolved.
>
> Ok. So it would have to act like a bind mount.
>
> Which is probably not too bad.
>
> In fact, maybe it would be ok for this to act like a hardlink and just
> fill in the inode - not safe for a filesystem in general due to the
> whole rename loop issue, but for /proc it might be fine?

_Which_ hardlink?

Linus, where in dentry tree would you want it to be seen? Because
apparmor profile wants /proc/net/dev to land at /proc/<pid>/net/dev
and will fail with anything else.

Do you really want multiple dentries with the same name in the same
parent, refering to different directory inodes with different contents?

And that's different inodes with different contents - David's complaint
is precisely about seeing the same thing for all threads and apparmor
issue is with *NOT* seeing each of those things at the same location.