syzbot
KCSAN: data-race in fib_table_flush / fib_table_lookup
Status:
moderation: reported on 2026/11/19 00:01
Subsystems:
net
Labels:
race:benign
prio:low
[Documentation on labels]
Reported-by: syzbot+0a8054531338de22fdbc@syzkaller.appspotmail.com
First crash: 1d17h, last: 21h39m
✨ AI-generated root cause summary:
In net/ipv4/fib_trie.c, struct key_vector::slen tracks the maximum suffix length of prefixes stored under a tnode or leaf. Lockless readers executing fib_table_lookup() under rcu_read_lock() perform unannotated plain loads of n->slen (e.g. lines 1478 and 1497) without READ_ONCE(), while concurrent writers executing fib_table_flush() under RTNL invoke update_suffix() which writes tn->slen in-place (line 737) without WRITE_ONCE(). This unsynchronized concurrent read/write access constitutes a data race detected by KCSAN.
▶
▼
✨ Full AI root cause analysis
Root Cause Analysis
1. Involved Functions, Structs, and Files
2. Technical Mechanism & Invariant Violation
- In the LPC-trie implementation (
net/ipv4/fib_trie.c), struct key_vector::slen denotes the maximum suffix length (KEYLENGTH - plen) found among all prefixes present in a node or in its subtree.
- In
fib_table_lookup(), readers traverse the trie locklessly without acquiring RTNL. Readers inspect n->slen with plain, unannotated reads:
- Step 1 (line 1478):
if (n->slen > n->pos) decides whether to remember the parent node pn and index cindex for backtracking when searching for shorter prefix matches.
- Step 2 (line 1497):
if (unlikely(prefix_mismatch(key, n)) || (n->slen == n->pos)) checks whether prefix mismatches occur or whether there are no remaining shorter prefixes that necessitate further backtracing.
- Concurrently, when routes associated with a netdevice are flushed (e.g., via
fib_table_flush() during device unregistration), the writer traverses the trie under RTNL, removes dead route aliases with hlist_del_rcu(), and calls update_suffix(pn) at line 2035 to recalculate and update the suffix lengths of parent nodes to account for removed child routes.
update_suffix() performs an in-place plain store to the live node:
tn->slen = slen;
at line 737.
- Because
tn->slen is updated in-place without WRITE_ONCE() while lockless RCU readers inspect n->slen without READ_ONCE(), concurrent execution on multiple CPUs triggers a KCSAN data race report between fib_table_flush and fib_table_lookup.
Sample crash report:
* Struck through repros no longer work on HEAD.