From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <ematsumiya@suse.de>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <horms@kernel.org>,
<kuba@kernel.org>, <kuniyu@amazon.com>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>, <willemb@google.com>
Subject: Re: [RFC PATCH 0/1] net: socket: centralize netns refcounting
Date: Fri, 16 May 2025 19:51:03 -0700 [thread overview]
Message-ID: <20250517025206.47762-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20250516220920.1142578-1-ematsumiya@suse.de>
From: Enzo Matsumiya <ematsumiya@suse.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/
prev parent reply other threads:[~2025-05-17 2:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 22:09 Enzo Matsumiya
2025-05-16 22:09 ` [RFC PATCH 1/1] net: socket: hint netns refcounting through @kern arg Enzo Matsumiya
2025-05-17 2:51 ` Kuniyuki Iwashima [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250517025206.47762-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ematsumiya@suse.de \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®