Root Cause Analysis
1. Components and Functions Involved
2. Mechanism and Lifecycle Violation
In kernel/workqueue.c:process_one_work(), the workqueue subsystem verifies that a work item does not leak atomic context, lockdep locks, or RCU read-side critical sections:
3466: rcu_start_depth = rcu_preempt_depth();
3467: lockdep_start_depth = lockdep_depth(current);
...
3495: worker->current_func(work);
...
3506: if (unlikely((worker->task && in_atomic()) ||
3507: lockdep_depth(current) != lockdep_start_depth ||
3508: rcu_preempt_depth() != rcu_start_depth)) {
3509: pr_err("BUG: workqueue leaked atomic, lock or RCU: %s[%d]\n"
...
In include/linux/lockdep.h:279, lockdep_depth is defined as:
#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
-
Difference between standard kthread workers and bottom-half workers (bh_worker):
- For standard workqueue kthread workers (
worker_thread), work items run on dedicated kthreads where no outer locks are held when process_one_work() begins (lockdep_start_depth == 0). If debug_locks turns off during work execution, lockdep_depth(current) evaluates to 0, which matches lockdep_start_depth == 0.
- Bottom-half workers (
bh_worker for WQ_BH), introduced to run work items in bottom-half / softirq context, run in softirq context on whatever task happened to trigger softirqs (e.g., syz-executor during local_bh_enable() inside __alloc_skb()). That task may already hold locks from its syscall context (e.g., rtnl_mutex in rtnetlink_rcv_msg()), RCU read-side critical sections, and on CONFIG_PREEMPT_RT, bh_worker()'s callback lock pool->cb_lock (worker_lock_callback()). As a result, lockdep_start_depth is legitimately non-zero (recorded as 4 in this report).
-
Triggering the false-positive BUG: