netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/2] af_unix: Fix regression by the per-netns hash table series.
@ 2022-07-02  1:44 Kuniyuki Iwashima
  2022-07-02  1:44 ` [PATCH v2 net-next 1/2] af_unix: Put a named socket in the global hash table Kuniyuki Iwashima
  2022-07-02  1:44 ` [PATCH v2 net-next 2/2] selftests: net: af_unix: Test connect() with different netns Kuniyuki Iwashima
  0 siblings, 2 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2022-07-02  1:44 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Sachin Sant, Leonard Crestez, Nathan Chancellor,
	Kuniyuki Iwashima, Kuniyuki Iwashima, netdev

The series 6dd4142fb5a9 ("Merge branch 'af_unix-per-netns-socket-hash'")
replaced a global hash table with per-netns tables, which caused regression
reported in the links below. [0][1]

When a pathname socket is visible, any socket, even in different netns,
has to be able to connect to it.  The series puts all sockets into each
namespace's hash table, making it impossible to look up a visible socket
in different netns.

On the other hand, while dumping sockets, they are filtered by netns.  To
keep such code simple, let's add a new global hash table only for pathname
sockets and link them with sk_bind_node.  Then we can keep all sockets in
each per-netns table and look up pathname sockets via the global table.

[0]: https://lore.kernel.org/netdev/B2AA3091-796D-475E-9A11-0021996E1C00@linux.ibm.com/
[1]: https://lore.kernel.org/netdev/5fb8d86f-b633-7552-8ba9-41e42f07c02a@gmail.com/


Kuniyuki Iwashima (2):
  af_unix: Put a named socket in the global hash table.
  selftests: net: af_unix: Test connect() with different netns.

 net/unix/af_unix.c                            |  47 ++++--
 tools/testing/selftests/net/.gitignore        |   1 +
 tools/testing/selftests/net/af_unix/Makefile  |   3 +-
 .../selftests/net/af_unix/unix_connect.c      | 149 ++++++++++++++++++
 4 files changed, 189 insertions(+), 11 deletions(-)
 create mode 100644 tools/testing/selftests/net/af_unix/unix_connect.c

-- 
2.30.2


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

end of thread, other threads:[~2022-07-02  1:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-02  1:44 [PATCH v2 net-next 0/2] af_unix: Fix regression by the per-netns hash table series Kuniyuki Iwashima
2022-07-02  1:44 ` [PATCH v2 net-next 1/2] af_unix: Put a named socket in the global hash table Kuniyuki Iwashima
2022-07-02  1:44 ` [PATCH v2 net-next 2/2] selftests: net: af_unix: Test connect() with different netns Kuniyuki Iwashima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).