======================================================== WARNING: possible irq lock inversion dependency detected 5.10.0-syzkaller #0 Not tainted -------------------------------------------------------- syz-executor.0/19119 just changed the state of lock: ffff88802ffad498 (&ctx->completion_lock#2){-...}-{2:2}, at: io_timeout_fn+0x6f/0x3d0 fs/io_uring.c:5619 but this lock took another, HARDIRQ-READ-unsafe lock in the past: (&new->fa_lock){.+.+}-{2:2} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&new->fa_lock); local_irq_disable(); lock(&ctx->completion_lock#2); lock(&new->fa_lock); lock(&ctx->completion_lock#2); *** DEADLOCK *** 1 lock held by syz-executor.0/19119: #0: ffff88802ffad3e8 (&ctx->uring_lock){+.+.}-{3:3}, at: __do_sys_io_uring_enter+0x6c6/0x1e70 fs/io_uring.c:9191 the shortest dependencies between 2nd lock and 1st lock: -> (&new->fa_lock){.+.+}-{2:2} { HARDIRQ-ON-R at: lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:223 kill_fasync_rcu fs/fcntl.c:1004 [inline] kill_fasync fs/fcntl.c:1025 [inline] kill_fasync+0x14b/0x460 fs/fcntl.c:1018 sock_wake_async+0xd2/0x160 net/socket.c:1310 sk_wake_async include/net/sock.h:2279 [inline] sk_wake_async+0x16c/0x280 include/net/sock.h:2275 tcp_rcv_state_process+0x31ce/0x4ca0 net/ipv4/tcp_input.c:6428 tcp_v4_do_rcv+0x320/0x870 net/ipv4/tcp_ipv4.c:1698 sk_backlog_rcv include/net/sock.h:1016 [inline] __release_sock+0x134/0x3a0 net/core/sock.c:2542 release_sock+0x54/0x1b0 net/core/sock.c:3066 inet_wait_for_connect net/ipv4/af_inet.c:594 [inline] __inet_stream_connect+0x58a/0xe80 net/ipv4/af_inet.c:686 tcp_sendmsg_fastopen net/ipv4/tcp.c:1191 [inline] tcp_sendmsg_locked+0x1fd5/0x2d20 net/ipv4/tcp.c:1233 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1459 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:817 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 __sys_sendto+0x21c/0x320 net/socket.c:1975 __do_sys_sendto net/socket.c:1987 [inline] __se_sys_sendto net/socket.c:1983 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:1983 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 SOFTIRQ-ON-R at: lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:223 kill_fasync_rcu fs/fcntl.c:1004 [inline] kill_fasync fs/fcntl.c:1025 [inline] kill_fasync+0x14b/0x460 fs/fcntl.c:1018 sock_wake_async+0xd2/0x160 net/socket.c:1310 sk_wake_async include/net/sock.h:2279 [inline] sk_wake_async+0x16c/0x280 include/net/sock.h:2275 tcp_rcv_state_process+0x31ce/0x4ca0 net/ipv4/tcp_input.c:6428 tcp_v4_do_rcv+0x320/0x870 net/ipv4/tcp_ipv4.c:1698 sk_backlog_rcv include/net/sock.h:1016 [inline] __release_sock+0x134/0x3a0 net/core/sock.c:2542 release_sock+0x54/0x1b0 net/core/sock.c:3066 inet_wait_for_connect net/ipv4/af_inet.c:594 [inline] __inet_stream_connect+0x58a/0xe80 net/ipv4/af_inet.c:686 tcp_sendmsg_fastopen net/ipv4/tcp.c:1191 [inline] tcp_sendmsg_locked+0x1fd5/0x2d20 net/ipv4/tcp.c:1233 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1459 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:817 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 __sys_sendto+0x21c/0x320 net/socket.c:1975 __do_sys_sendto net/socket.c:1987 [inline] __se_sys_sendto net/socket.c:1983 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:1983 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 INITIAL USE at: lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_write_lock_irq include/linux/rwlock_api_smp.h:196 [inline] _raw_write_lock_irq+0x32/0x50 kernel/locking/spinlock.c:311 fasync_remove_entry+0xb6/0x1f0 fs/fcntl.c:882 fasync_helper+0x9e/0xb0 fs/fcntl.c:985 sock_fasync+0x94/0x140 net/socket.c:1281 __fput+0x70d/0x920 fs/file_table.c:277 task_work_run+0xdd/0x190 kernel/task_work.c:140 exit_task_work include/linux/task_work.h:30 [inline] do_exit+0xb89/0x29e0 kernel/exit.c:823 do_group_exit+0x125/0x310 kernel/exit.c:920 get_signal+0x3ec/0x2010 kernel/signal.c:2770 arch_do_signal_or_restart+0x2a8/0x1eb0 arch/x86/kernel/signal.c:811 handle_signal_work kernel/entry/common.c:147 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x148/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:302 entry_SYSCALL_64_after_hwframe+0x44/0xa9 INITIAL READ USE at: lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:223 kill_fasync_rcu fs/fcntl.c:1004 [inline] kill_fasync fs/fcntl.c:1025 [inline] kill_fasync+0x14b/0x460 fs/fcntl.c:1018 sock_wake_async+0xd2/0x160 net/socket.c:1310 sk_wake_async include/net/sock.h:2279 [inline] sk_wake_async+0x16c/0x280 include/net/sock.h:2275 tcp_rcv_state_process+0x31ce/0x4ca0 net/ipv4/tcp_input.c:6428 tcp_v4_do_rcv+0x320/0x870 net/ipv4/tcp_ipv4.c:1698 sk_backlog_rcv include/net/sock.h:1016 [inline] __release_sock+0x134/0x3a0 net/core/sock.c:2542 release_sock+0x54/0x1b0 net/core/sock.c:3066 inet_wait_for_connect net/ipv4/af_inet.c:594 [inline] __inet_stream_connect+0x58a/0xe80 net/ipv4/af_inet.c:686 tcp_sendmsg_fastopen net/ipv4/tcp.c:1191 [inline] tcp_sendmsg_locked+0x1fd5/0x2d20 net/ipv4/tcp.c:1233 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1459 inet_sendmsg+0x99/0xe0 net/ipv4/af_inet.c:817 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 __sys_sendto+0x21c/0x320 net/socket.c:1975 __do_sys_sendto net/socket.c:1987 [inline] __se_sys_sendto net/socket.c:1983 [inline] __x64_sys_sendto+0xdd/0x1b0 net/socket.c:1983 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 } ... key at: [] __key.0+0x0/0x40 ... acquired at: __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:223 kill_fasync_rcu fs/fcntl.c:1004 [inline] kill_fasync fs/fcntl.c:1025 [inline] kill_fasync+0x14b/0x460 fs/fcntl.c:1018 __io_commit_cqring fs/io_uring.c:1344 [inline] io_commit_cqring+0x34e/0xa90 fs/io_uring.c:1654 io_submit_flush_completions+0x269/0x3a0 fs/io_uring.c:1851 __io_req_complete+0x209/0x310 fs/io_uring.c:1870 io_nop fs/io_uring.c:3893 [inline] io_issue_sqe+0x1234/0x4490 fs/io_uring.c:6180 __io_queue_sqe+0x228/0x10c0 fs/io_uring.c:6484 io_queue_sqe+0x631/0x10d0 fs/io_uring.c:6550 io_submit_sqe fs/io_uring.c:6623 [inline] io_submit_sqes+0x1495/0x2720 fs/io_uring.c:6871 __do_sys_io_uring_enter+0x6d1/0x1e70 fs/io_uring.c:9192 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 -> (&ctx->completion_lock#2){-...}-{2:2} { IN-HARDIRQ-W at: lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 io_timeout_fn+0x6f/0x3d0 fs/io_uring.c:5619 __run_hrtimer kernel/time/hrtimer.c:1519 [inline] __hrtimer_run_queues+0x693/0xea0 kernel/time/hrtimer.c:1583 hrtimer_interrupt+0x334/0x940 kernel/time/hrtimer.c:1645 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1085 [inline] __sysvec_apic_timer_interrupt+0x146/0x540 arch/x86/kernel/apic/apic.c:1102 asm_call_irq_on_stack+0xf/0x20 __run_sysvec_on_irqstack arch/x86/include/asm/irq_stack.h:37 [inline] run_sysvec_on_irqstack_cond arch/x86/include/asm/irq_stack.h:89 [inline] sysvec_apic_timer_interrupt+0xbd/0x100 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:628 __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline] _raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:199 spin_unlock_irq include/linux/spinlock.h:404 [inline] io_timeout fs/io_uring.c:5823 [inline] io_issue_sqe+0x1cf3/0x4490 fs/io_uring.c:6217 __io_queue_sqe+0x228/0x10c0 fs/io_uring.c:6484 io_queue_sqe+0x631/0x10d0 fs/io_uring.c:6550 io_queue_link_head fs/io_uring.c:6561 [inline] io_submit_sqes+0xac1/0x2720 fs/io_uring.c:6886 __do_sys_io_uring_enter+0x6d1/0x1e70 fs/io_uring.c:9192 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 INITIAL USE at: lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 io_cqring_add_event fs/io_uring.c:1817 [inline] __io_req_complete fs/io_uring.c:1862 [inline] __io_req_complete fs/io_uring.c:1858 [inline] io_req_complete fs/io_uring.c:1876 [inline] io_queue_sqe+0xad8/0x10d0 fs/io_uring.c:6535 io_submit_sqe fs/io_uring.c:6623 [inline] io_submit_sqes+0x1495/0x2720 fs/io_uring.c:6871 __do_sys_io_uring_enter+0x6d1/0x1e70 fs/io_uring.c:9192 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 } ... key at: [] __key.10+0x0/0x40 ... acquired at: mark_usage kernel/locking/lockdep.c:4303 [inline] __lock_acquire+0x1459/0x5500 kernel/locking/lockdep.c:4786 lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 io_timeout_fn+0x6f/0x3d0 fs/io_uring.c:5619 __run_hrtimer kernel/time/hrtimer.c:1519 [inline] __hrtimer_run_queues+0x693/0xea0 kernel/time/hrtimer.c:1583 hrtimer_interrupt+0x334/0x940 kernel/time/hrtimer.c:1645 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1085 [inline] __sysvec_apic_timer_interrupt+0x146/0x540 arch/x86/kernel/apic/apic.c:1102 asm_call_irq_on_stack+0xf/0x20 __run_sysvec_on_irqstack arch/x86/include/asm/irq_stack.h:37 [inline] run_sysvec_on_irqstack_cond arch/x86/include/asm/irq_stack.h:89 [inline] sysvec_apic_timer_interrupt+0xbd/0x100 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:628 __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline] _raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:199 spin_unlock_irq include/linux/spinlock.h:404 [inline] io_timeout fs/io_uring.c:5823 [inline] io_issue_sqe+0x1cf3/0x4490 fs/io_uring.c:6217 __io_queue_sqe+0x228/0x10c0 fs/io_uring.c:6484 io_queue_sqe+0x631/0x10d0 fs/io_uring.c:6550 io_queue_link_head fs/io_uring.c:6561 [inline] io_submit_sqes+0xac1/0x2720 fs/io_uring.c:6886 __do_sys_io_uring_enter+0x6d1/0x1e70 fs/io_uring.c:9192 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 stack backtrace: CPU: 0 PID: 19119 Comm: syz-executor.0 Not tainted 5.10.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x107/0x163 lib/dump_stack.c:120 print_irq_inversion_bug kernel/locking/lockdep.c:4413 [inline] check_usage_forwards kernel/locking/lockdep.c:3849 [inline] mark_lock_irq kernel/locking/lockdep.c:3981 [inline] mark_lock.cold+0x6e/0x73 kernel/locking/lockdep.c:4411 mark_usage kernel/locking/lockdep.c:4303 [inline] __lock_acquire+0x1459/0x5500 kernel/locking/lockdep.c:4786 lock_acquire kernel/locking/lockdep.c:5437 [inline] lock_acquire+0x29d/0x740 kernel/locking/lockdep.c:5402 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 io_timeout_fn+0x6f/0x3d0 fs/io_uring.c:5619 __run_hrtimer kernel/time/hrtimer.c:1519 [inline] __hrtimer_run_queues+0x693/0xea0 kernel/time/hrtimer.c:1583 hrtimer_interrupt+0x334/0x940 kernel/time/hrtimer.c:1645 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1085 [inline] __sysvec_apic_timer_interrupt+0x146/0x540 arch/x86/kernel/apic/apic.c:1102 asm_call_irq_on_stack+0xf/0x20 __run_sysvec_on_irqstack arch/x86/include/asm/irq_stack.h:37 [inline] run_sysvec_on_irqstack_cond arch/x86/include/asm/irq_stack.h:89 [inline] sysvec_apic_timer_interrupt+0xbd/0x100 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:628 RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline] RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:199 Code: 0f 1f 44 00 00 55 48 8b 74 24 08 48 89 fd 48 83 c7 18 e8 ce 09 6b f8 48 89 ef e8 56 be 6b f8 e8 f1 c1 8a f8 fb bf 01 00 00 00 e6 c5 5f f8 65 8b 05 9f 6c 14 77 85 c0 74 02 5d c3 e8 db c1 12 RSP: 0018:ffffc90015ddf868 EFLAGS: 00000202 RAX: 0000000000003df7 RBX: 0000000000000000 RCX: ffffffff81581107 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001 RBP: ffff88802ffad480 R08: 0000000000000001 R09: ffffffff8ebd58bf R10: fffffbfff1d7ab17 R11: 0000000000000000 R12: ffff888023592f80 R13: 0000000000000000 R14: 0000000000989680 R15: ffff88801296c640 spin_unlock_irq include/linux/spinlock.h:404 [inline] io_timeout fs/io_uring.c:5823 [inline] io_issue_sqe+0x1cf3/0x4490 fs/io_uring.c:6217 __io_queue_sqe+0x228/0x10c0 fs/io_uring.c:6484 io_queue_sqe+0x631/0x10d0 fs/io_uring.c:6550 io_queue_link_head fs/io_uring.c:6561 [inline] io_submit_sqes+0xac1/0x2720 fs/io_uring.c:6886 __do_sys_io_uring_enter+0x6d1/0x1e70 fs/io_uring.c:9192 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45e229 Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f2f58b17c68 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 000000000045e229 RDX: 0000000000000000 RSI: 000000000000450c RDI: 0000000000000004 RBP: 000000000119bfd8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119bf8c R13: 00000000016afb6f R14: 00007f2f58b189c0 R15: 000000000119bf8c