------------[ cut here ]------------ ====================================================== WARNING: possible circular locking dependency detected 5.15.160-syzkaller #0 Not tainted ------------------------------------------------------ kworker/u4:6/3630 is trying to acquire lock: ffffffff8c7fc338 ((console_sem).lock){-.-.}-{2:2}, at: down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138 but task is already holding lock: ffff8880b9a28098 (&base->lock){-.-.}-{2:2}, at: lock_timer_base+0x120/0x260 kernel/time/timer.c:946 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (&base->lock){-.-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __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:946 __mod_timer+0x1d6/0xeb0 kernel/time/timer.c:1019 queue_delayed_work_on+0x156/0x250 kernel/workqueue.c:1715 psi_enqueue kernel/sched/stats.h:104 [inline] enqueue_task+0x2fe/0x3a0 kernel/sched/core.c:1973 activate_task kernel/sched/core.c:2005 [inline] wake_up_new_task+0x515/0xb60 kernel/sched/core.c:4522 kernel_clone+0x44e/0x960 kernel/fork.c:2628 kernel_thread+0x168/0x1e0 kernel/fork.c:2656 rest_init+0x21/0x330 init/main.c:706 start_kernel+0x48c/0x540 init/main.c:1140 secondary_startup_64_no_verify+0xb1/0xbb -> #2 (&rq->__lock){-.-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 _raw_spin_lock_nested+0x2d/0x40 kernel/locking/spinlock.c:368 raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:475 raw_spin_rq_lock kernel/sched/sched.h:1326 [inline] rq_lock kernel/sched/sched.h:1621 [inline] task_fork_fair+0x5d/0x350 kernel/sched/fair.c:11480 sched_cgroup_fork+0x2d3/0x330 kernel/sched/core.c:4466 copy_process+0x224a/0x3ef0 kernel/fork.c:2320 kernel_clone+0x210/0x960 kernel/fork.c:2604 kernel_thread+0x168/0x1e0 kernel/fork.c:2656 rest_init+0x21/0x330 init/main.c:706 start_kernel+0x48c/0x540 init/main.c:1140 secondary_startup_64_no_verify+0xb1/0xbb -> #1 (&p->pi_lock){-.-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030 up+0x6e/0x90 kernel/locking/semaphore.c:190 __up_console_sem+0x11a/0x1e0 kernel/printk/printk.c:256 console_unlock+0x1145/0x12b0 kernel/printk/printk.c:2760 do_con_write+0x718a/0x7270 drivers/tty/vt/vt.c:2965 con_write+0x20/0x40 drivers/tty/vt/vt.c:3295 process_output_block drivers/tty/n_tty.c:592 [inline] n_tty_write+0xd7e/0x1280 drivers/tty/n_tty.c:2339 do_tty_write drivers/tty/tty_io.c:1038 [inline] file_tty_write+0x561/0x920 drivers/tty/tty_io.c:1110 call_write_iter include/linux/fs.h:2172 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xacf/0xe50 fs/read_write.c:594 ksys_write+0x1a2/0x2c0 fs/read_write.c:647 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 -> #0 ((console_sem).lock){-.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138 __down_trylock_console_sem+0x105/0x250 kernel/printk/printk.c:239 console_trylock kernel/printk/printk.c:2575 [inline] console_trylock_spinning+0x8a/0x3f0 kernel/printk/printk.c:1867 vprintk_emit+0xa6/0x150 kernel/printk/printk.c:2273 _printk+0xd1/0x120 kernel/printk/printk.c:2299 report_bug+0x1e5/0x2e0 lib/bug.c:195 handle_bug+0x3d/0x70 arch/x86/kernel/traps.c:239 exc_invalid_op+0x16/0x40 arch/x86/kernel/traps.c:259 asm_exc_invalid_op+0x16/0x20 arch/x86/include/asm/idtentry.h:566 copy_from_user_nofault+0x15c/0x1c0 bpf_probe_read_user_common kernel/trace/bpf_trace.c:157 [inline] ____bpf_probe_read_user kernel/trace/bpf_trace.c:166 [inline] bpf_probe_read_user+0x26/0x70 kernel/trace/bpf_trace.c:163 bpf_prog_956a5bcb07a162c5+0x34/0xa94 bpf_dispatcher_nop_func include/linux/bpf.h:790 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline] bpf_trace_run3+0x1d1/0x380 kernel/trace/bpf_trace.c:1918 __traceiter_timer_start+0x79/0xd0 include/trace/events/timer.h:52 trace_timer_start include/trace/events/timer.h:52 [inline] enqueue_timer+0x3ae/0x540 kernel/time/timer.c:586 internal_add_timer kernel/time/timer.c:611 [inline] __mod_timer+0xa60/0xeb0 kernel/time/timer.c:1062 mrp_periodic_timer_arm net/802/mrp.c:617 [inline] mrp_periodic_timer+0x1d4/0x210 net/802/mrp.c:629 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451 expire_timers kernel/time/timer.c:1496 [inline] __run_timers+0x67c/0x890 kernel/time/timer.c:1767 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780 __do_softirq+0x3b3/0x93a kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x155/0x240 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638 get_next_corpse net/netfilter/nf_conntrack_core.c:2332 [inline] nf_ct_iterate_cleanup+0x35f/0x3b0 net/netfilter/nf_conntrack_core.c:2381 nf_ct_iterate_cleanup_net+0x15e/0x1d0 net/netfilter/nf_conntrack_core.c:2465 cttimeout_net_exit+0x3a/0x1f0 net/netfilter/nfnetlink_cttimeout.c:591 ops_exit_list net/core/net_namespace.c:172 [inline] cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:599 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300 other info that might help us debug this: Chain exists of: (console_sem).lock --> &rq->__lock --> &base->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&base->lock); lock(&rq->__lock); lock(&base->lock); lock((console_sem).lock); *** DEADLOCK *** 8 locks held by kworker/u4:6/3630: #0: ffff888011dcd138 ((wq_completion)netns){+.+.}-{0:0}, at: process_one_work+0x78a/0x10c0 kernel/workqueue.c:2283 #1: ffffc900011efd20 (net_cleanup_work){+.+.}-{0:0}, at: process_one_work+0x7d0/0x10c0 kernel/workqueue.c:2285 #2: ffffffff8d9dc290 (pernet_ops_rwsem){++++}-{3:3}, at: cleanup_net+0xf1/0xb60 net/core/net_namespace.c:561 #3: ffffffff8da4dc88 (nf_conntrack_mutex){+.+.}-{3:3}, at: nf_ct_iterate_cleanup+0x49/0x3b0 net/netfilter/nf_conntrack_core.c:2380 #4: ffffc90000007be0 ((&app->periodic_timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:45 [inline] #4: ffffc90000007be0 ((&app->periodic_timer)){+.-.}-{0:0}, at: call_timer_fn+0xbe/0x560 kernel/time/timer.c:1441 #5: ffff888019da6cc8 (&app->lock){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:363 [inline] #5: ffff888019da6cc8 (&app->lock){+.-.}-{2:2}, at: mrp_periodic_timer+0x2d/0x210 net/802/mrp.c:625 #6: ffff8880b9a28098 (&base->lock){-.-.}-{2:2}, at: lock_timer_base+0x120/0x260 kernel/time/timer.c:946 #7: ffffffff8c91fae0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 stack backtrace: CPU: 0 PID: 3630 Comm: kworker/u4:6 Not tainted 5.15.160-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138 __down_trylock_console_sem+0x105/0x250 kernel/printk/printk.c:239 console_trylock kernel/printk/printk.c:2575 [inline] console_trylock_spinning+0x8a/0x3f0 kernel/printk/printk.c:1867 vprintk_emit+0xa6/0x150 kernel/printk/printk.c:2273 _printk+0xd1/0x120 kernel/printk/printk.c:2299 report_bug+0x1e5/0x2e0 lib/bug.c:195 handle_bug+0x3d/0x70 arch/x86/kernel/traps.c:239 exc_invalid_op+0x16/0x40 arch/x86/kernel/traps.c:259 asm_exc_invalid_op+0x16/0x20 arch/x86/include/asm/idtentry.h:566 RIP: 0010:copy_from_user_nofault+0x15c/0x1c0 mm/maccess.c:226 Code: db 48 c7 c0 f2 ff ff ff 48 0f 44 c5 eb 0c e8 8b ce d5 ff 48 c7 c0 f2 ff ff ff 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 74 ce d5 ff <0f> 0b e9 1e ff ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c ef fe ff RSP: 0018:ffffc90000007820 EFLAGS: 00010046 RAX: ffffffff81aa8e4c RBX: 0000000000000000 RCX: ffff888074aa0000 RDX: 0000000080000103 RSI: 0000000000000000 RDI: 0000000000000000 RBP: dffffc0000000000 R08: ffffffff81aa8d5d R09: fffffbfff1f7f019 R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: ffffc90000007888 bpf_probe_read_user_common kernel/trace/bpf_trace.c:157 [inline] ____bpf_probe_read_user kernel/trace/bpf_trace.c:166 [inline] bpf_probe_read_user+0x26/0x70 kernel/trace/bpf_trace.c:163 bpf_prog_956a5bcb07a162c5+0x34/0xa94 bpf_dispatcher_nop_func include/linux/bpf.h:790 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline] bpf_trace_run3+0x1d1/0x380 kernel/trace/bpf_trace.c:1918 __traceiter_timer_start+0x79/0xd0 include/trace/events/timer.h:52 trace_timer_start include/trace/events/timer.h:52 [inline] enqueue_timer+0x3ae/0x540 kernel/time/timer.c:586 internal_add_timer kernel/time/timer.c:611 [inline] __mod_timer+0xa60/0xeb0 kernel/time/timer.c:1062 mrp_periodic_timer_arm net/802/mrp.c:617 [inline] mrp_periodic_timer+0x1d4/0x210 net/802/mrp.c:629 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451 expire_timers kernel/time/timer.c:1496 [inline] __run_timers+0x67c/0x890 kernel/time/timer.c:1767 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780 __do_softirq+0x3b3/0x93a kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x155/0x240 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:nf_ct_iterate_cleanup+0x35f/0x3b0 net/netfilter/nf_conntrack_core.c:2381 Code: 72 ff ff 48 c7 c7 80 38 7f 8b be 39 09 00 00 31 d2 e8 a5 dd dd f8 2e 2e 2e 31 c0 ff c5 3b 2d bc be 69 05 73 23 e8 21 1b 05 f9 06 fd ff ff e8 17 1b 05 f9 48 8b 2c 24 eb e1 e8 0c 1b 05 f9 eb RSP: 0018:ffffc900011efa10 EFLAGS: 00000293 RAX: ffffffff887b419f RBX: ffff888023adbad8 RCX: ffff888074aa0000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 000000000001b75c R08: ffffffff887b3efe R09: fffffbfff1f7f029 R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000 R13: ffffc900011efaa0 R14: 1ffff1100475b75b R15: ffffffff887b41f0 nf_ct_iterate_cleanup_net+0x15e/0x1d0 net/netfilter/nf_conntrack_core.c:2465 cttimeout_net_exit+0x3a/0x1f0 net/netfilter/nfnetlink_cttimeout.c:591 ops_exit_list net/core/net_namespace.c:172 [inline] cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:599 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300 WARNING: CPU: 0 PID: 3630 at mm/maccess.c:226 copy_from_user_nofault+0x15c/0x1c0 Modules linked in: CPU: 0 PID: 3630 Comm: kworker/u4:6 Not tainted 5.15.160-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Workqueue: netns cleanup_net RIP: 0010:copy_from_user_nofault+0x15c/0x1c0 mm/maccess.c:226 Code: db 48 c7 c0 f2 ff ff ff 48 0f 44 c5 eb 0c e8 8b ce d5 ff 48 c7 c0 f2 ff ff ff 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 74 ce d5 ff <0f> 0b e9 1e ff ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c ef fe ff RSP: 0018:ffffc90000007820 EFLAGS: 00010046 RAX: ffffffff81aa8e4c RBX: 0000000000000000 RCX: ffff888074aa0000 RDX: 0000000080000103 RSI: 0000000000000000 RDI: 0000000000000000 RBP: dffffc0000000000 R08: ffffffff81aa8d5d R09: fffffbfff1f7f019 R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: ffffc90000007888 FS: 0000000000000000(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000007a6a4000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: bpf_probe_read_user_common kernel/trace/bpf_trace.c:157 [inline] ____bpf_probe_read_user kernel/trace/bpf_trace.c:166 [inline] bpf_probe_read_user+0x26/0x70 kernel/trace/bpf_trace.c:163 bpf_prog_956a5bcb07a162c5+0x34/0xa94 bpf_dispatcher_nop_func include/linux/bpf.h:790 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline] bpf_trace_run3+0x1d1/0x380 kernel/trace/bpf_trace.c:1918 __traceiter_timer_start+0x79/0xd0 include/trace/events/timer.h:52 trace_timer_start include/trace/events/timer.h:52 [inline] enqueue_timer+0x3ae/0x540 kernel/time/timer.c:586 internal_add_timer kernel/time/timer.c:611 [inline] __mod_timer+0xa60/0xeb0 kernel/time/timer.c:1062 mrp_periodic_timer_arm net/802/mrp.c:617 [inline] mrp_periodic_timer+0x1d4/0x210 net/802/mrp.c:629 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451 expire_timers kernel/time/timer.c:1496 [inline] __run_timers+0x67c/0x890 kernel/time/timer.c:1767 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780 __do_softirq+0x3b3/0x93a kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x155/0x240 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:nf_ct_iterate_cleanup+0x35f/0x3b0 net/netfilter/nf_conntrack_core.c:2381 Code: 72 ff ff 48 c7 c7 80 38 7f 8b be 39 09 00 00 31 d2 e8 a5 dd dd f8 2e 2e 2e 31 c0 ff c5 3b 2d bc be 69 05 73 23 e8 21 1b 05 f9 06 fd ff ff e8 17 1b 05 f9 48 8b 2c 24 eb e1 e8 0c 1b 05 f9 eb RSP: 0018:ffffc900011efa10 EFLAGS: 00000293 RAX: ffffffff887b419f RBX: ffff888023adbad8 RCX: ffff888074aa0000 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: 000000000001b75c R08: ffffffff887b3efe R09: fffffbfff1f7f029 R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000 R13: ffffc900011efaa0 R14: 1ffff1100475b75b R15: ffffffff887b41f0 nf_ct_iterate_cleanup_net+0x15e/0x1d0 net/netfilter/nf_conntrack_core.c:2465 cttimeout_net_exit+0x3a/0x1f0 net/netfilter/nfnetlink_cttimeout.c:591 ops_exit_list net/core/net_namespace.c:172 [inline] cleanup_net+0x6ce/0xb60 net/core/net_namespace.c:599 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300 ---------------- Code disassembly (best guess): 0: 72 ff jb 0x1 2: ff 48 c7 decl -0x39(%rax) 5: c7 80 38 7f 8b be 39 movl $0x939,-0x417480c8(%rax) c: 09 00 00 f: 31 d2 xor %edx,%edx 11: e8 a5 dd dd f8 call 0xf8ddddbb 16: 2e 2e 2e 31 c0 cs cs cs xor %eax,%eax 1b: ff c5 inc %ebp 1d: 3b 2d bc be 69 05 cmp 0x569bebc(%rip),%ebp # 0x569bedf 23: 73 23 jae 0x48 25: e8 21 1b 05 f9 call 0xf9051b4b * 2a: e9 06 fd ff ff jmp 0xfffffd35 <-- trapping instruction 2f: e8 17 1b 05 f9 call 0xf9051b4b 34: 48 8b 2c 24 mov (%rsp),%rbp 38: eb e1 jmp 0x1b 3a: e8 0c 1b 05 f9 call 0xf9051b4b 3f: eb .byte 0xeb