Linux block layer
 help / color / mirror / Atom feed
* [PATCH] nbd: don't warn when reclassifying a busy socket lock
@ 2026-06-21 23:52 Deepanshu Kartikey
  2026-06-22  1:43 ` Hillf Danton
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Deepanshu Kartikey @ 2026-06-21 23:52 UTC (permalink / raw)
  To: josef, axboe, edumazet
  Cc: linux-block, nbd, linux-kernel, Deepanshu Kartikey,
	syzbot+6b85d1e39a5b8ed9a954


nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
held at the point of reclassification. That assertion was copied from
nvme-tcp, where the socket is created internally by the kernel
(sock_create_kern()) and is never visible to user space, so the lock
is guaranteed to be free.

NBD is different: the socket is looked up from a user-supplied fd in
nbd_get_socket(), and user space retains that fd. A concurrent syscall
on the same socket (or softirq processing taking bh_lock_sock() on a
connected TCP socket) can legitimately hold the lock at the instant
NBD reclassifies it. sock_allow_reclassification() then returns false
and the WARN_ON_ONCE() fires, which turns into a crash under
panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
against socket activity on the same fd, as reported by syzbot.

Hitting a held lock here is expected for an externally owned socket and
is not a kernel bug, so skip reclassification silently instead of
warning. Reclassification is a lockdep-only annotation, so skipping it
in the rare racing case is harmless.

Reported-by: syzbot+6b85d1e39a5b8ed9a954@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6b85d1e39a5b8ed9a954
Fixes: d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular dependency")
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 3a585a0c882a..8f10762e90ef 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1246,7 +1246,7 @@ static void nbd_reclassify_socket(struct socket *sock)
 {
 	struct sock *sk = sock->sk;
 
-	if (WARN_ON_ONCE(!sock_allow_reclassification(sk)))
+	if (!sock_allow_reclassification(sk))
 		return;
 
 	switch (sk->sk_family) {
-- 
2.43.0


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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-21 23:52 [PATCH] nbd: don't warn when reclassifying a busy socket lock Deepanshu Kartikey
@ 2026-06-22  1:43 ` Hillf Danton
  2026-06-22  8:18   ` Eric Dumazet
  2026-06-22  8:31 ` Eric Dumazet
  2026-06-22 22:00 ` Jens Axboe
  2 siblings, 1 reply; 13+ messages in thread
From: Hillf Danton @ 2026-06-22  1:43 UTC (permalink / raw)
  To: Deepanshu Kartikey
  Cc: edumazet, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote:
> nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
> held at the point of reclassification. That assertion was copied from
> nvme-tcp, where the socket is created internally by the kernel
> (sock_create_kern()) and is never visible to user space, so the lock
> is guaranteed to be free.
> 
> NBD is different: the socket is looked up from a user-supplied fd in
> nbd_get_socket(), and user space retains that fd. A concurrent syscall
> on the same socket (or softirq processing taking bh_lock_sock() on a
> connected TCP socket) can legitimately hold the lock at the instant
> NBD reclassifies it. sock_allow_reclassification() then returns false
> and the WARN_ON_ONCE() fires, which turns into a crash under
> panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
> against socket activity on the same fd, as reported by syzbot.
> 
Given the syzbot report, if you are right (I suspect) then Eric delivered
another half-baked croissant, and feel free to cut it off instead to make
room for correct fix.

> Hitting a held lock here is expected for an externally owned socket and
> is not a kernel bug, so skip reclassification silently instead of
> warning. Reclassification is a lockdep-only annotation, so skipping it
> in the rare racing case is harmless.
> 
> Reported-by: syzbot+6b85d1e39a5b8ed9a954@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=6b85d1e39a5b8ed9a954
> Fixes: d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular dependency")
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> ---
>  drivers/block/nbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 3a585a0c882a..8f10762e90ef 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1246,7 +1246,7 @@ static void nbd_reclassify_socket(struct socket *sock)
>  {
>  	struct sock *sk = sock->sk;
>  
> -	if (WARN_ON_ONCE(!sock_allow_reclassification(sk)))
> +	if (!sock_allow_reclassification(sk))
>  		return;
>  
>  	switch (sk->sk_family) {
> -- 
> 2.43.0

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-22  1:43 ` Hillf Danton
@ 2026-06-22  8:18   ` Eric Dumazet
  2026-06-23  0:07     ` Hillf Danton
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2026-06-22  8:18 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Sun, Jun 21, 2026 at 6:43 PM Hillf Danton <hdanton@sina.com> wrote:
>
> On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote:
> > nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
> > held at the point of reclassification. That assertion was copied from
> > nvme-tcp, where the socket is created internally by the kernel
> > (sock_create_kern()) and is never visible to user space, so the lock
> > is guaranteed to be free.
> >
> > NBD is different: the socket is looked up from a user-supplied fd in
> > nbd_get_socket(), and user space retains that fd. A concurrent syscall
> > on the same socket (or softirq processing taking bh_lock_sock() on a
> > connected TCP socket) can legitimately hold the lock at the instant
> > NBD reclassifies it. sock_allow_reclassification() then returns false
> > and the WARN_ON_ONCE() fires, which turns into a crash under
> > panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
> > against socket activity on the same fd, as reported by syzbot.
> >
> Given the syzbot report, if you are right (I suspect) then Eric delivered
> another half-baked croissant, and feel free to cut it off instead to make
> room for correct fix.

Nobody (including you) caught this.difference between nbd and other
sock_allow_reclassification()
callers.

What was the "correct fix" you envisioned exactly?

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-21 23:52 [PATCH] nbd: don't warn when reclassifying a busy socket lock Deepanshu Kartikey
  2026-06-22  1:43 ` Hillf Danton
@ 2026-06-22  8:31 ` Eric Dumazet
  2026-06-22 22:00 ` Jens Axboe
  2 siblings, 0 replies; 13+ messages in thread
From: Eric Dumazet @ 2026-06-22  8:31 UTC (permalink / raw)
  To: Deepanshu Kartikey
  Cc: josef, axboe, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Sun, Jun 21, 2026 at 4:53 PM Deepanshu Kartikey
<kartikey406@gmail.com> wrote:
>
>
> nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
> held at the point of reclassification. That assertion was copied from
> nvme-tcp, where the socket is created internally by the kernel
> (sock_create_kern()) and is never visible to user space, so the lock
> is guaranteed to be free.
>
> NBD is different: the socket is looked up from a user-supplied fd in
> nbd_get_socket(), and user space retains that fd. A concurrent syscall
> on the same socket (or softirq processing taking bh_lock_sock() on a
> connected TCP socket) can legitimately hold the lock at the instant
> NBD reclassifies it. sock_allow_reclassification() then returns false
> and the WARN_ON_ONCE() fires, which turns into a crash under
> panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
> against socket activity on the same fd, as reported by syzbot.
>
> Hitting a held lock here is expected for an externally owned socket and
> is not a kernel bug, so skip reclassification silently instead of
> warning. Reclassification is a lockdep-only annotation, so skipping it
> in the rare racing case is harmless.

Acked-by: Eric Dumazet <edumazet@google.com>

Thanks!

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-21 23:52 [PATCH] nbd: don't warn when reclassifying a busy socket lock Deepanshu Kartikey
  2026-06-22  1:43 ` Hillf Danton
  2026-06-22  8:31 ` Eric Dumazet
@ 2026-06-22 22:00 ` Jens Axboe
  2 siblings, 0 replies; 13+ messages in thread
From: Jens Axboe @ 2026-06-22 22:00 UTC (permalink / raw)
  To: josef, edumazet, Deepanshu Kartikey
  Cc: linux-block, nbd, linux-kernel, syzbot+6b85d1e39a5b8ed9a954


On Mon, 22 Jun 2026 05:22:55 +0530, Deepanshu Kartikey wrote:
> nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
> held at the point of reclassification. That assertion was copied from
> nvme-tcp, where the socket is created internally by the kernel
> (sock_create_kern()) and is never visible to user space, so the lock
> is guaranteed to be free.
> 
> NBD is different: the socket is looked up from a user-supplied fd in
> nbd_get_socket(), and user space retains that fd. A concurrent syscall
> on the same socket (or softirq processing taking bh_lock_sock() on a
> connected TCP socket) can legitimately hold the lock at the instant
> NBD reclassifies it. sock_allow_reclassification() then returns false
> and the WARN_ON_ONCE() fires, which turns into a crash under
> panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
> against socket activity on the same fd, as reported by syzbot.
> 
> [...]

Applied, thanks!

[1/1] nbd: don't warn when reclassifying a busy socket lock
      commit: 9280e6edf65662b6aafc8b704ad065b54c08b519

Best regards,
-- 
Jens Axboe




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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-22  8:18   ` Eric Dumazet
@ 2026-06-23  0:07     ` Hillf Danton
  2026-06-23  0:21       ` Eric Dumazet
  0 siblings, 1 reply; 13+ messages in thread
From: Hillf Danton @ 2026-06-23  0:07 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Mon, 22 Jun 2026 01:18:10 -0700 Eric Dumazet wrote:
>On Sun, Jun 21, 2026 at 6:43 PM Hillf Danton <hdanton@sina.com> wrote:
>> On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote:
>> > nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
>> > held at the point of reclassification. That assertion was copied from
>> > nvme-tcp, where the socket is created internally by the kernel
>> > (sock_create_kern()) and is never visible to user space, so the lock
>> > is guaranteed to be free.
>> >
>> > NBD is different: the socket is looked up from a user-supplied fd in
>> > nbd_get_socket(), and user space retains that fd. A concurrent syscall
>> > on the same socket (or softirq processing taking bh_lock_sock() on a
>> > connected TCP socket) can legitimately hold the lock at the instant
>> > NBD reclassifies it. sock_allow_reclassification() then returns false
>> > and the WARN_ON_ONCE() fires, which turns into a crash under
>> > panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
>> > against socket activity on the same fd, as reported by syzbot.
>> >
>> Given the syzbot report, if you are right (I suspect) then Eric delivered
>> another half-baked croissant, and feel free to cut it off instead to make
>> room for correct fix.
>
> Nobody (including you) caught this.difference between nbd and other
> sock_allow_reclassification() callers.
> 
Nope, actually it raises the question -- does the deadlock still remain
after your fix without the lock key you added applied?

> What was the "correct fix" you envisioned exactly?
>
Frankly I had no evidence against your fix a couple days back, but now I
see your lock key approach fails to take off. And the correct fix is to
erase the incorrect locking order ffa1e7ada456 tries to catch, more
difficult than you thought so far.

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-23  0:07     ` Hillf Danton
@ 2026-06-23  0:21       ` Eric Dumazet
  2026-06-23  0:44         ` Hillf Danton
  2026-06-29  5:28         ` Hillf Danton
  0 siblings, 2 replies; 13+ messages in thread
From: Eric Dumazet @ 2026-06-23  0:21 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Mon, Jun 22, 2026 at 5:07 PM Hillf Danton <hdanton@sina.com> wrote:
>
> On Mon, 22 Jun 2026 01:18:10 -0700 Eric Dumazet wrote:
> >On Sun, Jun 21, 2026 at 6:43 PM Hillf Danton <hdanton@sina.com> wrote:
> >> On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote:
> >> > nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
> >> > held at the point of reclassification. That assertion was copied from
> >> > nvme-tcp, where the socket is created internally by the kernel
> >> > (sock_create_kern()) and is never visible to user space, so the lock
> >> > is guaranteed to be free.
> >> >
> >> > NBD is different: the socket is looked up from a user-supplied fd in
> >> > nbd_get_socket(), and user space retains that fd. A concurrent syscall
> >> > on the same socket (or softirq processing taking bh_lock_sock() on a
> >> > connected TCP socket) can legitimately hold the lock at the instant
> >> > NBD reclassifies it. sock_allow_reclassification() then returns false
> >> > and the WARN_ON_ONCE() fires, which turns into a crash under
> >> > panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
> >> > against socket activity on the same fd, as reported by syzbot.
> >> >
> >> Given the syzbot report, if you are right (I suspect) then Eric delivered
> >> another half-baked croissant, and feel free to cut it off instead to make
> >> room for correct fix.
> >
> > Nobody (including you) caught this.difference between nbd and other
> > sock_allow_reclassification() callers.
> >
> Nope, actually it raises the question -- does the deadlock still remain
> after your fix without the lock key you added applied?

LOCKDEP might have a false positive, but it will be much much harder to trigger.

I had about 50 syzbot duplicates (that I did not release) before d532cddb6c60
 ("nbd: Reclassify sockets to avoid lockdep circular dependency").

>
> > What was the "correct fix" you envisioned exactly?
> >
> Frankly I had no evidence against your fix a couple days back, but now I
> see your lock key approach fails to take off. And the correct fix is to
> erase the incorrect locking order ffa1e7ada456 tries to catch, more
> difficult than you thought so far.

Which incorrect locking order are you referring to? This is a LOCKDEP
false positive.

I suggest you send a patch so we can discuss it.

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-23  0:21       ` Eric Dumazet
@ 2026-06-23  0:44         ` Hillf Danton
  2026-06-29  5:28         ` Hillf Danton
  1 sibling, 0 replies; 13+ messages in thread
From: Hillf Danton @ 2026-06-23  0:44 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Mon, 22 Jun 2026 17:21:53 -0700 Eric Dumazet wrote:
>On Mon, Jun 22, 2026 at 5:07 PM Hillf Danton <hdanton@sina.com> wrote:
>> On Mon, 22 Jun 2026 01:18:10 -0700 Eric Dumazet wrote:
>> >On Sun, Jun 21, 2026 at 6:43 PM Hillf Danton <hdanton@sina.com> wrote:
>> >> On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote:
>> >> > nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
>> >> > held at the point of reclassification. That assertion was copied from
>> >> > nvme-tcp, where the socket is created internally by the kernel
>> >> > (sock_create_kern()) and is never visible to user space, so the lock
>> >> > is guaranteed to be free.
>> >> >
>> >> > NBD is different: the socket is looked up from a user-supplied fd in
>> >> > nbd_get_socket(), and user space retains that fd. A concurrent syscall
>> >> > on the same socket (or softirq processing taking bh_lock_sock() on a
>> >> > connected TCP socket) can legitimately hold the lock at the instant
>> >> > NBD reclassifies it. sock_allow_reclassification() then returns false
>> >> > and the WARN_ON_ONCE() fires, which turns into a crash under
>> >> > panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
>> >> > against socket activity on the same fd, as reported by syzbot.
>> >> >
>> >> Given the syzbot report, if you are right (I suspect) then Eric delivered
>> >> another half-baked croissant, and feel free to cut it off instead to make
>> >> room for correct fix.
>> >
>> > Nobody (including you) caught this.difference between nbd and other
>> > sock_allow_reclassification() callers.
>> >
>> Nope, actually it raises the question -- does the deadlock still remain
>> after your fix without the lock key you added applied?
>
>LOCKDEP might have a false positive, but it will be much much harder to trigger.
>
>I had about 50 syzbot duplicates (that I did not release) before d532cddb6c60
> ("nbd: Reclassify sockets to avoid lockdep circular dependency").
>
>>
>> > What was the "correct fix" you envisioned exactly?
>> >
>> Frankly I had no evidence against your fix a couple days back, but now I
>> see your lock key approach fails to take off. And the correct fix is to
>> erase the incorrect locking order ffa1e7ada456 tries to catch, more
>> difficult than you thought so far.
>
>Which incorrect locking order are you referring to? This is a LOCKDEP
>false positive.
>
In addition to 50 syzbot reports, your fix has a Fixes tag, no?

>I suggest you send a patch so we can discuss it.

The deadlock existed before ffa1e7ada456, why is a chance left for your fix?

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-23  0:21       ` Eric Dumazet
  2026-06-23  0:44         ` Hillf Danton
@ 2026-06-29  5:28         ` Hillf Danton
  2026-06-30  7:19           ` Eric Dumazet
  2026-07-20  2:23           ` Hillf Danton
  1 sibling, 2 replies; 13+ messages in thread
From: Hillf Danton @ 2026-06-29  5:28 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Mon, 22 Jun 2026 17:21:53 -0700 Eric Dumazet wrote:
>On Mon, Jun 22, 2026 at 5:07 PM Hillf Danton <hdanton@sina.com> wrote:
>> On Mon, 22 Jun 2026 01:18:10 -0700 Eric Dumazet wrote:
>> >On Sun, Jun 21, 2026 at 6:43 PM Hillf Danton <hdanton@sina.com> wrote:
>> >> On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote:
>> >> > nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
>> >> > held at the point of reclassification. That assertion was copied from
>> >> > nvme-tcp, where the socket is created internally by the kernel
>> >> > (sock_create_kern()) and is never visible to user space, so the lock
>> >> > is guaranteed to be free.
>> >> >
>> >> > NBD is different: the socket is looked up from a user-supplied fd in
>> >> > nbd_get_socket(), and user space retains that fd. A concurrent syscall
>> >> > on the same socket (or softirq processing taking bh_lock_sock() on a
>> >> > connected TCP socket) can legitimately hold the lock at the instant
>> >> > NBD reclassifies it. sock_allow_reclassification() then returns false
>> >> > and the WARN_ON_ONCE() fires, which turns into a crash under
>> >> > panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
>> >> > against socket activity on the same fd, as reported by syzbot.
>> >> >
>> >> Given the syzbot report, if you are right (I suspect) then Eric delivered
>> >> another half-baked croissant, and feel free to cut it off instead to make
>> >> room for correct fix.
>> >
>> > Nobody (including you) caught this.difference between nbd and other
>> > sock_allow_reclassification() callers.
>> >
>> Nope, actually it raises the question -- does the deadlock still remain
>> after your fix without the lock key you added applied?
>
>LOCKDEP might have a false positive, but it will be much much harder to trigger.
>
>I had about 50 syzbot duplicates (that I did not release) before d532cddb6c60
> ("nbd: Reclassify sockets to avoid lockdep circular dependency").
>
>>
>> > What was the "correct fix" you envisioned exactly?
>> >
>> Frankly I had no evidence against your fix a couple days back, but now I
>> see your lock key approach fails to take off. And the correct fix is to
>> erase the incorrect locking order ffa1e7ada456 tries to catch, more
>> difficult than you thought so far.
>
>Which incorrect locking order are you referring to? This is a LOCKDEP
>false positive.
>
For archive purpose, syzbot report [1] where udp was not invovled defies
what is fixed in d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep
circular dependency") -- "Since the UDP socket and the NBD TCP/TLS socket
are different, this is a false positive."


[1] Subject: [syzbot] [net?] possible deadlock in inet_shutdown (3)
https://lore.kernel.org/lkml/69c37e6a.a70a0220.234938.0045.GAE@google.com/

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-29  5:28         ` Hillf Danton
@ 2026-06-30  7:19           ` Eric Dumazet
  2026-06-30 12:24             ` Hillf Danton
  2026-07-20  2:23           ` Hillf Danton
  1 sibling, 1 reply; 13+ messages in thread
From: Eric Dumazet @ 2026-06-30  7:19 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Sun, Jun 28, 2026 at 10:29 PM Hillf Danton <hdanton@sina.com> wrote:
>
> On Mon, 22 Jun 2026 17:21:53 -0700 Eric Dumazet wrote:
> >On Mon, Jun 22, 2026 at 5:07 PM Hillf Danton <hdanton@sina.com> wrote:
> >> On Mon, 22 Jun 2026 01:18:10 -0700 Eric Dumazet wrote:
> >> >On Sun, Jun 21, 2026 at 6:43 PM Hillf Danton <hdanton@sina.com> wrote:
> >> >> On Mon, 22 Jun 2026 05:22:55 +0530 Deepanshu Kartikey wrote:
> >> >> > nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
> >> >> > held at the point of reclassification. That assertion was copied from
> >> >> > nvme-tcp, where the socket is created internally by the kernel
> >> >> > (sock_create_kern()) and is never visible to user space, so the lock
> >> >> > is guaranteed to be free.
> >> >> >
> >> >> > NBD is different: the socket is looked up from a user-supplied fd in
> >> >> > nbd_get_socket(), and user space retains that fd. A concurrent syscall
> >> >> > on the same socket (or softirq processing taking bh_lock_sock() on a
> >> >> > connected TCP socket) can legitimately hold the lock at the instant
> >> >> > NBD reclassifies it. sock_allow_reclassification() then returns false
> >> >> > and the WARN_ON_ONCE() fires, which turns into a crash under
> >> >> > panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
> >> >> > against socket activity on the same fd, as reported by syzbot.
> >> >> >
> >> >> Given the syzbot report, if you are right (I suspect) then Eric delivered
> >> >> another half-baked croissant, and feel free to cut it off instead to make
> >> >> room for correct fix.
> >> >
> >> > Nobody (including you) caught this.difference between nbd and other
> >> > sock_allow_reclassification() callers.
> >> >
> >> Nope, actually it raises the question -- does the deadlock still remain
> >> after your fix without the lock key you added applied?
> >
> >LOCKDEP might have a false positive, but it will be much much harder to trigger.
> >
> >I had about 50 syzbot duplicates (that I did not release) before d532cddb6c60
> > ("nbd: Reclassify sockets to avoid lockdep circular dependency").
> >
> >>
> >> > What was the "correct fix" you envisioned exactly?
> >> >
> >> Frankly I had no evidence against your fix a couple days back, but now I
> >> see your lock key approach fails to take off. And the correct fix is to
> >> erase the incorrect locking order ffa1e7ada456 tries to catch, more
> >> difficult than you thought so far.
> >
> >Which incorrect locking order are you referring to? This is a LOCKDEP
> >false positive.
> >
> For archive purpose, syzbot report [1] where udp was not invovled defies
> what is fixed in d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep
> circular dependency") -- "Since the UDP socket and the NBD TCP/TLS socket
> are different, this is a false positive."
>
>
> [1] Subject: [syzbot] [net?] possible deadlock in inet_shutdown (3)
> https://lore.kernel.org/lkml/69c37e6a.a70a0220.234938.0045.GAE@google.com/


Why don't you send a patch if you think one is needed?

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-30  7:19           ` Eric Dumazet
@ 2026-06-30 12:24             ` Hillf Danton
  0 siblings, 0 replies; 13+ messages in thread
From: Hillf Danton @ 2026-06-30 12:24 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Tue, 30 Jun 2026 00:19:45 -0700 Eric Dumazet wrote:
> On Sun, Jun 28, 2026 at 10:29 PM Hillf Danton <hdanton@sina.com> wrote:
> > For archive purpose, syzbot report [1] where udp was not invovled defies
> > what is fixed in d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep
> > circular dependency") -- "Since the UDP socket and the NBD TCP/TLS socket
> > are different, this is a false positive."
> >
> >
> > [1] Subject: [syzbot] [net?] possible deadlock in inet_shutdown (3)
> > https://lore.kernel.org/lkml/69c37e6a.a70a0220.234938.0045.GAE@google.com/
> 
> Why don't you send a patch if you think one is needed?
>
Good question. It is a long standing tough issue, frankly more difficult than
I could cure it in one shoot at the cost of a couple weeks, particularly given
the rule of thumb -- delivering half baked croissants, HBC, as few as possible.

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-06-29  5:28         ` Hillf Danton
  2026-06-30  7:19           ` Eric Dumazet
@ 2026-07-20  2:23           ` Hillf Danton
  2026-07-20  2:39             ` Hillf Danton
  1 sibling, 1 reply; 13+ messages in thread
From: Hillf Danton @ 2026-07-20  2:23 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Eric Dumazet, Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Sun, Jun 28, 2026 at 10:29 PM Hillf Danton <hdanton@sina.com> wrote:
> For archive purpose, syzbot report [1] where udp was not invovled defies
> what is fixed in d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep
> circular dependency") -- "Since the UDP socket and the NBD TCP/TLS socket
> are different, this is a false positive."
>
>
> [1] Subject: [syzbot] [net?] possible deadlock in inet_shutdown (3)
> https://lore.kernel.org/lkml/69c37e6a.a70a0220.234938.0045.GAE@google.com/
>
For archive purpose, syzbot report [2] shows deadlock without either udp or
tcp invovled. But it sounds false positive because kernfs node is removed
while the filesystem is filling super block.

[2] Subject: [syzbot] [kernfs?] possible deadlock in kernfs_remove_by_name_ns (2)
https://lore.kernel.org/lkml/6a5ca0b7.f1649fcc.2a4208.03f3.GAE@google.com/

-> #1 (fs_reclaim){+.+.}-{0:0}:
       __fs_reclaim_acquire mm/page_alloc.c:4329 [inline]
       fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4343
       might_alloc include/linux/sched/mm.h:317 [inline]
       slab_pre_alloc_hook mm/slub.c:4565 [inline]
       slab_alloc_node mm/slub.c:4925 [inline]
       kmem_cache_alloc_lru_noprof+0x65/0x5f0 mm/slub.c:4978
       alloc_inode+0xb8/0x1b0 fs/inode.c:340
       iget_locked+0x131/0x6a0 fs/inode.c:1477
       kernfs_get_inode+0x4f/0x770 fs/kernfs/inode.c:252
       kernfs_fill_super fs/kernfs/mount.c:308 [inline]
       kernfs_get_tree+0x5cd/0x980 fs/kernfs/mount.c:392
       vfs_get_tree+0x92/0x2a0 fs/super.c:1694
       fc_mount fs/namespace.c:1198 [inline]
       do_new_mount_fc fs/namespace.c:3765 [inline]
       do_new_mount+0x319/0xdc0 fs/namespace.c:3841
       do_mount fs/namespace.c:4174 [inline]
       __do_sys_mount fs/namespace.c:4390 [inline]
       __se_sys_mount+0x31d/0x420 fs/namespace.c:4367
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&root->kernfs_rwsem){++++}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3165 [inline]
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain kernel/locking/lockdep.c:3908 [inline]
       __lock_acquire+0x1520/0x2cf0 kernel/locking/lockdep.c:5237
       lock_acquire+0x106/0x350 kernel/locking/lockdep.c:5868
       down_write+0x96/0x200 kernel/locking/rwsem.c:1631
       kernfs_remove_by_name_ns+0x4e/0x140 fs/kernfs/dir.c:1792
       _cfg80211_unregister_wdev+0x133/0x5a0 net/wireless/core.c:1420
       ieee80211_if_remove+0x289/0x340 net/mac80211/iface.c:2432
       ieee80211_del_iface+0x19/0x30 net/mac80211/cfg.c:254
       rdev_del_virtual_intf net/wireless/rdev-ops.h:62 [inline]
       cfg80211_remove_virtual_intf+0x221/0x3f0 net/wireless/util.c:3006
       cfg80211_destroy_ifaces+0x23f/0x300 net/wireless/core.c:436
       cfg80211_destroy_iface_wk+0x21/0x30 net/wireless/core.c:464
       process_one_work kernel/workqueue.c:3322 [inline]
       process_scheduled_works+0xa8e/0x14e0 kernel/workqueue.c:3405
       worker_thread+0xa47/0xfb0 kernel/workqueue.c:3486
       kthread+0x388/0x470 kernel/kthread.c:436
       ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

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

* Re: [PATCH] nbd: don't warn when reclassifying a busy socket lock
  2026-07-20  2:23           ` Hillf Danton
@ 2026-07-20  2:39             ` Hillf Danton
  0 siblings, 0 replies; 13+ messages in thread
From: Hillf Danton @ 2026-07-20  2:39 UTC (permalink / raw)
  To: Hillf Danton
  Cc: Eric Dumazet, Deepanshu Kartikey, linux-block, nbd, linux-kernel,
	syzbot+6b85d1e39a5b8ed9a954

On Mon, 20 Jul 2026 10:23:43 +0800 Hillf Danton wrote:
>On Sun, Jun 28, 2026 at 10:29 PM Hillf Danton <hdanton@sina.com> wrote:
>> For archive purpose, syzbot report [1] where udp was not invovled defies
>> what is fixed in d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep
>> circular dependency") -- "Since the UDP socket and the NBD TCP/TLS socket
>> are different, this is a false positive."
>>
>>
>> [1] Subject: [syzbot] [net?] possible deadlock in inet_shutdown (3)
>> https://lore.kernel.org/lkml/69c37e6a.a70a0220.234938.0045.GAE@google.com/
>>
>For archive purpose, syzbot report [2] shows deadlock without either udp or
>tcp invovled. But it sounds false positive because kernfs node is removed
>while the filesystem is filling super block.
>
>[2] Subject: [syzbot] [kernfs?] possible deadlock in kernfs_remove_by_name_ns (2)
>https://lore.kernel.org/lkml/6a5ca0b7.f1649fcc.2a4208.03f3.GAE@google.com/
>
For archive purpose, syzbot reports [3,4] show deadlock without either udp or
tcp invovled.

[3] Subject: [syzbot] [kernfs?] possible deadlock in kernfs_iop_permission (2)
https://lore.kernel.org/lkml/6a5d14b8.42649fcc.6186.0078.GAE@google.com/

[4] Subject: [syzbot] [kernel?] possible deadlock in netif_reset_xps_queues_gt (3)
https://lore.kernel.org/lkml/6a5d14b9.42649fcc.6186.0079.GAE@google.com/

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

end of thread, other threads:[~2026-07-20  2:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-21 23:52 [PATCH] nbd: don't warn when reclassifying a busy socket lock Deepanshu Kartikey
2026-06-22  1:43 ` Hillf Danton
2026-06-22  8:18   ` Eric Dumazet
2026-06-23  0:07     ` Hillf Danton
2026-06-23  0:21       ` Eric Dumazet
2026-06-23  0:44         ` Hillf Danton
2026-06-29  5:28         ` Hillf Danton
2026-06-30  7:19           ` Eric Dumazet
2026-06-30 12:24             ` Hillf Danton
2026-07-20  2:23           ` Hillf Danton
2026-07-20  2:39             ` Hillf Danton
2026-06-22  8:31 ` Eric Dumazet
2026-06-22 22:00 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox