lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250530025401.3211542-1-kuni1840@gmail.com>
Date: Thu, 29 May 2025 19:53:41 -0700
From: Kuniyuki Iwashima <kuni1840@...il.com>
To: hch@....de
Cc: axboe@...nel.dk,
	chuck.lever@...cle.com,
	davem@...emloft.net,
	edumazet@...gle.com,
	horms@...nel.org,
	jaka@...ux.ibm.com,
	jlayton@...nel.org,
	kbusch@...nel.org,
	kuba@...nel.org,
	kuni1840@...il.com,
	kuniyu@...zon.com,
	linux-nfs@...r.kernel.org,
	linux-nvme@...ts.infradead.org,
	linux-rdma@...r.kernel.org,
	matttbe@...nel.org,
	mptcp@...ts.linux.dev,
	netdev@...r.kernel.org,
	pabeni@...hat.com,
	sfrench@...ba.org,
	wenjia@...ux.ibm.com,
	willemb@...gle.com
Subject: Re: [PATCH v2 net-next 3/7] socket: Restore sock_create_kern().

From: Christoph Hellwig <hch@....de>
Date: Mon, 26 May 2025 07:32:27 +0200
> On Fri, May 23, 2025 at 11:21:09AM -0700, Kuniyuki Iwashima wrote:
> > Let's restore sock_create_kern() that holds a netns reference.
> > 
> > Now, it's the same as the version before commit 26abe14379f8 ("net:
> > Modify sk_alloc to not reference count the netns of kernel sockets.").
> > 
> > Back then, after creating a socket in init_net, we used sk_change_net()
> > to drop the netns ref and switch to another netns, but now we can
> > simply use __sock_create_kern() instead.
> > 
> >   $ git blame -L:sk_change_net include/net/sock.h 26abe14379f8~
> > 
> > DEBUG_NET_WARN_ON_ONCE() is to catch a path calling sock_create_kern()
> > from __net_init functions, since doing so would leak the netns as
> > __net_exit functions cannot run until the socket is removed.
> 
> Is reusing the name as the old sock_create_kern a good idea?  It can
> lead to bugs by people used to the old semantics.

In the old days, sock_create_kern() did take a ref to netns,
but an implicit change that avoids taking the ref has caused
a lot of problems for people who used to the old semantics.

This series rather rolls back the change, so I think using
the same name here is better than leaving the catchy
sock_create_kern() error-prone.


> It's also
> not really an all that descriptive name for either variant.  I'm
> not really a net stack or namespace expert, but maybe we can come
> up with more descriptive version for both this new sock_create_kern
> and the old sock_create_kern/__sock_create_kern?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ