syzbot
KCSAN: data-race in __dev_change_flags / is_ndev_for_default_gid_filter (5)
Status:
moderation: reported on 2026/11/19 00:02
Subsystems:
rdma
Labels:
prio:low
race:benign
[Documentation on labels]
Reported-by: syzbot+7c6b452f20b74f8baa85@syzkaller.appspotmail.com
First crash: 1d16h, last: 3h11m
✨ AI-generated root cause summary:
A data race occurs on net_device::flags between __dev_change_flags() updating interface flags under RTNL lock and netif_is_bond_master() reading dev->flags locklessly (under RCU) from is_ndev_for_default_gid_filter() in the RoCE GID management workqueue. __dev_change_flags() writes to dev->flags via a plain assignment without WRITE_ONCE(), unlike other flag mutators such as __dev_set_promiscuity() and netif_set_allmulti(). Simultaneously, netif_is_bond_master() (and netif_is_bond_slave()) inspects dev->flags using a plain read without READ_ONCE(), triggering a KCSAN data race warning.
▶
▼
✨ Full AI root cause analysis
Root Cause Analysis
1. Functions, Structs, and Fields Involved
2. Technical Mechanism and Trigger Condition
-
Concurrent Writers and Readers on dev->flags:
-
Lockless Reader Path:
- Network device event notifications in the InfiniBand/RoCE subsystem enqueue asynchronous work (
netdevice_queue_work()) onto the gid-cache-wq workqueue.
- The worker function
netdevice_event_work_handler() processes these events without holding the RTNL lock. Instead, it holds an active reference (dev_hold()) and runs under rcu_read_lock() while iterating devices:
static bool is_ndev_for_default_gid_filter(struct ib_device *ib_dev, u32 port,
struct net_device *rdma_ndev,
void *cookie)
{
...
rcu_read_lock();
res = ((cookie_ndev == rdma_ndev && !netif_is_bond_slave(rdma_ndev)) ||
(netif_is_bond_master(cookie_ndev) &&
rdma_is_upper_dev_rcu(rdma_ndev, cookie_ndev)));
rcu_read_unlock();
return res;
}
netif_is_bond_master() (and netif_is_bond_slave()) in include/linux/netdevice.h:
static inline bool netif_is_bond_master(const struct net_device *dev)
{
return dev->flags & IFF_MASTER && dev->priv_flags & IFF_BONDING;
}
performs a plain read of dev->flags & IFF_MASTER without using READ_ONCE(). Notice that other reader helpers like netif_get_flags() and netdev_get_by_flags_rcu() explicitly use READ_ONCE(dev->flags).
-
Violation and KCSAN Splat:
- Because
dev->flags is modified by __dev_change_flags() under RTNL while concurrently read without RTNL lock in netif_is_bond_master() (under rcu_read_lock()), and neither side uses atomic access annotations (WRITE_ONCE() / READ_ONCE()), the compiler is theoretically permitted to generate store/load splitting or tearing. KCSAN detects this concurrent unmarked read and write on dev->flags and reports a data race.
Sample crash report:
* Struck through repros no longer work on HEAD.