From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <william.xuanziyang@huawei.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>,
<joannelkoong@gmail.com>, <kuba@kernel.org>, <kuni1840@gmail.com>,
<kuniyu@amazon.com>, <martin.lau@kernel.org>,
<mathew.j.martineau@linux.intel.com>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>
Subject: Re: [RFC] bhash2 and WARN_ON() for inconsistent sk saddr.
Date: Tue, 1 Nov 2022 12:22:11 -0700 [thread overview]
Message-ID: <20221101192211.33498-1-kuniyu@amazon.com> (raw)
In-Reply-To: <4bd122d2-d606-b71e-dbe7-63fa293f0a73@huawei.com>
From: "Ziyang Xuan (William)" <william.xuanziyang@huawei.com>
Date: Tue, 1 Nov 2022 15:08:15 +0800
> Hello Kuniyuki Iwashima,
>
> > Hi,
> >
> > I want to discuss bhash2 and WARN_ON() being fired every day this month
> > on my syzkaller instance without repro.
> >
> > WARNING: CPU: 0 PID: 209 at net/ipv4/inet_connection_sock.c:548 inet_csk_get_port (net/ipv4/inet_connection_sock.c:548 (discriminator 1))
> > ...
> > inet_csk_listen_start (net/ipv4/inet_connection_sock.c:1205)
> > inet_listen (net/ipv4/af_inet.c:228)
> > __sys_listen (net/socket.c:1810)
> > __x64_sys_listen (net/socket.c:1819 net/socket.c:1817 net/socket.c:1817)
> > do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
> > entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
> >
> > For the very first implementation of bhash2, there was a similar report
> > hitting the same WARN_ON(). The fix was to update the bhash2 bucket when
> > the kernel changes sk->sk_rcv_saddr from INADDR_ANY. Then, syzbot has a
> > repro, so we can indeed confirm that it no longer triggers the warning on
> > the latest kernel.
> >
> > https://lore.kernel.org/netdev/0000000000003f33bc05dfaf44fe@google.com/
> >
> > However, Mat reported at that time that there were at least two variants,
> > the latter being the same as mine.
> >
> > https://lore.kernel.org/netdev/4bae9df4-42c1-85c3-d350-119a151d29@linux.intel.com/
> > https://lore.kernel.org/netdev/23d8e9f4-016-7de1-9737-12c3146872ca@linux.intel.com/
> >
> > This week I started looking into this issue and finally figured out
> > why we could not catch all cases with a single repro.
> >
>
> Provide another C repro for analysis. See the attachment.
Thanks for another variant.
Your repro also fails to connect() by RST, which resets saddr without
updating bhash2 bucket, and then listen() hits the WARN_ON().
I meant to say if there was no difference in failure paths we should
have caught all places where we need fixes with a single repro.
Once we know the root cause, it's not so hard to generate variants.
Anyway, I'll post a patch for consistent error handling and later
another patch to fix the root cause when I find a solid way.
next prev parent reply other threads:[~2022-11-01 19:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-29 0:12 [RFC] bhash2 and WARN_ON() for inconsistent sk saddr Kuniyuki Iwashima
2022-11-01 7:08 ` Ziyang Xuan (William)
2022-11-01 19:22 ` Kuniyuki Iwashima [this message]
2022-11-01 23:29 ` Martin KaFai Lau
2022-11-02 0:57 ` Joanne Koong
2022-11-02 18:35 ` Kuniyuki Iwashima
2022-11-04 4:58 ` Martin KaFai Lau
2022-11-07 22:20 ` Joanne Koong
2022-11-08 1:27 ` Kuniyuki Iwashima
2022-11-08 17:40 ` Joanne Koong
2022-11-08 19:49 ` Kuniyuki Iwashima
2022-11-08 22:02 ` Joanne Koong
2022-11-08 22:44 ` Kuniyuki Iwashima
2022-11-10 3:00 ` Joanne Koong
2022-11-10 20:19 ` Kuniyuki Iwashima
2022-11-10 21:45 ` Joanne Koong
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=20221101192211.33498-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joannelkoong@gmail.com \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=martin.lau@kernel.org \
--cc=mathew.j.martineau@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=william.xuanziyang@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;
as well as URLs for NNTP newsgroup(s).