mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: Eric Dumazet <edumazet@google.com>,
	syzbot <syzbot+e1cd6bd8493060bd701d@syzkaller.appspotmail.com>,
	Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>
Cc: davem@davemloft.net, dsahern@kernel.org, horms@kernel.org,
	kuba@kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, ming.lei@redhat.com,
	netdev@vger.kernel.org, pabeni@redhat.com,
	syzkaller-bugs@googlegroups.com,
	thomas.hellstrom@linux.intel.com,
	"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [syzbot] [net?] possible deadlock in inet_shutdown
Date: Mon, 8 Sep 2025 16:52:44 +0800	[thread overview]
Message-ID: <c035df1c-abaf-9173-032f-3dd91b296101@huaweicloud.com> (raw)
In-Reply-To: <CANn89iJaY+MJPUJgtowZOPwHaf8ToNVxEyFN9U+Csw9+eB7YHg@mail.gmail.com>

Hi,

在 2025/09/06 17:16, Eric Dumazet 写道:
> On Fri, Sep 5, 2025 at 1:03 PM Eric Dumazet <edumazet@google.com> wrote:
>>
>> On Fri, Sep 5, 2025 at 1:00 PM syzbot
>> <syzbot+e1cd6bd8493060bd701d@syzkaller.appspotmail.com> wrote:
> 
> Note to NBD maintainers : I held about  20 syzbot reports all pointing
> to NBD accepting various sockets, I  can release them if needed, if you prefer
> to triage them.
> 
I'm not NBD maintainer, just trying to understand the deadlock first.

Is this deadlock only possible for some sepecific socket types? Take
a look at the report here:

Usually issue IO will require the order:

q_usage_counter -> cmd lock -> tx lock -> sk lock

Hence the condition is that if the sock_sendmsg() will hold sk lock to
allocate new memory, and can trigger fs reclaim, and finally issue new
IO to this nbd?

Thanks,
Kuai

>>
>> Question to NBD maintainers.
>>
>> What socket types are supposed to be supported by NBD ?
>>
>> I was thinking adding a list of supported ones, assuming TCP and
>> stream unix are the only ones:
>>
>> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
>> index 6463d0e8d0ce..87b0b78249da 100644
>> --- a/drivers/block/nbd.c
>> +++ b/drivers/block/nbd.c
>> @@ -1217,6 +1217,14 @@ static struct socket *nbd_get_socket(struct
>> nbd_device *nbd, unsigned long fd,
>>          if (!sock)
>>                  return NULL;
>>
>> +       if (!sk_is_tcp(sock->sk) &&
>> +           !sk_is_stream_unix(sock->sk)) {
>> +               dev_err(disk_to_dev(nbd->disk), "Unsupported socket:
>> should be TCP or UNIX.\n");
>> +               *err = -EINVAL;
>> +               sockfd_put(sock);
>> +               return NULL;
>> +       }
>> +
>>          if (sock->ops->shutdown == sock_no_shutdown) {
>>                  dev_err(disk_to_dev(nbd->disk), "Unsupported socket:
>> shutdown callout must be supported.\n");
>>                  *err = -EINVAL;
> 
> .
> 


  reply	other threads:[~2025-09-08  8:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05 20:00 syzbot
2025-09-05 20:03 ` Eric Dumazet
2025-09-06  9:16   ` Eric Dumazet
2025-09-08  8:52     ` Yu Kuai [this message]
2025-09-08  9:07       ` Eric Dumazet
2025-09-08  9:34         ` Yu Kuai
2025-09-08  9:40           ` Eric Dumazet
2025-09-09  9:16             ` Yu Kuai
2025-09-09  9:31               ` Eric Dumazet
2025-09-08 13:03         ` Hillf Danton
2025-09-08 14:26   ` Jens Axboe

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=c035df1c-abaf-9173-032f-3dd91b296101@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kuba@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+e1cd6bd8493060bd701d@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=yukuai3@huawei.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

all inboxes | Powered by JetHome®