[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240811145443.GD13736@breakpoint.cc>
Date: Sun, 11 Aug 2024 16:54:43 +0200
From: Florian Westphal <fw@...len.de>
To: Florian Westphal <fw@...len.de>
Cc: Kuniyuki Iwashima <kuniyu@...zon.com>,
syzbot+8ea26396ff85d23a8929@...kaller.appspotmail.com,
davem@...emloft.net, dsahern@...nel.org, edumazet@...gle.com,
kuba@...nel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, pabeni@...hat.com,
syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [net?] WARNING: refcount bug in inet_twsk_kill
Florian Westphal <fw@...len.de> wrote:
> > I came up with the diff below but was suspecting a bug in another place,
> > possibly QEMU, so I haven't posted the diff officially.
> >
> > refcount_inc() was actually deferred, but it's still under an ehash lock,
>
> but different struct inet_hashinfo, so the locks don't help :/
No, fallback is fine: pernet tw_refcount, init_net ehash lock array. so
they same buckets should serialize on same ehash lock.
https://syzkaller.appspot.com/x/log.txt?x=117f3182980000
... shows at two cores racing:
[ 3127.234402][ T1396] CPU: 3 PID: 1396 Comm: syz-executor.3 Not
and
[ 3127.257864][ T13] CPU: 1 PID: 13 Comm: kworker/u32:1 Not tainted 6.9.0-syzkalle (netns cleanup net).
first splat backtrace shows invocation of tcp_sk_exit_batch() from
netns error unwinding code.
Second one lacks backtrace, but its also in tcp_sk_exit_batch(),
likely walking init_net tcp_hashinfo.
The warn of second core is:
WARN_ON_ONCE(!refcount_dec_and_test(&net->ipv4.tcp_death_row.tw_refcount));
Looks like somehow netns cleanup work queue skipped at least one tw sk,
hitting above splat.
Then, first core did refcount_dec() on tw_refcount, which produces
dec-to-0 warn (which makes sense if "supposedly final" decrement was
already done.
Powered by blists - more mailing lists