From: Andrea Mayer <andrea.mayer@uniroma2.it>
To: Tristan Madani <tristmd@gmail.com>
Cc: netdev-bot+sinfo@kernel.org, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, tristan@talencesecurity.com,
david.lebrun@uclouvain.be, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, stable@vger.kernel.org,
stefano.salsano@uniroma2.it,
Andrea Mayer <andrea.mayer@uniroma2.it>
Subject: Re: [PATCH net] seg6: fix tun_src RCU lifetime on namespace teardown
Date: Mon, 26 Oct 2026 15:05:41 +0100 [thread overview]
Message-ID: <20261026150541.a5a34642db9d1523f839f644@uniroma2.it> (raw)
In-Reply-To: <20261025222222.1064464-1-tristan@talencesecurity.com>
On Sun, 25 Oct 2026 22:22:22 +0000
Tristan Madani <tristmd@gmail.com> wrote:
> Found by manual code inspection while auditing RCU lifetime
> patterns in the seg6 subsystem. The issue is theoretical --
> found by reading the source, not triggered in production.
Hi Tristan,
thanks for the info.
The pre_exit in this patch introduces a NULL deref. It sets tun_src to
NULL before the netns devices are removed, while set_tun_src() can
still read it.
I ran a stress test on net with KASAN. A userspace program sends UDP
packets in a loop from init_net through a veth into a test netns, where
a seg6 encap route without a per-route tunsrc forwards them. Meanwhile,
the test netns is created and deleted repeatedly.
With this patch applied, KASAN reported a null-ptr-deref in
set_tun_src() and the kernel panicked:
BUG: KASAN: null-ptr-deref in set_tun_src+0xd1/0x240
Read of size 8 at addr 0000000000000000 by task udp_flood_user/379
Call Trace:
<IRQ>
set_tun_src+0xd1/0x240
__seg6_do_srh_encap+0x410/0x710
seg6_do_srh+0x65e/0x6a0
seg6_input_core+0x87/0x4c0
lwtunnel_input+0x18d/0x420
ipv6_rcv+0x44f/0x460
__netif_receive_skb_one_core+0xd6/0x130
process_backlog+0x2cc/0xa00
__napi_poll.constprop.0+0x56/0x270
net_rx_action+0x327/0x730
handle_softirqs+0x15a/0x6c0
do_softirq+0xb4/0xf0
</IRQ>
<TASK>
__local_bh_enable_ip+0xdd/0x100
__dev_queue_xmit+0x538/0x1030
ip6_finish_output+0x280/0x640
ip6_output+0x118/0x380
ip6_send_skb+0x99/0x210
udp_v6_send_skb+0x397/0x760
udpv6_sendmsg+0x1100/0x14d0
__sys_sendto+0x219/0x2d0
...
Kernel panic - not syncing: Fatal exception in interrupt
Without this patch, I ran the same test with 1000 netns deletions and
KASAN reported nothing.
Ciao,
Andrea
next prev parent reply other threads:[~2026-10-26 14:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 19:52 Tristan Madani
2026-10-23 19:54 ` netdev-bot+sinfo
[not found] ` <20261025222222.1064464-1-tristan@talencesecurity.com>
2026-10-26 14:05 ` Andrea Mayer [this message]
2026-10-26 14:20 ` Eric Dumazet
2026-10-27 7:53 ` netdev-bot+sashiko
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=20261026150541.a5a34642db9d1523f839f644@uniroma2.it \
--to=andrea.mayer@uniroma2.it \
--cc=davem@davemloft.net \
--cc=david.lebrun@uclouvain.be \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sinfo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=stefano.salsano@uniroma2.it \
--cc=tristan@talencesecurity.com \
--cc=tristmd@gmail.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
all inboxes | Powered by JetHome®