[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250401220735.94909-1-kuniyu@amazon.com>
Date: Tue, 1 Apr 2025 14:58:40 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <ychemla@...dia.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <horms@...nel.org>,
<kuba@...nel.org>, <kuni1840@...il.com>, <kuniyu@...zon.com>,
<netdev@...r.kernel.org>, <pabeni@...hat.com>
Subject: Re: [PATCH v5 net 2/3] net: Fix dev_net(dev) race in unregister_netdevice_notifier_dev_net().
Hi Yael,
Thanks for testing!
From: Yael Chemla <ychemla@...dia.com>
Date: Tue, 1 Apr 2025 23:49:42 +0300
> Hi Kuniyuki,
> Sorry for the delay (I was OOO). I tested your patch, and while the race
> occurs much less frequently, it still happens—see the warnings and call
> traces below.
> Additionally, in some cases, the test which reproduce the race hang.
> Debugging shows that we're stuck in an endless loop inside
> rtnl_net_dev_lock because the passive refcount is already zero, causing
> net_passive_inc_not_zero to return false, thus it go to "again" and this
> repeats without ending.
> I suspect, as you mentioned before, that in such cases, the passive
> refcount was decreased from cleanup_net.
This sounds weird.
We assumed vif will be moved to init_net, then the infinite loop
should never happen.
So the assumption was wrong and vif belonged to the dead netns and
was not moved to init_net ... ??
Even if dev_change_net_namespace() fails, it leads to BUG().
>
>
> warnings and call traces:
>
> refcount_t: addition on 0; use-after-free.
I guess this is from the old log or the test patch was not applied
because _inc_not_zero() will trigger REFCOUNT_ADD_NOT_ZERO_OVF and
then the message will be
refcount_t: saturated; leaking memory
, see __refcount_add_not_zero() and refcount_warn_saturate().
> WARNING: CPU: 4 PID: 27219 at lib/refcount.c:25 refcount_warn_saturate
> (/usr/work/linux/lib/refcount.c:25 (discriminator 1))
Powered by blists - more mailing lists