mbox series

[v3,net-next,0/2] af_unix: Fix regression by the per-netns hash table series.

Message ID 20220702154818.66761-1-kuniyu@amazon.com (mailing list archive)
Headers show
Series af_unix: Fix regression by the per-netns hash table series. | expand

Message

Kuniyuki Iwashima July 2, 2022, 3:48 p.m. UTC
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 with the same type has to be
able to connect to it even in different netns.  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/


Changes:
  v3:
    * 1st: Update changelog s/named/pathname/
    * 2nd: Fix checkpatch.pl CHECK by --strict option

  v2: https://lore.kernel.org/netdev/20220702014447.93746-1-kuniyu@amazon.com/
    * Add selftest

  v1: https://lore.kernel.org/netdev/20220701072519.96097-1-kuniyu@amazon.com/


Kuniyuki Iwashima (2):
  af_unix: Put pathname sockets 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

Comments

patchwork-bot+netdevbpf@kernel.org July 5, 2022, 9:50 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Sat, 2 Jul 2022 08:48:16 -0700 you wrote:
> 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 with the same type has to be
> able to connect to it even in different netns.  The series puts all sockets
> into each namespace's hash table, making it impossible to look up a visible
> socket in different netns.
> 
> [...]

Here is the summary with links:
  - [v3,net-next,1/2] af_unix: Put pathname sockets in the global hash table.
    https://git.kernel.org/netdev/net-next/c/51bae889fe11
  - [v3,net-next,2/2] selftests: net: af_unix: Test connect() with different netns.
    https://git.kernel.org/netdev/net-next/c/e95ab1d85289

You are awesome, thank you!