====================================================== WARNING: possible circular locking dependency detected 6.6.0-rc4-next-20231005-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/5195 is trying to acquire lock: ffff88807d33c578 (&p->pi_lock){-.-.}-{2:2}, at: class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:518 [inline] ffff88807d33c578 (&p->pi_lock){-.-.}-{2:2}, at: try_to_wake_up+0xb0/0x15d0 kernel/sched/core.c:4213 but task is already holding lock: ffffffff8cb98e18 ((console_sem).lock){-...}-{2:2}, at: up+0x16/0xb0 kernel/locking/semaphore.c:187 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 ((console_sem).lock){-...}-{2:2}: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162 down_trylock+0x12/0x70 kernel/locking/semaphore.c:139 __down_trylock_console_sem+0x40/0x140 kernel/printk/printk.c:323 console_trylock+0x73/0x130 kernel/printk/printk.c:2652 console_trylock_spinning kernel/printk/printk.c:1924 [inline] vprintk_emit+0x162/0x5f0 kernel/printk/printk.c:2303 vprintk+0x7b/0x90 kernel/printk/printk_safe.c:45 _printk+0xc8/0x100 kernel/printk/printk.c:2329 pick_eevdf kernel/sched/fair.c:963 [inline] pick_next_entity kernel/sched/fair.c:5247 [inline] pick_next_task_fair+0x1c5/0x1280 kernel/sched/fair.c:8205 __pick_next_task kernel/sched/core.c:5986 [inline] pick_next_task kernel/sched/core.c:6061 [inline] __schedule+0x493/0x5a00 kernel/sched/core.c:6640 preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:6855 preempt_schedule_thunk+0x1a/0x30 arch/x86/entry/thunk_64.S:45 __local_bh_enable_ip+0xff/0x120 kernel/softirq.c:388 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:819 [inline] __dev_queue_xmit+0xa6f/0x3d60 net/core/dev.c:4367 dev_queue_xmit include/linux/netdevice.h:3092 [inline] neigh_hh_output include/net/neighbour.h:526 [inline] neigh_output include/net/neighbour.h:540 [inline] ip6_finish_output2+0xfca/0x1700 net/ipv6/ip6_output.c:135 __ip6_finish_output net/ipv6/ip6_output.c:196 [inline] ip6_finish_output+0x485/0x1250 net/ipv6/ip6_output.c:207 NF_HOOK_COND include/linux/netfilter.h:293 [inline] ip6_output+0x1e2/0x530 net/ipv6/ip6_output.c:228 dst_output include/net/dst.h:458 [inline] NF_HOOK.constprop.0+0xff/0x570 include/linux/netfilter.h:304 mld_sendpack+0x713/0xd60 net/ipv6/mcast.c:1818 mld_send_cr net/ipv6/mcast.c:2119 [inline] mld_ifc_work+0x756/0xcd0 net/ipv6/mcast.c:2651 process_one_work+0x884/0x15c0 kernel/workqueue.c:2630 process_scheduled_works kernel/workqueue.c:2703 [inline] worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304 -> #1 (&rq->__lock){-.-.}-{2:2}: _raw_spin_lock_nested+0x31/0x40 kernel/locking/spinlock.c:378 raw_spin_rq_lock_nested+0x29/0x130 kernel/sched/core.c:558 raw_spin_rq_lock kernel/sched/sched.h:1357 [inline] rq_lock kernel/sched/sched.h:1671 [inline] task_fork_fair+0x70/0x240 kernel/sched/fair.c:12399 sched_cgroup_fork+0x3cf/0x510 kernel/sched/core.c:4799 copy_process+0x4580/0x74b0 kernel/fork.c:2609 kernel_clone+0xfd/0x920 kernel/fork.c:2907 user_mode_thread+0xb4/0xf0 kernel/fork.c:2985 rest_init+0x27/0x2b0 init/main.c:691 arch_call_rest_init+0x13/0x30 init/main.c:823 start_kernel+0x39f/0x480 init/main.c:1068 x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:556 x86_64_start_kernel+0xb2/0xc0 arch/x86/kernel/head64.c:537 secondary_startup_64_no_verify+0x166/0x16b -> #0 (&p->pi_lock){-.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3868 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136 lock_acquire kernel/locking/lockdep.c:5753 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162 class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:518 [inline] try_to_wake_up+0xb0/0x15d0 kernel/sched/core.c:4213 up+0x79/0xb0 kernel/locking/semaphore.c:191 __up_console_sem kernel/printk/printk.c:340 [inline] __console_unlock kernel/printk/printk.c:2699 [inline] console_unlock+0x1cf/0x260 kernel/printk/printk.c:3031 do_con_write+0x16df/0x7f40 drivers/tty/vt/vt.c:2918 con_write+0x23/0xb0 drivers/tty/vt/vt.c:3245 process_output_block drivers/tty/n_tty.c:574 [inline] n_tty_write+0x422/0x1130 drivers/tty/n_tty.c:2379 iterate_tty_write drivers/tty/tty_io.c:1017 [inline] file_tty_write.constprop.0+0x519/0x9b0 drivers/tty/tty_io.c:1088 call_write_iter include/linux/fs.h:1966 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x64f/0xe40 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd other info that might help us debug this: Chain exists of: &p->pi_lock --> &rq->__lock --> (console_sem).lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock((console_sem).lock); lock(&rq->__lock); lock((console_sem).lock); lock(&p->pi_lock); *** DEADLOCK *** 5 locks held by syz-executor.0/5195: #0: ffff8880448fd0a0 (&tty->ldisc_sem){++++}-{0:0}, at: tty_ldisc_ref_wait+0x24/0x80 drivers/tty/tty_ldisc.c:243 #1: ffff8880448fd130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: tty_write_lock drivers/tty/tty_io.c:950 [inline] #1: ffff8880448fd130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: iterate_tty_write drivers/tty/tty_io.c:969 [inline] #1: ffff8880448fd130 (&tty->atomic_write_lock){+.+.}-{3:3}, at: file_tty_write.constprop.0+0x293/0x9b0 drivers/tty/tty_io.c:1088 #2: ffff8880448fd2e8 (&tty->termios_rwsem){++++}-{3:3}, at: n_tty_write+0x1c8/0x1130 drivers/tty/n_tty.c:2362 #3: ffffc90002d4c380 (&ldata->output_lock){+.+.}-{3:3}, at: process_output_block drivers/tty/n_tty.c:529 [inline] #3: ffffc90002d4c380 (&ldata->output_lock){+.+.}-{3:3}, at: n_tty_write+0x539/0x1130 drivers/tty/n_tty.c:2379 #4: ffffffff8cb98e18 ((console_sem).lock){-...}-{2:2}, at: up+0x16/0xb0 kernel/locking/semaphore.c:187 stack backtrace: CPU: 0 PID: 5195 Comm: syz-executor.0 Not tainted 6.6.0-rc4-next-20231005-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x311/0x3f0 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3868 [inline] __lock_acquire+0x2e3d/0x5de0 kernel/locking/lockdep.c:5136 lock_acquire kernel/locking/lockdep.c:5753 [inline] lock_acquire+0x1ae/0x510 kernel/locking/lockdep.c:5718 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162 class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:518 [inline] try_to_wake_up+0xb0/0x15d0 kernel/sched/core.c:4213 up+0x79/0xb0 kernel/locking/semaphore.c:191 __up_console_sem kernel/printk/printk.c:340 [inline] __console_unlock kernel/printk/printk.c:2699 [inline] console_unlock+0x1cf/0x260 kernel/printk/printk.c:3031 do_con_write+0x16df/0x7f40 drivers/tty/vt/vt.c:2918 con_write+0x23/0xb0 drivers/tty/vt/vt.c:3245 process_output_block drivers/tty/n_tty.c:574 [inline] n_tty_write+0x422/0x1130 drivers/tty/n_tty.c:2379 iterate_tty_write drivers/tty/tty_io.c:1017 [inline] file_tty_write.constprop.0+0x519/0x9b0 drivers/tty/tty_io.c:1088 call_write_iter include/linux/fs.h:1966 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x64f/0xe40 fs/read_write.c:584 ksys_write+0x12f/0x250 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fa88f87cae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa89057c0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fa88f99bf80 RCX: 00007fa88f87cae9 RDX: 000000000000098e RSI: 0000000020000000 RDI: 0000000000000004 RBP: 00007fa88f8c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fa88f99bf80 R15: 00007ffce66f0568 EEVDF scheduling fail, picking leftmost