BUG: soft lockup in nsim_dev_trap_report_work

Status: moderation: reported on 2026/12/02 13:34
Subsystems: net
Labels: prio:low
[Documentation on labels]
Reported-by: syzbot+c6e671dde8af503e5b81@syzkaller.appspotmail.com
First crash: 35m, last: 35m
✨ AI-generated root cause summary:

In nsim_dev_trap_report() (drivers/net/netdevsim/dev.c:778-820), spin_lock(&nsim_trap_data->trap_lock) is held across the entire loop over nsim_traps_arr (14 traps), keeping preemption disabled while allocating SKBs in nsim_dev_trap_skb_build(), calling devlink_trap_report(), and freeing SKBs via consume_skb(). Although trap_lock only protects nsim_trap_item->action, holding it across consume_skb() -> kfree() -> __debug_check_no_obj_freed() under CONFIG_DEBUG_OBJECTS_FREE=y and CONFIG_KASAN_INLINE=y forces non-preemptible execution during large obj_hash bucket scans (with hardirqs disabled under db->lock). As a result, migration/1 cannot preempt kworker/u8:0 to run softlockup_fn(), triggering the 24s soft lockup on CPU#1 (compounded on arm64 dummy-virt where kvm_check_and_clear_guest_paused() is a no-op).

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

Root Cause Analysis

The soft lockup (CPU#1 stuck for 24s! [kworker/u8:0:13]) is caused by an unnecessarily broad spinlock critical section in nsim_dev_trap_report() (drivers/net/netdevsim/dev.c:778-820), which prevents kernel preemption across heavy SKB allocation, devlink trap reporting, and debugobjects-instrumented slab freeing.

1. Overly Broad trap_lock Critical Section in drivers/net/netdevsim/dev.c

Every NSIM_TRAP_REPORT_INTERVAL_MS (100 ms), nsim_dev_trap_report_work() (drivers/net/netdevsim/dev.c:824-854) acquires devl_trylock(priv_to_devlink(nsim_dev)) and iterates over nsim_dev->port_list. For each running port (netif_running(nsim_dev_port->ns->netdev)), it calls nsim_dev_trap_report(nsim_dev_port) followed by cond_resched().

Inside nsim_dev_trap_report():

  • spin_lock(&nsim_trap_data->trap_lock) is acquired at line 787 and held across the entire for (i = 0; i < ARRAY_SIZE(nsim_traps_arr); i++) loop (14 traps) until spin_unlock(&nsim_trap_data->trap_lock) at line 819.
  • As documented in nsim_dev_traps_init() (drivers/net/netdevsim/dev.c:881-885) and nsim_dev_devlink_trap_action_set() (drivers/net/netdevsim/dev.c:1086-1088), nsim_trap_data->trap_lock only protects nsim_trap_item->action (nsim_trap_item->trap_ctx is registered once under devl_lock and remains invariant).
  • Despite this, nsim_dev_trap_report() keeps trap_lock held (maintaining preempt_count() >= 1) while executing:
    1. nsim_dev_trap_skb_build() (line 801): alloc_skb(NLMSG_GOODSIZE, GFP_ATOMIC) and packet header construction (eth_random_addr(), get_random_bytes(), ip_fast_csum()).
    2. spin_lock_bh(&nsim_dev->fa_cookie_lock) / devlink_trap_report() / spin_unlock_bh(&nsim_dev->fa_cookie_lock) (lines 812-816): updates per-CPU devlink stats and invokes trace_devlink_trap_report() (which can trigger net/core/drop_monitor.c probes).
    3. consume_skb(skb) (line 817): releases the SKB via skb_release_all() -> skb_release_data() -> skb_free_head() -> skb_kfree_head() -> kfree().

Note that nsim_dev->port_list and device/trap teardown are properly serialized by devl_lock() / devl_trylock() and cancel_delayed_work_sync(&nsim_dev->trap_data->trap_report_dw) in nsim_dev_traps_exit() (drivers/net/netdevsim/dev.c:932); there is no use-after-free or list corruption.

2. Non-Preemptible debug_check_no_obj_freed() Overhead and Watchdog Trigger

Because CONFIG_PREEMPT=y is enabled, migration/1 (running softlockup_fn() queued via stop_one_cpu_nowait() from watchdog_timer_fn() in kernel/watchdog.c:823-825) can preempt kworker/u8:0 only when preempt_count() == 0 and interrupts are enabled.

In this report:

  • With CONFIG_DEBUG_OBJECTS_FREE=y and CONFIG_KASAN_INLINE=y, kfree() calls slab_free_hook() -> debug_check_no_obj_freed() -> __debug_check_no_obj_freed() (lib/debugobjects.c:1141-1196) for the NLMSG_GOODSIZE skb->head allocation.
  • __debug_check_no_obj_freed() iterates across ODEBUG_CHUNK_SIZE (1 << PAGE_SHIFT) chunks in obj_hash (16,384 buckets, ODEBUG_HASH_BITS = 14), acquiring raw_spin_lock_irqsave(&db->lock, flags) and traversing db->list (hlist_for_each_entry_safe(obj, tmp, &db->list, node)).
  • CPU#1's registers confirm heavy obj_hash chain traversal at the time of the interrupt: x20 = ffff80008e659df0 (&db->lock), x21 = dead000000000100 (LIST_POISON1), x22 = dead000000000122 (LIST_POISON2), x23 = 0x1115 (4,373 entries in cnt), and x25 = 0x99bd (39,357 total entries in objs_checked).
  • The IRQ trace stamps show softirqs last enabled at (1089628) at spin_unlock_bh (dev.c:816), followed by hardirqs last enabled at (1089633) inside irqentry_exit_to_kernel_mode_after_preempt() (arch/arm64/kernel/entry-common.c:99). Because trap_lock kept preempt_count() > 0, that interrupt exit could not preempt kworker/u8:0 to run migration/1. Immediately afterwards, at 1089634, el1_interrupt (watchdog_timer_fn()) fired right as raw_spin_unlock_irqrestore(&db->lock, flags) (lib/debugobjects.c:1180, include/linux/spinlock_api_smp.h:210-211) unmasked IRQs before preempt_enable().
  • Additionally, on arm64 (linux,dummy-virt), running_clock() uses local_clock() (kernel/sched/clock.c:508) and kvm_check_and_clear_guest_paused() is a no-op returning false (include/asm-generic/kvm_para.h:12), so any virtualized/emulated execution delay while trap_lock holds preemption disabled directly accumulates against get_softlockup_thresh() (20s).

3. Fix Direction

In nsim_dev_trap_report() (drivers/net/netdevsim/dev.c:787-819), nsim_trap_data->trap_lock only needs to be held while reading nsim_trap_item->action (or trap_lock can be dropped before nsim_dev_trap_skb_build() / devlink_trap_report() / consume_skb(), or replaced with READ_ONCE/WRITE_ONCE for nsim_trap_item->action), so that SKB allocation, trap reporting, and consume_skb() execute in preemptible context.

▶ ▼ ✨ AI Jobs (2)
ID Workflow Result Correct Bug Created Started Finished Revision
8acc479d bisect-cause 🏃 BUG: soft lockup in nsim_dev_trap_report_work 2026/12/02 13:35 2026/12/02 13:35 35891725
396c0d19 assessment-security DenialOfService: ✅ Exploitable: ❌ FilesystemTrigger: ❌ FuzzingArtifact: ❌ MemoryCorruption: ❌ NetworkNeedsSetup: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ BUG: soft lockup in nsim_dev_trap_report_work 2026/12/02 13:18 2026/12/02 13:18 2026/12/02 13:33 35891725
▶ ▼ Similar bugs (10)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 INFO: rcu detected stall in nsim_dev_trap_report_work 1 2 879d 902d 0/3 auto-obsoleted due to no activity on 2024/10/13 18:52
upstream INFO: rcu detected stall in nsim_dev_trap_report_work (2) net 1 syz done 17 639d 1127d 0/30 auto-obsoleted due to no activity on 2025/09/25 13:43
upstream INFO: rcu detected stall in nsim_dev_trap_report_work (4) prio:low net 1 11 127d 206d 0/30 auto-obsoleted due to no activity on 2026/10/25 23:07
linux-5.15 INFO: rcu detected stall in nsim_dev_trap_report_work (2) 1 1 666d 666d 0/3 auto-obsoleted due to no activity on 2025/05/14 15:54
upstream INFO: rcu detected stall in nsim_dev_trap_report_work net 1 syz 4 1182d 1225d 23/30 fixed on 2023/10/12 12:48
linux-6.1 INFO: rcu detected stall in nsim_dev_trap_report_work (3) 1 1 165d 165d 0/3 auto-obsoleted due to no activity on 2026/09/28 12:13
upstream INFO: rcu detected stall in nsim_dev_trap_report_work (3) net 1 2 352d 352d 0/30 auto-obsoleted due to no activity on 2026/03/15 13:28
linux-5.15 INFO: rcu detected stall in nsim_dev_trap_report_work (3) origin:lts-only 1 syz, C error 31 15d 469d 0/3 upstream: reported C repro on 2025/08/20 06:57
linux-6.1 INFO: rcu detected stall in nsim_dev_trap_report_work 1 2 932d 977d 0/3 auto-obsoleted due to no activity on 2024/08/22 01:13
linux-6.1 INFO: rcu detected stall in nsim_dev_trap_report_work (2) 1 1 586d 586d 0/3 auto-obsoleted due to no activity on 2025/08/03 09:20

Sample crash report:
watchdog: BUG: soft lockup - CPU#1 stuck for 24s! [kworker/u8:0:13]
Modules linked in:
irq event stamp: 1089634
hardirqs last  enabled at (1089633): [<ffff800085a982c0>] irqentry_exit_to_kernel_mode_after_preempt include/linux/irq-entry-common.h:511 [inline]
hardirqs last  enabled at (1089633): [<ffff800085a982c0>] __arm64_exit_to_kernel_mode+0x94/0x204 arch/arm64/kernel/entry-common.c:99
hardirqs last disabled at (1089634): [<ffff800085a9b810>] __el1_irq arch/arm64/kernel/entry-common.c:566 [inline]
hardirqs last disabled at (1089634): [<ffff800085a9b810>] el1_interrupt+0x28/0x60 arch/arm64/kernel/entry-common.c:582
softirqs last  enabled at (1089628): [<ffff80008340a4e8>] spin_unlock_bh include/linux/spinlock.h:407 [inline]
softirqs last  enabled at (1089628): [<ffff80008340a4e8>] nsim_dev_trap_report drivers/net/netdevsim/dev.c:816 [inline]
softirqs last  enabled at (1089628): [<ffff80008340a4e8>] nsim_dev_trap_report_work+0x6c8/0xaa0 drivers/net/netdevsim/dev.c:847
softirqs last disabled at (1089626): [<ffff80008340a49c>] spin_lock_bh include/linux/spinlock.h:353 [inline]
softirqs last disabled at (1089626): [<ffff80008340a49c>] nsim_dev_trap_report drivers/net/netdevsim/dev.c:812 [inline]
softirqs last disabled at (1089626): [<ffff80008340a49c>] nsim_dev_trap_report_work+0x67c/0xaa0 drivers/net/netdevsim/dev.c:847
CPU: 1 UID: 0 PID: 13 Comm: kworker/u8:0 Tainted: G             L      syzkaller #0 PREEMPT 
Tainted: [L]=SOFTLOCKUP
Hardware name: linux,dummy-virt (DT)
Workqueue: events_unbound nsim_dev_trap_report_work
pstate: 10000005 (nzcV daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
pc : _raw_spin_unlock_irqrestore+0x40/0xb4 kernel/locking/spinlock.c:221
lr : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:210 [inline]
lr : _raw_spin_unlock_irqrestore+0x80/0xb4 kernel/locking/spinlock.c:221
sp : ffff80008e947720
x29: ffff80008e947720 x28: dfff800000000000 x27: ffff000015d1cef0
x26: 0000000000000000 x25: 00000000000099bd x24: 0000000000000000
x23: 0000000000001115 x22: dead000000000122 x21: dead000000000100
x20: ffff80008e659df0 x19: 0000000000000000 x18: 0000000000000000
x17: 0000000000000000 x16: 0000000000000002 x15: ffff80008841a998
x14: 0000000000000001 x13: ffff80008ab4cea0 x12: ffff700011ccb3bf
x11: 1ffff00011ccb3be x10: ffff700011ccb3be x9 : dfff800000000000
x8 : ffff80008e9475c0 x7 : ffff80008e947730 x6 : ffff80008e9476e0
x5 : ffff80008e947620 x4 : 0000000000000004 x3 : 1fffe00001ef1af9
x2 : 0000000000000000 x1 : 000000000010a05f x0 : 00000000000000c0
Call trace:
 __daif_local_irq_restore arch/arm64/include/asm/irqflags.h:175 [inline] (P)
 arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P)
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:210 [inline] (P)
 _raw_spin_unlock_irqrestore+0x40/0xb4 kernel/locking/spinlock.c:221 (P)
 __debug_check_no_obj_freed lib/debugobjects.c:1180 [inline]
 debug_check_no_obj_freed+0x280/0x558 lib/debugobjects.c:1201
 slab_free_hook mm/slub.c:2711 [inline]
 slab_free mm/slub.c:6637 [inline]
 kfree+0x51c/0x720 mm/slub.c:6930
 skb_kfree_head net/core/skbuff.c:1085 [inline]
 skb_free_head+0x80/0x108 net/core/skbuff.c:1097
 skb_release_data+0x3ec/0x618 net/core/skbuff.c:1125
 skb_release_all net/core/skbuff.c:1189 [inline]
 __kfree_skb net/core/skbuff.c:1203 [inline]
 consume_skb net/core/skbuff.c:1440 [inline]
 consume_skb+0xd0/0x118 net/core/skbuff.c:1434
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:817 [inline]
 nsim_dev_trap_report_work+0x6d0/0xaa0 drivers/net/netdevsim/dev.c:847
 process_one_work+0x844/0x1970 kernel/workqueue.c:3497
 process_scheduled_works kernel/workqueue.c:3580 [inline]
 worker_thread+0x42c/0xc90 kernel/workqueue.c:3661
 kthread+0x2ec/0x384 kernel/kthread.c:436
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870
Sending NMI from CPU 1 to CPUs 0:
NMI backtrace for cpu 0
CPU: 0 UID: 0 PID: 16 Comm: rcu_preempt Tainted: G             L      syzkaller #0 PREEMPT 
Tainted: [L]=SOFTLOCKUP
Hardware name: linux,dummy-virt (DT)
pstate: 10000005 (nzcV daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:211 [inline]
pc : _raw_spin_unlock_irqrestore+0x40/0xb4 kernel/locking/spinlock.c:221
lr : __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:210 [inline]
lr : _raw_spin_unlock_irqrestore+0x80/0xb4 kernel/locking/spinlock.c:221
sp : ffff80008e9779d0
x29: ffff80008e9779d0 x28: ffff000069db9e00 x27: ffff80008e977b70
x26: 00000000ffffffff x25: ffff000069db9e00 x24: ffff8000883ee000
x23: 0000000000000000 x22: ffff800085b9dae0 x21: 000000010001e0cc
x20: ffff000069db9e00 x19: 0000000000000000 x18: 0000000000000000
x17: 0000000000000000 x16: 1fffe000021f77ee x15: ffff80008841a990
x14: 1ffff00011083532 x13: ffff80008aafe728 x12: ffff60000d3b73c1
x11: 1fffe0000d3b73c0 x10: ffff60000d3b73c0 x9 : dfff800000000000
x8 : ffff80008e977870 x7 : ffff80008e9779e0 x6 : ffff80008e977990
x5 : ffff80008e9778d0 x4 : 0000000000000000 x3 : 1fffe00001ef1001
x2 : 0000000000000000 x1 : 00000000001fa63b x0 : 00000000000000c0
Call trace:
 __daif_local_irq_restore arch/arm64/include/asm/irqflags.h:175 [inline] (P)
 arch_local_irq_restore arch/arm64/include/asm/irqflags.h:195 [inline] (P)
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:210 [inline] (P)
 _raw_spin_unlock_irqrestore+0x40/0xb4 kernel/locking/spinlock.c:221 (P)
 __mod_timer+0x274/0x900 kernel/time/timer.c:1140
 add_timer+0x5c/0x90 kernel/time/timer.c:1250
 schedule_timeout+0xf0/0x224 kernel/time/sleep_timeout.c:98
 rcu_gp_fqs_loop+0x18c/0x7e8 kernel/rcu/tree.c:2122
 rcu_gp_kthread+0x1c4/0x23c kernel/rcu/tree.c:2330
 kthread+0x2ec/0x384 kernel/kthread.c:436
 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/12/02 13:18 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux master 693c2e04e3f1 35891725 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu2-arm64 BUG: soft lockup in nsim_dev_trap_report_work
* Struck through repros no longer work on HEAD.