From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <danielyangkang@gmail.com>
Cc: <alibuda@linux.alibaba.com>, <davem@davemloft.net>,
<edumazet@google.com>, <guwen@linux.alibaba.com>,
<jaka@linux.ibm.com>, <kuba@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-s390@vger.kernel.org>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>,
<syzbot+e953a8f3071f5c0a28fd@syzkaller.appspotmail.com>,
<tonylu@linux.alibaba.com>, <wenjia@linux.ibm.com>,
<kuniyu@amazon.com>
Subject: Re: [PATCH] fixed rtnl deadlock from gtp
Date: Tue, 1 Oct 2024 06:03:49 +0300 [thread overview]
Message-ID: <20241001030349.97635-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20241001015555.144669-1-danielyangkang@gmail.com>
From: Daniel Yang <danielyangkang@gmail.com>
Date: Mon, 30 Sep 2024 18:55:54 -0700
> Fixes deadlock described in this bug:
> https://syzkaller.appspot.com/bug?extid=e953a8f3071f5c0a28fd.
> Specific crash report here:
> https://syzkaller.appspot.com/text?tag=CrashReport&x=14670e07980000.
>
> DESCRIPTION OF ISSUE
> Deadlock: sk_lock-AF_INET --> &smc->clcsock_release_lock --> rtnl_mutex
>
> rtnl_mutex->sk_lock-AF_INET
> rtnetlink_rcv_msg() acquires rtnl_lock() and calls rtnl_newlink(), which
> eventually calls gtp_newlink() which calls lock_sock() to attempt to
> acquire sk_lock.
Is the deadlock real ?
From the lockdep splat, the gtp's sk_protocol is verified to be
IPPROTO_UDP before holding lock_sock(), so it seems just a labeling
issue.
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/drivers/net/gtp.c?id=9410645520e9b820069761f3450ef6661418e279#n1674
>
> sk_lock-AF_INET->&smc->clcsock_release_lock
> smc_sendmsg() calls lock_sock() to acquire sk_lock, then calls
> smc_switch_to_fallback() which attempts to acquire mutex_lock(&smc->...).
>
> &smc->clcsock_release_lock->rtnl_mutex
> smc_setsockopt() calls mutex_lock(&smc->...). smc->...->setsockopt() is
> called, which calls nf_setsockopt() which attempts to acquire
> rtnl_lock() in some nested call in start_sync_thread() in ip_vs_sync.c.
>
> FIX:
> In smc_switch_to_fallback(), separate the logic into inline function
> __smc_switch_to_fallback(). In smc_sendmsg(), lock ordering can be
> modified and the functionality of smc_switch_to_fallback() is
> encapsulated in the __smc_switch_to_fallback() function.
next prev parent reply other threads:[~2024-10-01 3:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 1:55 [PATCH] fixed rtnl deadlock from gtp Daniel Yang
2024-10-01 3:03 ` Kuniyuki Iwashima [this message]
[not found] ` <CAGiJo8Rmr2JJ0cCuGDGUeM-fNXdF1L1==bBqJdcCxBkJUTHzuw@mail.gmail.com>
2024-10-01 7:46 ` Eric Dumazet
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=20241001030349.97635-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=alibuda@linux.alibaba.com \
--cc=danielyangkang@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=guwen@linux.alibaba.com \
--cc=jaka@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+e953a8f3071f5c0a28fd@syzkaller.appspotmail.com \
--cc=tonylu@linux.alibaba.com \
--cc=wenjia@linux.ibm.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