netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <kuba@kernel.org>
Cc: <davem@davemloft.net>, <edumazet@google.com>,
	<johannes@sipsolutions.net>, <netdev@vger.kernel.org>,
	<pabeni@redhat.com>, <pablo@netfilter.org>, <kuniyu@amazon.com>
Subject: Re: [PATCH net 2/2] selftests: net: add a test for closing a netlink socket ith dump in progress
Date: Mon, 4 Nov 2024 22:21:07 -0800	[thread overview]
Message-ID: <20241105062107.64837-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20241105010347.2079981-2-kuba@kernel.org>

From: Jakub Kicinski <kuba@kernel.org>
Date: Mon,  4 Nov 2024 17:03:47 -0800
> 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.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>

TIL mq_notify, and the trick was interesting that calls fdget(),
netlink_getsockbyfilp(), and fdput() to keep sock_hold() only :)

  reply	other threads:[~2024-11-05  6:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05  1:03 [PATCH net 1/2] netlink: terminate outstanding dump on socket close Jakub Kicinski
2024-11-05  1:03 ` [PATCH net 2/2] selftests: net: add a test for closing a netlink socket ith dump in progress Jakub Kicinski
2024-11-05  6:21   ` Kuniyuki Iwashima [this message]
2024-11-05  5:31 ` [PATCH net 1/2] netlink: terminate outstanding dump on socket close Kuniyuki Iwashima
2024-11-05 10:03   ` Eric Dumazet
2024-11-05 19:42   ` Jakub Kicinski

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=20241105062107.64837-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    /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;
as well as URLs for NNTP newsgroup(s).