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

Eric W. Biederman
2022-09-29T22:16:00Z

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Thu, Sep 29, 2022 at 2:15 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
>>
>> FWIW, what e.g. debian profile for dhclient has is
>> @{PROC}/@{pid}/net/dev r,
>>
>> Note that it's not
>> @{PROC}/net/dev r,
>
> Argh. Yeah, then a bind mount or a hardlink won't work either, you're
> right. I was assuming that any Apparmor rules allowed for just
> /proc/net.
>
> Oh well. I guess we're screwed any which way we turn.

I actually think there is a solution.

Instead of going to /proc/self/net -> /proc/tgid/net
or /proc/thread-self/net -> /proc/tgid/task/tid/net

We should be able to go to: /proc/tid/net

That directory does not show up in readdir, but the tid directories were
put in /proc because of how our pthread support evolved and gdb which
made gdb expect them to be their.

That should continue to work with the incomplete apparmor rules that
don't allow accessing /proc/tgid/tid/net for some reason.

Eric