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

Linus Torvalds
2022-09-29T21:32:07Z

On Thu, Sep 29, 2022 at 2:27 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> Put it another way:
>
> David:
> when I'm opening /proc/net/whatever, I want its contents to match
> this thread's netns, not that of some other thread.
> dhclient+apparmor:
> whatever you get from /proc/net/dev, it would better be at
> /proc/<pid>/net/dev, no matter which thread you happen to be.

... which actually creates an opening for a truly disgusting solution:

- when an outsider else opens /proc/<pid>/net, they get the thread leader netns

- when a thread opens its *own* thread group /proc/<pid>/net, it gets
its own thread netns, not the thread leader one.

Disgusting.

Linus