BUG: workqueue leaked atomic, lock or RCU: kworker/NUM:NUM[NUM] (3)

Status: moderation: reported on 2026/12/06 02:02
Subsystems: kernel
Labels: prio:normal
[Documentation on labels]
Reported-by: syzbot+d1ecc1f95566c06725e5@syzkaller.appspotmail.com
First crash: 4d01h, last: 4d01h
✨ AI cause bisection: introduced by (AI job) :
commit c35aea39d1e106f61fd2130f0d32a3bac8bd4570
Author: Tejun Heo <tj@kernel.org>
Date: Sun Feb 4 21:28:06 2024 +0000

  workqueue: Update lock debugging code

✨ AI-generated root cause summary:

In kernel/workqueue.c:process_one_work(), the post-execution lock-balance check compares lockdep_depth(current) against the pre-execution lockdep_start_depth without checking whether global lockdep (debug_locks) was disabled in the meantime. Because lockdep_depth(tsk) evaluates to (debug_locks ? (tsk)->lockdep_depth : 0), any BH work item that starts with lockdep_start_depth > 0 (here 5, due to nested execution from wg_packet_encrypt_worker via local_bh_enable() into bh_worker() on PREEMPT_RT) will see lockdep_depth(current) drop to 0 if debug_locks transitions from 1 to 0 while worker->current_func(work) runs, triggering a spurious "BUG: workqueue leaked atomic, lock or RCU" report.

▶ ▼ ✨ Full AI root cause analysis
Based on kernel commit 693c2e04e3f1:

Root Cause Analysis

The failure is triggered in process_one_work() (kernel/workqueue.c:3468-3519) when global lockdep debugging (debug_locks) transitions from 1 to 0 while a work item with a non-zero lockdep_start_depth is executing.

1. How lockdep_start_depth == 5 is reached

With CONFIG_PREEMPT_RT=y (and CONFIG_PREEMPT_RT_NEEDS_BH_LOCK=n), kworker/1:2 enters a nested bottom-half work item with 5 lockdep entries held:

  1. Outer process_one_work() for wg_packet_encrypt_worker() (drivers/net/wireguard/send.c:287) acquires pwq->wq->lockdep_map and its copied work->lockdep_map (kernel/workqueue.c:3472-3473) (depth = 2).
  2. wg_packet_encrypt_worker() calls ptr_ring_consume_bh() (include/linux/ptr_ring.h:393-402) -> spin_lock_bh() -> __local_bh_disable_ip() (kernel/softirq.c:179-236), which acquires rcu_read_lock() (rcu_lock_map, depth = 3, RCU = 1) because !current->softirq_disable_cnt && preemptible().
  3. On spin_unlock_bh() -> local_bh_enable() -> __local_bh_enable_ip() (kernel/softirq.c:281-330), bh_lock_map is released and __local_bh_enable(SOFTIRQ_OFFSET, false) keeps rcu_read_lock() held while calling __do_softirq() -> handle_softirqs() -> tasklet_action() -> workqueue_softirq_action() -> bh_worker() (kernel/workqueue.c:3858-3916).
  4. bh_worker() calls worker_lock_callback(pool) (kernel/workqueue.c:3298-3310), which acquires spin_lock_nested(&pool->cb_lock, ...) (rt_spin_lock on PREEMPT_RT, kernel/locking/spinlock_rt.c:46-66). This acquires pool->cb_lock (depth = 4) and a second rcu_read_lock() (depth = 5, RCU = 2).

At kernel/workqueue.c:3468-3469, the inner process_one_work() for usb_giveback_urb_bh() (drivers/usb/core/hcd.c:1674) records:

  • rcu_start_depth = rcu_preempt_depth(); (2)
  • lockdep_start_depth = lockdep_depth(current); (5, since debug_locks is still 1)

2. Why lockdep_depth(current) != lockdep_start_depth triggers (lock=5->0)

lockdep_depth() is defined in include/linux/lockdep.h:279 as:

#define lockdep_depth(tsk)	(debug_locks ? (tsk)->lockdep_depth : 0)

During worker->current_func(work) (usb_giveback_urb_bh), debug_locks is cleared to 0 (debug_locks_off() / __debug_locks_off()), as confirmed by debug_show_held_locks(current) (kernel/locking/lockdep.c:6891-6898) printing "INFO: lockdep is turned off.".

When usb_giveback_urb_bh() returns to process_one_work(), kernel/workqueue.c:3508-3510 evaluates:

if (unlikely((worker->task && in_atomic()) ||
	     lockdep_depth(current) != lockdep_start_depth ||
	     rcu_preempt_depth() != rcu_start_depth))

Because debug_locks is now 0, lockdep_depth(current) returns 0 regardless of current->lockdep_depth (and despite preempt=0x00000000 and RCU=2->2 showing no actual atomic, lock, or RCU state was leaked). Comparing 0 != 5 falsely triggers the BUG: workqueue leaked atomic, lock or RCU splat.

(Note: The exact caller that disabled debug_locksβ€”either on another CPU or via a non-WARN lockdep path such as lockdep table/depth exhaustion in kernel/locking/lockdep.c, given panic_on_warn=1 in CONFIG_CMDLINEβ€”is not recorded in this stack trace; TAINT_SOFTLOCKUP has LOCKDEP_STILL_OK and CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC=1 is enabled.)

3. Fix Direction

In kernel/workqueue.c:process_one_work(), the lockdep depth comparison (and lockdep_start_depth check) needs to account for debug_locks becoming 0 during work execution (e.g., skipping the lockdep depth mismatch check when !debug_locks, or checking debug_locks before comparing current->lockdep_depth against lockdep_start_depth).

▶ ▼ ✨ AI Jobs (3)
ID Workflow Result Correct Bug Created Started Finished Revision
35d323f9 repro-c πŸ’₯ BUG: workqueue leaked atomic, lock or RCU: kworker/NUM:NUM[NUM] (3) 2026/12/05 06:14 2026/12/05 06:14 2026/12/05 12:17 3a4d724d
a3578c9b bisect-cause IsRelease: ❌ ❓ BUG: workqueue leaked atomic, lock or RCU: kworker/NUM:NUM[NUM] (3) 2026/12/02 01:58 2026/12/02 01:58 2026/12/02 02:32 35891725
5a851683 assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: βœ… VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ BUG: workqueue leaked atomic, lock or RCU: kworker/NUM:NUM[NUM] (3) 2026/12/02 01:03 2026/12/02 01:03 2026/12/02 01:52 35891725
▶ ▼ Similar bugs (2)
Kernel Title Rank πŸ›ˆ Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: workqueue leaked atomic, lock or RCU: kworker/NUM:NUM[NUM] media usb -1 5 690d 775d 0/30 auto-obsoleted due to no activity on 2025/04/24 17:35
upstream BUG: workqueue leaked atomic, lock or RCU: kworker/NUM:NUM[NUM] (2) prio:high usb -1 1 95d 91d 0/30 auto-obsoleted due to no activity on 2026/11/30 13:00

Sample crash report:
BUG: workqueue leaked atomic, lock or RCU: kworker/1:2[1608]
     preempt=0x00000000 lock=5->0 RCU=2->2 workfn=usb_giveback_urb_bh
INFO: lockdep is turned off.
CPU: 1 UID: 0 PID: 1608 Comm: kworker/1:2 Tainted: G             L      syzkaller #0 PREEMPT_{RT,(full)} 
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Workqueue: wg-crypt-wg0 wg_packet_encrypt_worker
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
 process_one_work kernel/workqueue.c:3518 [inline]
 process_scheduled_works+0x12e2/0x1650 kernel/workqueue.c:3580
 bh_worker+0x4b3/0xbb0 kernel/workqueue.c:3887
 tasklet_action+0xc/0x70 kernel/softirq.c:1022
 handle_softirqs+0x1d4/0x6c0 kernel/softirq.c:669
 __do_softirq kernel/softirq.c:703 [inline]
 __local_bh_enable_ip+0x16f/0x2b0 kernel/softirq.c:325
 local_bh_enable include/linux/bottom_half.h:33 [inline]
 spin_unlock_bh include/linux/spinlock_rt.h:122 [inline]
 ptr_ring_consume_bh include/linux/ptr_ring.h:399 [inline]
 wg_packet_encrypt_worker+0x33e/0x1800 drivers/net/wireguard/send.c:293
 process_one_work kernel/workqueue.c:3497 [inline]
 process_scheduled_works+0xc5d/0x1650 kernel/workqueue.c:3580
 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3661
 kthread+0x38b/0x470 kernel/kthread.c:436
 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/12/02 00:58 upstream 693c2e04e3f1 35891725 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root BUG: workqueue leaked atomic, lock or RCU: kworker/NUM:NUM[NUM]
* Struck through repros no longer work on HEAD.