syzbot


possible deadlock in kvfree_call_rcu

Status: upstream: reported C repro on 2024/03/21 20:02
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+e5952d44ee3e1993cddf@syzkaller.appspotmail.com
First crash: 279d, last: 2d09h
Bug presence (1)
Date Name Commit Repro Result
2024/05/05 upstream (ToT) 7367539ad4b0 C [report] possible deadlock in kvfree_call_rcu
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in kvfree_call_rcu (2) net C unreliable 1097 19d 198d 0/28 upstream: reported C repro on 2024/06/10 22:50
upstream possible deadlock in kvfree_call_rcu bpf C 1431 205d 274d 25/28 fixed on 2024/06/05 13:52
linux-5.15 possible deadlock in kvfree_call_rcu origin:upstream missing-backport C done 682 3d04h 275d 0/3 upstream: reported C repro on 2024/03/25 23:20

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.119-syzkaller #0 Not tainted
------------------------------------------------------
rcu_preempt/16 is trying to acquire lock:
ffff8880b8e28118 (krc.lock){....}-{2:2}, at: krc_this_cpu_lock kernel/rcu/tree.c:2991 [inline]
ffff8880b8e28118 (krc.lock){....}-{2:2}, at: add_ptr_to_bulk_krc_lock kernel/rcu/tree.c:3311 [inline]
ffff8880b8e28118 (krc.lock){....}-{2:2}, at: kvfree_call_rcu+0x1b2/0x8c0 kernel/rcu/tree.c:3402

but task is already holding lock:
ffff8880b8e28358 (&base->lock){-.-.}-{2:2}, at: lock_timer_base+0x120/0x260 kernel/time/timer.c:999

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&base->lock){-.-.}-{2:2}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
       lock_timer_base+0x120/0x260 kernel/time/timer.c:999
       __mod_timer+0x1cb/0xee0 kernel/time/timer.c:1072
       queue_delayed_work_on+0x156/0x250 kernel/workqueue.c:1704
       queue_delayed_work include/linux/workqueue.h:527 [inline]
       schedule_delayed_monitor_work kernel/rcu/tree.c:3172 [inline]
       kvfree_call_rcu+0x520/0x8c0 kernel/rcu/tree.c:3428
       rtnl_register_internal+0x489/0x580 net/core/rtnetlink.c:260
       rtnl_register+0x32/0x70 net/core/rtnetlink.c:310
       ip_rt_init+0x335/0x3c7 net/ipv4/route.c:3763
       ip_init+0xa/0x14 net/ipv4/ip_output.c:1767
       inet_init+0x2ae/0x3c0 net/ipv4/af_inet.c:2035
       do_one_initcall+0x265/0x8f0 init/main.c:1298
       do_initcall_level+0x157/0x207 init/main.c:1371
       do_initcalls+0x49/0x86 init/main.c:1387
       kernel_init_freeable+0x45c/0x60f init/main.c:1626
       kernel_init+0x19/0x290 init/main.c:1514
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

-> #0 (krc.lock){....}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
       krc_this_cpu_lock kernel/rcu/tree.c:2991 [inline]
       add_ptr_to_bulk_krc_lock kernel/rcu/tree.c:3311 [inline]
       kvfree_call_rcu+0x1b2/0x8c0 kernel/rcu/tree.c:3402
       trie_delete_elem+0x53a/0x690 kernel/bpf/lpm_trie.c:532
       bpf_prog_4febba1e7eaf042b+0x42/0x4b
       bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline]
       __bpf_prog_run include/linux/filter.h:603 [inline]
       bpf_prog_run include/linux/filter.h:610 [inline]
       __bpf_trace_run kernel/trace/bpf_trace.c:2271 [inline]
       bpf_trace_run3+0x231/0x440 kernel/trace/bpf_trace.c:2311
       trace_timer_start include/trace/events/timer.h:53 [inline]
       enqueue_timer+0x440/0x600 kernel/time/timer.c:609
       __mod_timer+0x92b/0xee0
       schedule_timeout+0x1b4/0x300 kernel/time/timer.c:1964
       rcu_gp_fqs_loop+0x2d2/0x1150 kernel/rcu/tree.c:1706
       rcu_gp_kthread+0xa3/0x3b0 kernel/rcu/tree.c:1905
       kthread+0x28d/0x320 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&base->lock);
                               lock(krc.lock);
                               lock(&base->lock);
  lock(krc.lock);

 *** DEADLOCK ***

2 locks held by rcu_preempt/16:
 #0: ffff8880b8e28358 (&base->lock){-.-.}-{2:2}, at: lock_timer_base+0x120/0x260 kernel/time/timer.c:999
 #1: ffffffff8d32af40 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #1: ffffffff8d32af40 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #1: ffffffff8d32af40 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2270 [inline]
 #1: ffffffff8d32af40 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run3+0x146/0x440 kernel/trace/bpf_trace.c:2311

stack backtrace:
CPU: 0 PID: 16 Comm: rcu_preempt Not tainted 6.1.119-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
 krc_this_cpu_lock kernel/rcu/tree.c:2991 [inline]
 add_ptr_to_bulk_krc_lock kernel/rcu/tree.c:3311 [inline]
 kvfree_call_rcu+0x1b2/0x8c0 kernel/rcu/tree.c:3402
 trie_delete_elem+0x53a/0x690 kernel/bpf/lpm_trie.c:532
 bpf_prog_4febba1e7eaf042b+0x42/0x4b
 bpf_dispatcher_nop_func include/linux/bpf.h:989 [inline]
 __bpf_prog_run include/linux/filter.h:603 [inline]
 bpf_prog_run include/linux/filter.h:610 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2271 [inline]
 bpf_trace_run3+0x231/0x440 kernel/trace/bpf_trace.c:2311
 trace_timer_start include/trace/events/timer.h:53 [inline]
 enqueue_timer+0x440/0x600 kernel/time/timer.c:609
 __mod_timer+0x92b/0xee0
 schedule_timeout+0x1b4/0x300 kernel/time/timer.c:1964
 rcu_gp_fqs_loop+0x2d2/0x1150 kernel/rcu/tree.c:1706
 rcu_gp_kthread+0xa3/0x3b0 kernel/rcu/tree.c:1905
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

Crashes (657):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/08 14:53 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/06/07 04:29 linux-6.1.y 88690811da69 121701b6 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/06/07 03:41 linux-6.1.y 88690811da69 121701b6 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/04/02 07:03 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/04/02 05:53 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/04/02 03:44 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/04/01 21:44 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/12/24 00:46 linux-6.1.y 29f02ec58a94 444551c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/21 06:40 linux-6.1.y 29f02ec58a94 d7f584ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/12/21 03:03 linux-6.1.y 29f02ec58a94 d7f584ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/14 07:45 linux-6.1.y e4d90d63d385 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/12/14 01:21 linux-6.1.y e4d90d63d385 7cbfbb3a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/07 05:46 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/12/06 23:34 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/06 23:28 linux-6.1.y e4d90d63d385 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/06 14:06 linux-6.1.y e4d90d63d385 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/12/06 05:15 linux-6.1.y e4d90d63d385 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/05 06:47 linux-6.1.y e4d90d63d385 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/12/05 05:34 linux-6.1.y e4d90d63d385 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/05 05:33 linux-6.1.y e4d90d63d385 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/02 17:39 linux-6.1.y e4d90d63d385 b499ea68 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/12/01 10:33 linux-6.1.y e4d90d63d385 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/11/29 13:04 linux-6.1.y e4d90d63d385 5df23865 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/27 02:59 linux-6.1.y e4d90d63d385 e9a9a9f2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/11/27 00:11 linux-6.1.y e4d90d63d385 e9a9a9f2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/19 06:33 linux-6.1.y b67dc5c9ade9 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/08 15:02 linux-6.1.y 7c15117f9468 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/11/08 12:09 linux-6.1.y 7c15117f9468 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/07 03:58 linux-6.1.y 7c15117f9468 df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/07 03:48 linux-6.1.y 7c15117f9468 df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/06 15:04 linux-6.1.y 7c15117f9468 3a465482 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/11/04 14:03 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/04 08:17 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/04 07:14 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/11/03 12:40 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/11/03 02:08 linux-6.1.y 7c15117f9468 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/23 13:58 linux-6.1.y 7ec6f9fa3d97 15fa2979 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/22 09:59 linux-6.1.y 54d90d17e8ce a93682b3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/10/18 09:47 linux-6.1.y 54d90d17e8ce 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/18 04:51 linux-6.1.y 54d90d17e8ce 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/10/17 10:45 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/17 09:08 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/17 00:49 linux-6.1.y aa4cd140bba5 666f77ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/10/16 16:47 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/16 04:39 linux-6.1.y aa4cd140bba5 bde2d81c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/10/07 14:14 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/10/06 10:07 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/04 08:48 linux-6.1.y aa4cd140bba5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/10/01 08:59 linux-6.1.y aa4cd140bba5 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/10/01 05:53 linux-6.1.y aa4cd140bba5 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/09/29 20:11 linux-6.1.y e526b12bf916 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/09/27 07:44 linux-6.1.y e526b12bf916 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/09/27 05:06 linux-6.1.y e526b12bf916 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/09/27 03:58 linux-6.1.y e526b12bf916 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/09/26 23:22 linux-6.1.y e526b12bf916 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in kvfree_call_rcu
2024/09/26 11:05 linux-6.1.y e526b12bf916 0d19f247 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
2024/03/21 20:02 linux-6.1.y d7543167affd 7a239ce7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in kvfree_call_rcu
* Struck through repros no longer work on HEAD.