From: Zhou Qiuyue <n0ps1edzz@gmail.com>
To: netdev@vger.kernel.org
Cc: David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
David S. Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Hangbin Liu <hangbin.liu@linux.dev>
Subject: [PATCH net v2 0/4] net: fix dst->dev lifetime races
Date: Fri, 27 Nov 2026 12:38:01 +0800 [thread overview]
Message-ID: <cover.1795754281.git.n0ps1edzz@gmail.com> (raw)
The conversion of dst->dev to an RCU-protected pointer left two route
confirmation callbacks and the IPv6 neighbour lookup callback loading it
without RCU protection. Also, netdev_run_todo() did not wait for readers
after flushing routes that can release the last dst-held device reference.
Patch 1 adds the teardown-side grace period after the route flushes.
Patches 2 and 3 protect the IPv4 and IPv6 confirmation callbacks. Patch 4
protects the IPv6 neighbour lookup callback, matching its IPv4 counterpart.
Finding and validation:
- Patches 2 and 3 came from an AI-assisted source audit. Delay-assisted
KASAN runs on the exact v7.4-rc3 commit reproduced both bugs:
BUG: KASAN: slab-use-after-free in ipv4_confirm_neigh+0xcc8/0xce0
BUG: KASAN: slab-use-after-free in ip6_confirm_neigh+0x6a7/0xbd0
The delay was debug-only window amplification and is not in this series.
- Ido identified the missing grace period in patch 1 and the unprotected
lookup in patch 4 during review. Both were validated by source inspection;
those two windows have not been triggered independently at runtime.
Testing:
- KASAN reruns on v7.4-rc2 with the callback fixes corresponding to
patches 2 and 3 completed without a report. The IPv4 run made 392065
callback calls across 110 dst_dev_put() calls and 48 device frees. The
IPv6 run made 13144 callback calls across 36 dst_dev_put() calls and 48
device frees.
- On the current net tree base below, these objects built with W=1:
net/core/dev.o, net/ipv4/route.o, and net/ipv6/route.o.
- A full allmodconfig or allyesconfig build and networking selftests were not
run.
This is treated as a regular bug: the demonstrated teardown needs privileged
network-device administration, and no privilege-boundary crossing or exploit
has been demonstrated.
Changes since v1:
- Combine the separate IPv4 and IPv6 submissions into one series, as
requested by Ido and Kuniyuki.
- Add the post-flush synchronize_net() patch suggested by Ido.
- Add the ip6_dst_neigh_lookup() patch suggested by Ido.
- Distinguish the dynamically reproduced findings from the source-inspection
findings and document the validation limits.
v1 IPv6:
https://lore.kernel.org/netdev/20261123133000.1.n0ps1edzz@gmail.com/
v1 IPv4:
https://lore.kernel.org/netdev/20261123133000.2.n0ps1edzz@gmail.com/
Review:
https://lore.kernel.org/netdev/20261125190113.GA421469@shredder/
AI assistance disclosure: Codex was used for the source audit, test-harness
automation, patch drafting, and changelog drafting. The runtime results above
come from the described QEMU/KASAN runs. The Signed-off-by tags were added at
the submitter's explicit request.
Zhou Qiuyue (4):
net: wait for RCU readers after flushing routes
ipv4: route: fix use-after-free in ipv4_confirm_neigh()
ipv6: route: fix use-after-free in ip6_confirm_neigh()
ipv6: route: fix use-after-free in ip6_dst_neigh_lookup()
net/core/dev.c | 1 +
net/ipv4/route.c | 12 +++++++++---
net/ipv6/route.c | 24 ++++++++++++++++++------
3 files changed, 28 insertions(+), 9 deletions(-)
base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267
--
2.56.1.windows.1
next reply other threads:[~2026-11-27 5:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 4:38 Zhou Qiuyue [this message]
2026-11-27 4:03 ` [PATCH net v2 1/4] net: wait for RCU readers after flushing routes Zhou Qiuyue
2026-11-28 6:42 ` netdev-bot+sashiko
2026-11-27 4:03 ` [PATCH net v2 2/4] ipv4: route: fix use-after-free in ipv4_confirm_neigh() Zhou Qiuyue
2026-11-28 6:42 ` netdev-bot+sashiko
2026-11-27 4:03 ` [PATCH net v2 3/4] ipv6: route: fix use-after-free in ip6_confirm_neigh() Zhou Qiuyue
2026-11-27 4:03 ` [PATCH net v2 4/4] ipv6: route: fix use-after-free in ip6_dst_neigh_lookup() Zhou Qiuyue
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=cover.1795754281.git.n0ps1edzz@gmail.com \
--to=n0ps1edzz@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=hangbin.liu@linux.dev \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.