Subject: Re: [PATCH net-next] ipv6: add IPV6_CALL() helper

From: Jakub Kicinski <[email-masked]>
Date: Sun, 1 Mar 2026 11:24:13 -0800

On Sun,  1 Mar 2026 16:25:14 +0000 Eric Dumazet wrote:
> ipv6_stub use is racy, we should add READ_ONCE() and WRITE_ONCE(),
> even if this pointer can only change once.
> 
> Add IPV6_CALL() macro to factorize the READ_ONCE(), and perform
> direct calls when CONFIG_IPV6=y.

Some crashiness detected here, I think
pw-bot: cr

[ 1831.476440][ T4627] =============================
[ 1831.476614][ T4627] WARNING: suspicious RCU usage
[ 1831.476776][ T4627] 7.0.0-rc1-virtme #1 Not tainted
[ 1831.476955][ T4627] -----------------------------
[ 1831.477119][ T4627] net/ipv6/ip6_fib.c:111 suspicious rcu_dereference_protected() usage!
[ 1831.477338][ T4627] 
[ 1831.477338][ T4627] other info that might help us debug this:
[ 1831.477338][ T4627] 
[ 1831.477613][ T4627] 
[ 1831.477613][ T4627] rcu_scheduler_active = 2, debug_locks = 1
[ 1831.477831][ T4627] 1 lock held by ip/4627:
[ 1831.477975][ T4627]  #0: ffffffff950a1d28 (rtnl_mutex){+.+.}-{4:4}, at: rtm_new_nexthop+0x1a6/0x8c0
[ 1831.478234][ T4627] 
[ 1831.478234][ T4627] stack backtrace:
[ 1831.478423][ T4627] CPU: 2 UID: 0 PID: 4627 Comm: ip Not tainted 7.0.0-rc1-virtme #1 PREEMPT(full) 
[ 1831.478427][ T4627] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 1831.478429][ T4627] Call Trace:
[ 1831.478431][ T4627]  <TASK>
[ 1831.478433][ T4627]  dump_stack_lvl+0x6f/0xa0
[ 1831.478440][ T4627]  lockdep_rcu_suspicious.cold+0x4f/0xad
[ 1831.478445][ T4627]  fib6_update_sernum+0xfb/0x130
[ 1831.478450][ T4627]  nh_rt_cache_flush+0x8d/0x380
[ 1831.478454][ T4627]  replace_nexthop+0x347/0x6e0
[ 1831.478458][ T4627]  insert_nexthop+0x41e/0x7a0
[ 1831.478460][ T4627]  ? nexthop_create+0x307/0x770
[ 1831.478463][ T4627]  rtm_new_nexthop+0x3a0/0x8c0
[ 1831.478467][ T4627]  ? insert_nexthop+0x7a0/0x7a0
[ 1831.478468][ T4627]  ? lock_acquire.part.0+0xbc/0x260
[ 1831.478471][ T4627]  ? find_held_lock+0x2b/0x80
[ 1831.478478][ T4627]  ? lock_acquire.part.0+0xbc/0x260
[ 1831.478479][ T4627]  ? find_held_lock+0x2b/0x80
[ 1831.478485][ T4627]  ? find_held_lock+0x2b/0x80
[ 1831.478487][ T4627]  ? insert_nexthop+0x7a0/0x7a0
[ 1831.478489][ T4627]  ? __lock_release.isra.0+0x59/0x170
[ 1831.478492][ T4627]  ? insert_nexthop+0x7a0/0x7a0
[ 1831.478494][ T4627]  rtnetlink_rcv_msg+0x6fe/0xb90
[ 1831.478499][ T4627]  ? rtnl_fdb_dump+0x620/0x620
[ 1831.478501][ T4627]  ? __lock_acquire+0x577/0xc10
[ 1831.478511][ T4627]  ? lock_acquire.part.0+0xbc/0x260
[ 1831.478513][ T4627]  ? find_held_lock+0x2b/0x80
[ 1831.478516][ T4627]  netlink_rcv_skb+0x123/0x380
[ 1831.478519][ T4627]  ? rtnl_fdb_dump+0x620/0x620
[ 1831.478522][ T4627]  ? netlink_ack+0xce0/0xce0
[ 1831.478527][ T4627]  ? netlink_deliver_tap+0xc5/0x330
[ 1831.478529][ T4627]  ? netlink_deliver_tap+0x13f/0x330
[ 1831.478533][ T4627]  netlink_unicast+0x4a3/0x770
[ 1831.478536][ T4627]  ? netlink_attachskb+0x810/0x810
[ 1831.478537][ T4627]  ? __alloc_skb+0x4c4/0x5f0
[ 1831.478540][ T4627]  ? napi_skb_cache_get+0x7a0/0x7a0
[ 1831.478542][ T4627]  ? lock_acquire.part.0+0xbc/0x260
[ 1831.478544][ T4627]  ? __lock_acquire+0x577/0xc10
[ 1831.478547][ T4627]  netlink_sendmsg+0x735/0xc60
[ 1831.478550][ T4627]  ? netlink_unicast+0x770/0x770
[ 1831.478553][ T4627]  ? __might_fault+0x97/0x140
[ 1831.478559][ T4627]  ____sys_sendmsg+0x419/0x850
[ 1831.478561][ T4627]  ? copy_msghdr_from_user+0x270/0x430
[ 1831.478563][ T4627]  ? get_timestamp.constprop.0+0x390/0x390
[ 1831.478564][ T4627]  ? move_addr_to_kernel+0x40/0x40
[ 1831.478567][ T4627]  ? stack_depot_save_flags+0x30d/0x6e0
[ 1831.478571][ T4627]  ? rcu_read_lock_any_held+0x3c/0x90
[ 1831.478576][ T4627]  ___sys_sendmsg+0xfd/0x180
[ 1831.478578][ T4627]  ? __call_rcu_common.constprop.0+0xa6/0xa00
[ 1831.478581][ T4627]  ? copy_msghdr_from_user+0x430/0x430
[ 1831.478595][ T4627]  __sys_sendmsg+0x124/0x1c0
[ 1831.478597][ T4627]  ? __sys_sendmsg_sock+0x20/0x20
[ 1831.478599][ T4627]  ? lockdep_hardirqs_on+0x84/0x130
[ 1831.478603][ T4627]  ? __call_rcu_common.constprop.0+0x3bd/0xa00
[ 1831.478608][ T4627]  ? do_raw_spin_unlock+0x59/0x250
[ 1831.478610][ T4627]  ? rcu_is_watching+0x15/0xd0
[ 1831.478613][ T4627]  do_syscall_64+0x117/0xfc0
[ 1831.478615][ T4627]  ? exc_page_fault+0xaf/0xd0
[ 1831.478617][ T4627]  entry_SYSCALL_64_after_hwframe+0x4b/0x53