Linux block layer
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	nbd@other.debian.org,
	syzbot+d7d72f3d467710442af0@syzkaller.appspotmail.com
Subject: Re: [PATCH] nbd: fix circular lock dependency
Date: Thu, 12 Nov 2026 08:13:18 +0800	[thread overview]
Message-ID: <20261112001319.463-1-hdanton@sina.com> (raw)
In-Reply-To: <c2f4dbce-f8e0-4f04-8dee-3f8d413f4d0d@acm.org>

On Wed, 11 Nov 2026 09:13:45 -0800 Bart Van Assche wrote:
>On 11/11/26 3:38 AM, Guilherme Giacomo Simoes wrote:
> > After tested, how can I mention this in my patch?
>
>If syzbot confirms the fix, you can either:
>- Add a "Tested-by: syzbot..." tag if syzkaller provides one, or
>- Mention it below the "---" separator in your patch (in the changelog/notes
>   section), e.g.:
>   Tested against syzbot reproducer via #syz test: <link-to-syzbot-result>
>
> > What do you think now? We will call nbd_reclassify_socket() inside
> > nbd_get_socket() and call this only one time? Or is a better way call the
> > nbd_reclassify_socket() inside nbd_genl_reconnect_sock_cb() when we 
>have sure
> > that we will use the socket?
>
>Calling nbd_reclassify_socket(sock) directly inside
>nbd_genl_reconnect_sock_cb() (right after nbd_get_socket()) is definitely
>the best approach:
>1. It is a 1-line addition to nbd_genl_reconnect_sock_cb().
>2. It mirrors what nbd_add_socket() already does.
>3. No code needs to be moved around, keeping the git diff minimal and making
>    the fix trivial to review and backport to stable kernels.
>
> > What do you think:
> > ```
> > nbd: must reclassify socket when socket is created
> >
> > When we need to connect or reconnect a new socket, we need to call
> > nbd_reclassify_socket() to ensure that a false positive lock_dep
> > circular warning fires. [...]
> > ```
>
> Please use the imperative mood, e.g. as follows:
> 
> nbd: Reclassify sockets in the reconnect path
> 
> Commit d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular 
> dependency") introduced nbd_reclassify_socket() to prevent lockdep false 
> positives when NBD sockets are used in memory reclaim paths. While 
> nbd_add_socket() reclassifies newly added sockets, 
> nbd_genl_reconnect_sock_cb() omitted this call when replacing dead 
> sockets during reconnection. Consequently, reconnected sockets retain 
> the generic socket lockdep class and trigger false-positive lockdep reports.
> 
> Fix this by reclassifying the replacement socket in 
> nbd_genl_reconnect_sock_cb().
> 
> Fixes: d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular 
> dependency")
> Reported-by: syzbot+d7d72f3d467710442af0@syzkaller.appspotmail.com 
> Closes: https://syzkaller.appspot.com/bug?extid=d7d72f3d467710442af0
> 
FYI reclassifying sockets is also corrupting memory [11], so can you fix
the corrupter before reclassifying again?

[11] Subject: [syzbot] BUG: spinlock already unlocked in corrupted
https://lore.kernel.org/lkml/6aec63fd.5f5735a5.290c1c.0003.GAE@google.com/

  reply	other threads:[~2026-11-12  0:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 21:57 [PATCH] nbd: fix circular lock dependency Guilherme Giacomo Simoes
2026-11-11  0:40 ` Bart Van Assche
2026-11-11 10:19   ` Guilherme Giacomo Simoes
2026-11-11 11:29     ` Timo Joannin
2026-11-11 12:25       ` Guilherme Giacomo Simoes
2026-11-11 11:38     ` Guilherme Giacomo Simoes
2026-11-11 17:13       ` Bart Van Assche
2026-11-12  0:13         ` Hillf Danton [this message]
2026-11-12 11:11           ` Guilherme Giacomo Simoes
2026-11-12 11:03         ` Guilherme Giacomo Simoes
2026-11-11 12:24     ` Guilherme Giacomo Simoes

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=20261112001319.463-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --cc=syzbot+d7d72f3d467710442af0@syzkaller.appspotmail.com \
    --cc=trintaeoitogc@gmail.com \
    /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