From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <dw@davidwei.uk>
Cc: <avagin@gmail.com>, <davem@davemloft.net>, <dsahern@kernel.org>,
<edumazet@google.com>, <kuba@kernel.org>, <kuniyu@amazon.com>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>,
<syzbot+71e724675ba3958edb31@syzkaller.appspotmail.com>,
<syzkaller-bugs@googlegroups.com>
Subject: Re: [syzbot] [net?] WARNING in inet_csk_get_port (2)
Date: Wed, 8 Nov 2023 09:45:25 -0800 [thread overview]
Message-ID: <20231108174525.1452-1-kuniyu@amazon.com> (raw)
In-Reply-To: <1d1f7518-6ff9-4402-a874-5c0138bedefd@davidwei.uk>
From: David Wei <dw@davidwei.uk>
Date: Wed, 8 Nov 2023 08:11:56 -0800
> On 2023-09-20 11:59, Kuniyuki Iwashima wrote:
> > From: syzbot <syzbot+71e724675ba3958edb31@syzkaller.appspotmail.com>
> > Date: Wed, 20 Sep 2023 11:02:55 -0700
> >> Hello,
> >>
> >> syzbot found the following issue on:
> >>
> >> HEAD commit: 2cf0f7156238 Merge tag 'nfs-for-6.6-2' of git://git.linux-..
> >> git tree: upstream
> >> console+strace: https://syzkaller.appspot.com/x/log.txt?x=17405ab0680000
> >> kernel config: https://syzkaller.appspot.com/x/.config?x=d594086f139d167
> >> dashboard link: https://syzkaller.appspot.com/bug?extid=71e724675ba3958edb31
> >> compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
> >> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16b2e118680000
> >> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=127b55c4680000
> >>
> >> Downloadable assets:
> >> disk image: https://storage.googleapis.com/syzbot-assets/456b02029fa8/disk-2cf0f715.raw.xz
> >> vmlinux: https://storage.googleapis.com/syzbot-assets/9f9ff0c00454/vmlinux-2cf0f715.xz
> >> kernel image: https://storage.googleapis.com/syzbot-assets/0ede19fba30f/bzImage-2cf0f715.xz
> >>
> >> The issue was bisected to:
> >>
> >> commit c48ef9c4aed3632566b57ba66cec6ec78624d4cb
> >> Author: Kuniyuki Iwashima <kuniyu@amazon.com>
> >> Date: Mon Sep 11 18:36:57 2023 +0000
> >>
> >> tcp: Fix bind() regression for v4-mapped-v6 non-wildcard address.
> >>
> >
> > We need this condition to put v4 sk and v4-mapped-v6 sk into
> > the same bucket.
> >
> > ---8<---
> > diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
> > index dfb1c61c0c2b..6487357d1ddd 100644
> > --- a/net/ipv4/inet_hashtables.c
> > +++ b/net/ipv4/inet_hashtables.c
> > @@ -822,7 +823,8 @@ static bool inet_bind2_bucket_match(const struct inet_bind2_bucket *tb,
> > return ipv6_addr_v4mapped(&tb->v6_rcv_saddr) &&
> > tb->v6_rcv_saddr.s6_addr32[3] == sk->sk_rcv_saddr;
> >
> > - return false;
> > + return ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr) &&
> > + sk->sk_v6_rcv_saddr.s6_addr32[3] == tb->rcv_saddr;
> > }
> >
> > if (sk->sk_family == AF_INET6)
> > ---8<---
> >
> > Scenario is like
> >
> > 1) bind(v4) creates a tb2 bucket
> > 2) bind(v4-mapped-v6) creates another tb2 bucket
> > 3) listen(v4) finds the second tb2 and trigger warning
> >
> > ---8<---
> > from socket import *
> >
> > s = socket()
> > s.setsockopt(SOL_SOCKET, SO_REUSEPORT, 1)
> > s.bind(('255.255.255.255', 0))
> >
> > s2 = socket(AF_INET6, SOCK_STREAM)
> > s2.setsockopt(SOL_SOCKET, SO_REUSEPORT, 1)
> > s2.bind(('::ffff:255.255.255.255', s.getsockname()[1]))
> > s.listen()
> > ---8<---
> >
> > Will post a formal patch after doing more tests with SO_REUSEPORT.
> >
> > Thanks!
>
> Hi Kuniyuki, did you get around to fixing and posting this patch? I
> couldn't find anything on the mailing list.
>
> Would you like help fixing this?
Hi,
It's fixed by this patch.
https://lore.kernel.org/netdev/20231010013814.70571-1-kuniyu@amazon.com/
Thanks
prev parent reply other threads:[~2023-11-08 17:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 18:02 syzbot
2023-09-20 18:59 ` Kuniyuki Iwashima
2023-11-08 16:11 ` David Wei
2023-11-08 17:45 ` Kuniyuki Iwashima [this message]
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=20231108174525.1452-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=avagin@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+71e724675ba3958edb31@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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
Powered by JetHome