[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250517025206.47762-1-kuniyu@amazon.com>
Date: Fri, 16 May 2025 19:51:03 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <ematsumiya@...e.de>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <horms@...nel.org>,
<kuba@...nel.org>, <kuniyu@...zon.com>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>, <willemb@...gle.com>
Subject: Re: [RFC PATCH 0/1] net: socket: centralize netns refcounting
From: Enzo Matsumiya <ematsumiya@...e.de>
Date: Fri, 16 May 2025 19:09:18 -0300
> Hi,
>
> I came up with this patch to centralize netns refcounting on kernel sockets,
> because `sk_net_refcnt = !kern' is not enough anymore.
>
> The idea is simply to remove the responsibility of a module outside of net/
> to have to deal with sockets internals (cf. sk_net_refcnt_upgrade()).
>
> It adds an anonymous enum (just for named values) SOCK_NETNS_REFCNT_* that
> can be passed to __sock_create() and sk_alloc() through the @kern arg.
> (this was much easier and shorter than e.g. adding another arg)
>
> A sock_create_netns() wrapper is added, for callers who need such refcounting
> (e.g. current callers of sk_net_refcnt_upgrade()).
>
> And then, the core change is quite simple in sk_alloc() -- sk_net_refcnt is
> set only if it's a user socket, or
> (@kern == SOCK_NETNS_REFCNT_KERN_ANY && @net != inet_net).
>
> I have the patches that modifies current users of sk_net_refcnt_upgrade() to
> create their sockets with sock_create_netns(), if anyone wants to test or
> this gets merged.
>
> I could confirm this works only on cifs, though, by using Kuniyuki's reproducer
> in [0], which is quite reliable. Unfortunately, I don't know enough about the
> other modules and/or how to trigger this same bug on those, but I'll be happy
> to test it if I can get instructions.
>
I was waiting for b013b817f32f to land on net-next to respin
this series [0] as propised in [1].
[0]: https://lore.kernel.org/netdev/20241213092152.14057-1-kuniyu@amazon.com/#t
[1]: https://lore.kernel.org/lkml/20250409190031.38942-1-kuniyu@amazon.com/
So, let me respin it.
FWIW, I posted the most identical patch before the series.
https://lore.kernel.org/netdev/20240227011041.97375-4-kuniyu@amazon.com/
Powered by blists - more mailing lists