All of lore.kernel.org
 help / color / mirror / Atom feed
* re: [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net
@ 2022-09-29 15:22 David Laight
  2022-09-29 18:21 ` Linus Torvalds
  0 siblings, 1 reply; 30+ messages in thread
From: David Laight @ 2022-09-29 15:22 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: Eric W. Biederman, Serge E. Hallyn, Linus Torvalds

I've just bumped into (the lack of) this change (from aug 2014):

> In oddball cases where the thread has a different network namespace
> than the primary thread group leader or more likely in cases where
> the thread remains and the thread group leader has exited this
> ensures that /proc/net continues to work.

> -	proc_symlink("net", NULL, "self/net");
> +	proc_symlink("net", NULL, "thread-self/net");

This was applied and then reverted by Linus (I can't find anything
in the LKML archive) - see git show 155134fef - because of
issues with apparmor and dhclient.

In my case we have an application that is started in one
network namespace (where most of what it needs to do exists)
but needs one thread to revert to the 'init' namespace in
order to accept TCP connections from applications.

The thread that reverts is the main thread.
Until a change made in the last 6 months it actually worked.
(I'm using 5.10 LTS kernels so I'm not sure when.)
Then a fix was made to correctly update the mounts when the
namespace changed - and it suddenly stopped working.

So the 'oddball' case of different threads being in different
namespaces and then accessing /proc/net (because that is what
the code always did before being changed to run in a namespace)
has happened to a real application.

Fortunately it happened in testing and the application could
be changed.

(I was looking at the kernel sources to propose the change
that got reverted!)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 30+ messages in thread
* Re: [CFT][PATCH] proc: Update /proc/net to point at the accessing threads network namespace
@ 2022-09-30 14:01 Alexey Dobriyan
  0 siblings, 0 replies; 30+ messages in thread
From: Alexey Dobriyan @ 2022-09-30 14:01 UTC (permalink / raw)
  To: viro; +Cc: ebiederm, torvalds, David.Laight, linux-kernel, netdev, serge

Al wrote:

> Just to troll adobriyan a bit:
> 
> static const char *dynamic_get_link(struct delayed_call *done,
> 				    bool is_rcu,
> 				    const char *fmt, ...)
> {
> 	va_list args;
> 	char *body;
> 
> 	va_start(args, fmt);
> 	body = kvasprintf(is_rcu ? GFP_ATOMIC : GFP_KERNEL, fmt, args);
> 	va_end(args);

Ouch... Double pass over data. Who wrote this?

> 
> 	if (unlikely(!body))
> 		return is_rcu ? ERR_PTR(-ECHILD) : ERR_PTR(-ENOMEM);
> 	set_delayed_call(done, kfree_link, body);
> 	return body;
> }

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2022-10-05 13:11 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 15:22 [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net David Laight
2022-09-29 18:21 ` Linus Torvalds
2022-09-29 18:50   ` Al Viro
2022-09-29 19:00     ` Al Viro
2022-09-29 19:05       ` Linus Torvalds
2022-09-29 19:34         ` Al Viro
2022-09-29 21:13           ` Linus Torvalds
2022-09-29 21:21             ` Al Viro
2022-09-29 21:27               ` Al Viro
2022-09-29 21:31                 ` Linus Torvalds
2022-09-29 21:15           ` Al Viro
2022-09-29 21:29             ` Linus Torvalds
2022-09-29 22:14               ` Eric W. Biederman
2022-09-29 22:48                 ` [CFT][PATCH] proc: Update /proc/net to point at the accessing threads network namespace Eric W. Biederman
2022-09-29 23:38                   ` Al Viro
2022-09-30  3:19                   ` kernel test robot
2022-09-30  6:07                   ` kernel test robot
2022-09-30  9:30                   ` David Laight
2022-09-30 16:17                     ` Eric W. Biederman
2022-09-30 21:28                       ` David Laight
2022-10-01 23:11                         ` Al Viro
2022-10-03  9:36                           ` David Laight
2022-10-03 14:03                             ` Al Viro
2022-10-03 17:07                         ` Eric W. Biederman
2022-10-03 18:49                           ` Al Viro
2022-10-04  8:53                           ` David Laight
2022-10-05 13:10                   ` [proc] 5336f1902b: BUG:KASAN:global-out-of-bounds_in_memchr kernel test robot
2022-10-05 13:10                     ` kernel test robot
2022-09-29 19:00     ` [PATCH 3/4] proc: Point /proc/net at /proc/thread-self/net instead of /proc/self/net Linus Torvalds
2022-09-30 14:01 [CFT][PATCH] proc: Update /proc/net to point at the accessing threads network namespace Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.