From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <ychemla@nvidia.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <horms@kernel.org>,
<kuba@kernel.org>, <kuni1840@gmail.com>, <kuniyu@amazon.com>,
<netdev@vger.kernel.org>, <pabeni@redhat.com>
Subject: Re: [PATCH v5 net 2/3] net: Fix dev_net(dev) race in unregister_netdevice_notifier_dev_net().
Date: Tue, 1 Apr 2025 14:58:40 -0700 [thread overview]
Message-ID: <20250401220735.94909-1-kuniyu@amazon.com> (raw)
In-Reply-To: <6ce063ee-85cc-4930-839a-36b3155c9820@nvidia.com>
Hi Yael,
Thanks for testing!
From: Yael Chemla <ychemla@nvidia.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))
next prev parent reply other threads:[~2025-04-01 22:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 19:11 [PATCH v5 net 0/3] net: Fix race of rtnl_net_lock(dev_net(dev)) Kuniyuki Iwashima
2025-02-17 19:11 ` [PATCH v5 net 1/3] net: Add net_passive_inc() and net_passive_dec() Kuniyuki Iwashima
2025-02-17 19:11 ` [PATCH v5 net 2/3] net: Fix dev_net(dev) race in unregister_netdevice_notifier_dev_net() Kuniyuki Iwashima
2025-03-26 13:46 ` Yael Chemla
2025-03-26 21:54 ` Kuniyuki Iwashima
2025-03-26 22:10 ` Eric Dumazet
2025-03-26 22:32 ` Kuniyuki Iwashima
2025-04-01 20:49 ` Yael Chemla
2025-04-01 21:58 ` Kuniyuki Iwashima [this message]
2025-04-06 15:37 ` Yael Chemla
2025-04-23 11:47 ` Yael Chemla
2025-02-17 19:11 ` [PATCH v5 net 3/3] dev: Use rtnl_net_dev_lock() in unregister_netdev() Kuniyuki Iwashima
2025-02-19 2:50 ` [PATCH v5 net 0/3] net: Fix race of rtnl_net_lock(dev_net(dev)) patchwork-bot+netdevbpf
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=20250401220735.94909-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuni1840@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ychemla@nvidia.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).