]> www.infradead.org Git - users/hch/misc.git/commit
selftests: net: add a test for closing a netlink socket ith dump in progress
authorJakub Kicinski <kuba@kernel.org>
Wed, 6 Nov 2024 01:52:35 +0000 (17:52 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 7 Nov 2024 21:45:34 +0000 (13:45 -0800)
commit55d42a0c3f9ccd07c199e0ddbe1ba87572d30074
treee3a79d6a0736b161b4406e4d1f829f67b29d3910
parent1904fb9ebf911441f90a68e96b22aa73e4410505
selftests: net: add a test for closing a netlink socket ith dump in progress

Close a socket with dump in progress. We need a dump which generates
enough info not to fit into a single skb. Policy dump fits the bill.

Use the trick discovered by syzbot for keeping a ref on the socket
longer than just close, with mqueue.

  TAP version 13
  1..3
  # Starting 3 tests from 1 test cases.
  #  RUN           global.test_sanity ...
  #            OK  global.test_sanity
  ok 1 global.test_sanity
  #  RUN           global.close_in_progress ...
  #            OK  global.close_in_progress
  ok 2 global.close_in_progress
  #  RUN           global.close_with_ref ...
  #            OK  global.close_with_ref
  ok 3 global.close_with_ref
  # PASSED: 3 / 3 tests passed.
  # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0

Note that this test is not expected to fail but rather crash
the kernel if we get the cleanup wrong.

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20241106015235.2458807-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/Makefile
tools/testing/selftests/net/netlink-dumps.c [new file with mode: 0644]