===================================================== WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected 5.2.0-rc7 #39 Not tainted ----------------------------------------------------- syz-executor.0/19193 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire: 00000000b6258fed (&ctx->fd_wqh){....}, at: spin_lock include/linux/spinlock.h:338 [inline] 00000000b6258fed (&ctx->fd_wqh){....}, at: aio_poll fs/aio.c:1752 [inline] 00000000b6258fed (&ctx->fd_wqh){....}, at: __io_submit_one fs/aio.c:1826 [inline] 00000000b6258fed (&ctx->fd_wqh){....}, at: io_submit_one+0xefa/0x2ef0 fs/aio.c:1863 and this task is already holding: 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: spin_lock_irq include/linux/spinlock.h:363 [inline] 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: aio_poll fs/aio.c:1750 [inline] 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: __io_submit_one fs/aio.c:1826 [inline] 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: io_submit_one+0xeb5/0x2ef0 fs/aio.c:1863 which would create a new lock dependency: (&(&ctx->ctx_lock)->rlock){..-.} -> (&ctx->fd_wqh){....} but this new dependency connects a SOFTIRQ-irq-safe lock: (&(&ctx->ctx_lock)->rlock){..-.} ... which became SOFTIRQ-irq-safe at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x60/0x80 kernel/locking/spinlock.c:167 spin_lock_irq include/linux/spinlock.h:363 [inline] free_ioctx_users+0x2d/0x490 fs/aio.c:620 percpu_ref_put_many include/linux/percpu-refcount.h:285 [inline] percpu_ref_put include/linux/percpu-refcount.h:301 [inline] percpu_ref_call_confirm_rcu lib/percpu-refcount.c:124 [inline] percpu_ref_switch_to_atomic_rcu+0x407/0x540 lib/percpu-refcount.c:159 __rcu_reclaim kernel/rcu/rcu.h:222 [inline] rcu_do_batch kernel/rcu/tree.c:2092 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2310 [inline] rcu_core+0xba5/0x1500 kernel/rcu/tree.c:2291 __do_softirq+0x25c/0x94c kernel/softirq.c:292 run_ksoftirqd kernel/softirq.c:603 [inline] run_ksoftirqd+0x8e/0x110 kernel/softirq.c:595 smpboot_thread_fn+0x6a3/0xa30 kernel/smpboot.c:165 kthread+0x354/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 to a SOFTIRQ-irq-unsafe lock: (&ctx->fault_pending_wqh){+.+.} ... which became SOFTIRQ-irq-unsafe at: ... lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] handle_userfault+0x58e/0x18c0 fs/userfaultfd.c:461 do_anonymous_page mm/memory.c:3029 [inline] handle_pte_fault mm/memory.c:3895 [inline] __handle_mm_fault+0x3612/0x3eb0 mm/memory.c:4021 handle_mm_fault+0x3b7/0xa90 mm/memory.c:4058 do_user_addr_fault arch/x86/mm/fault.c:1457 [inline] __do_page_fault+0x5ef/0xda0 arch/x86/mm/fault.c:1523 do_page_fault+0x71/0x57d arch/x86/mm/fault.c:1554 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1156 copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:89 copy_from_user include/linux/uaccess.h:144 [inline] sctp_getsockopt_maxseg net/sctp/socket.c:6782 [inline] sctp_getsockopt net/sctp/socket.c:7881 [inline] sctp_getsockopt+0x2f5c/0x6720 net/sctp/socket.c:7786 sock_common_getsockopt+0x94/0xd0 net/core/sock.c:3085 __sys_getsockopt+0x15f/0x240 net/socket.c:2109 __do_sys_getsockopt net/socket.c:2120 [inline] __se_sys_getsockopt net/socket.c:2117 [inline] __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2117 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Chain exists of: &(&ctx->ctx_lock)->rlock --> &ctx->fd_wqh --> &ctx->fault_pending_wqh Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&ctx->fault_pending_wqh); local_irq_disable(); lock(&(&ctx->ctx_lock)->rlock); lock(&ctx->fd_wqh); lock(&(&ctx->ctx_lock)->rlock); *** DEADLOCK *** 1 lock held by syz-executor.0/19193: #0: 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: spin_lock_irq include/linux/spinlock.h:363 [inline] #0: 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: aio_poll fs/aio.c:1750 [inline] #0: 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: __io_submit_one fs/aio.c:1826 [inline] #0: 00000000ea36fff6 (&(&ctx->ctx_lock)->rlock){..-.}, at: io_submit_one+0xeb5/0x2ef0 fs/aio.c:1863 the dependencies between SOFTIRQ-irq-safe lock and the holding lock: -> (&(&ctx->ctx_lock)->rlock){..-.} { IN-SOFTIRQ-W at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x60/0x80 kernel/locking/spinlock.c:167 spin_lock_irq include/linux/spinlock.h:363 [inline] free_ioctx_users+0x2d/0x490 fs/aio.c:620 percpu_ref_put_many include/linux/percpu-refcount.h:285 [inline] percpu_ref_put include/linux/percpu-refcount.h:301 [inline] percpu_ref_call_confirm_rcu lib/percpu-refcount.c:124 [inline] percpu_ref_switch_to_atomic_rcu+0x407/0x540 lib/percpu-refcount.c:159 __rcu_reclaim kernel/rcu/rcu.h:222 [inline] rcu_do_batch kernel/rcu/tree.c:2092 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2310 [inline] rcu_core+0xba5/0x1500 kernel/rcu/tree.c:2291 __do_softirq+0x25c/0x94c kernel/softirq.c:292 run_ksoftirqd kernel/softirq.c:603 [inline] run_ksoftirqd+0x8e/0x110 kernel/softirq.c:595 smpboot_thread_fn+0x6a3/0xa30 kernel/smpboot.c:165 kthread+0x354/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 INITIAL USE at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x60/0x80 kernel/locking/spinlock.c:167 spin_lock_irq include/linux/spinlock.h:363 [inline] free_ioctx_users+0x2d/0x490 fs/aio.c:620 percpu_ref_put_many include/linux/percpu-refcount.h:285 [inline] percpu_ref_put include/linux/percpu-refcount.h:301 [inline] percpu_ref_call_confirm_rcu lib/percpu-refcount.c:124 [inline] percpu_ref_switch_to_atomic_rcu+0x407/0x540 lib/percpu-refcount.c:159 __rcu_reclaim kernel/rcu/rcu.h:222 [inline] rcu_do_batch kernel/rcu/tree.c:2092 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2310 [inline] rcu_core+0xba5/0x1500 kernel/rcu/tree.c:2291 __do_softirq+0x25c/0x94c kernel/softirq.c:292 run_ksoftirqd kernel/softirq.c:603 [inline] run_ksoftirqd+0x8e/0x110 kernel/softirq.c:595 smpboot_thread_fn+0x6a3/0xa30 kernel/smpboot.c:165 kthread+0x354/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 } ... key at: [] __key.53436+0x0/0x40 ... acquired at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] aio_poll fs/aio.c:1752 [inline] __io_submit_one fs/aio.c:1826 [inline] io_submit_one+0xefa/0x2ef0 fs/aio.c:1863 __do_sys_io_submit fs/aio.c:1922 [inline] __se_sys_io_submit fs/aio.c:1892 [inline] __x64_sys_io_submit+0x1bd/0x570 fs/aio.c:1892 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe the dependencies between the lock to be acquired and SOFTIRQ-irq-unsafe lock: -> (&ctx->fault_pending_wqh){+.+.} { HARDIRQ-ON-W at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] handle_userfault+0x58e/0x18c0 fs/userfaultfd.c:461 do_anonymous_page mm/memory.c:3029 [inline] handle_pte_fault mm/memory.c:3895 [inline] __handle_mm_fault+0x3612/0x3eb0 mm/memory.c:4021 handle_mm_fault+0x3b7/0xa90 mm/memory.c:4058 do_user_addr_fault arch/x86/mm/fault.c:1457 [inline] __do_page_fault+0x5ef/0xda0 arch/x86/mm/fault.c:1523 do_page_fault+0x71/0x57d arch/x86/mm/fault.c:1554 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1156 copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:89 copy_from_user include/linux/uaccess.h:144 [inline] sctp_getsockopt_maxseg net/sctp/socket.c:6782 [inline] sctp_getsockopt net/sctp/socket.c:7881 [inline] sctp_getsockopt+0x2f5c/0x6720 net/sctp/socket.c:7786 sock_common_getsockopt+0x94/0xd0 net/core/sock.c:3085 __sys_getsockopt+0x15f/0x240 net/socket.c:2109 __do_sys_getsockopt net/socket.c:2120 [inline] __se_sys_getsockopt net/socket.c:2117 [inline] __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2117 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe SOFTIRQ-ON-W at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] handle_userfault+0x58e/0x18c0 fs/userfaultfd.c:461 do_anonymous_page mm/memory.c:3029 [inline] handle_pte_fault mm/memory.c:3895 [inline] __handle_mm_fault+0x3612/0x3eb0 mm/memory.c:4021 handle_mm_fault+0x3b7/0xa90 mm/memory.c:4058 do_user_addr_fault arch/x86/mm/fault.c:1457 [inline] __do_page_fault+0x5ef/0xda0 arch/x86/mm/fault.c:1523 do_page_fault+0x71/0x57d arch/x86/mm/fault.c:1554 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1156 copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:89 copy_from_user include/linux/uaccess.h:144 [inline] sctp_getsockopt_maxseg net/sctp/socket.c:6782 [inline] sctp_getsockopt net/sctp/socket.c:7881 [inline] sctp_getsockopt+0x2f5c/0x6720 net/sctp/socket.c:7786 sock_common_getsockopt+0x94/0xd0 net/core/sock.c:3085 __sys_getsockopt+0x15f/0x240 net/socket.c:2109 __do_sys_getsockopt net/socket.c:2120 [inline] __se_sys_getsockopt net/socket.c:2117 [inline] __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2117 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe INITIAL USE at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] handle_userfault+0x58e/0x18c0 fs/userfaultfd.c:461 do_anonymous_page mm/memory.c:3029 [inline] handle_pte_fault mm/memory.c:3895 [inline] __handle_mm_fault+0x3612/0x3eb0 mm/memory.c:4021 handle_mm_fault+0x3b7/0xa90 mm/memory.c:4058 do_user_addr_fault arch/x86/mm/fault.c:1457 [inline] __do_page_fault+0x5ef/0xda0 arch/x86/mm/fault.c:1523 do_page_fault+0x71/0x57d arch/x86/mm/fault.c:1554 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1156 copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:89 copy_from_user include/linux/uaccess.h:144 [inline] sctp_getsockopt_maxseg net/sctp/socket.c:6782 [inline] sctp_getsockopt net/sctp/socket.c:7881 [inline] sctp_getsockopt+0x2f5c/0x6720 net/sctp/socket.c:7786 sock_common_getsockopt+0x94/0xd0 net/core/sock.c:3085 __sys_getsockopt+0x15f/0x240 net/socket.c:2109 __do_sys_getsockopt net/socket.c:2120 [inline] __se_sys_getsockopt net/socket.c:2117 [inline] __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2117 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe } ... key at: [] __key.46109+0x0/0x40 ... acquired at: __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] userfaultfd_ctx_read fs/userfaultfd.c:1045 [inline] userfaultfd_read+0x540/0x1940 fs/userfaultfd.c:1203 __vfs_read+0x8a/0x110 fs/read_write.c:425 vfs_read+0x194/0x3e0 fs/read_write.c:461 ksys_read+0x14f/0x290 fs/read_write.c:587 __do_sys_read fs/read_write.c:597 [inline] __se_sys_read fs/read_write.c:595 [inline] __x64_sys_read+0x73/0xb0 fs/read_write.c:595 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> (&ctx->fd_wqh){....} { INITIAL USE at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x95/0xcd kernel/locking/spinlock.c:159 __wake_up_common_lock+0xc7/0x190 kernel/sched/wait.c:121 __wake_up+0xe/0x10 kernel/sched/wait.c:146 handle_userfault+0x925/0x18c0 fs/userfaultfd.c:487 do_anonymous_page mm/memory.c:3029 [inline] handle_pte_fault mm/memory.c:3895 [inline] __handle_mm_fault+0x3612/0x3eb0 mm/memory.c:4021 handle_mm_fault+0x3b7/0xa90 mm/memory.c:4058 do_user_addr_fault arch/x86/mm/fault.c:1457 [inline] __do_page_fault+0x5ef/0xda0 arch/x86/mm/fault.c:1523 do_page_fault+0x71/0x57d arch/x86/mm/fault.c:1554 page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1156 copy_user_generic_unrolled+0x86/0xc0 arch/x86/lib/copy_user_64.S:89 copy_from_user include/linux/uaccess.h:144 [inline] sctp_getsockopt_maxseg net/sctp/socket.c:6782 [inline] sctp_getsockopt net/sctp/socket.c:7881 [inline] sctp_getsockopt+0x2f5c/0x6720 net/sctp/socket.c:7786 sock_common_getsockopt+0x94/0xd0 net/core/sock.c:3085 __sys_getsockopt+0x15f/0x240 net/socket.c:2109 __do_sys_getsockopt net/socket.c:2120 [inline] __se_sys_getsockopt net/socket.c:2117 [inline] __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2117 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe } ... key at: [] __key.46112+0x0/0x40 ... acquired at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] aio_poll fs/aio.c:1752 [inline] __io_submit_one fs/aio.c:1826 [inline] io_submit_one+0xefa/0x2ef0 fs/aio.c:1863 __do_sys_io_submit fs/aio.c:1922 [inline] __se_sys_io_submit fs/aio.c:1892 [inline] __x64_sys_io_submit+0x1bd/0x570 fs/aio.c:1892 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe stack backtrace: CPU: 1 PID: 19193 Comm: syz-executor.0 Not tainted 5.2.0-rc7 #39 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_bad_irq_dependency kernel/locking/lockdep.c:1920 [inline] check_irq_usage.cold+0x711/0xba0 kernel/locking/lockdep.c:2114 check_prev_add kernel/locking/lockdep.c:2315 [inline] check_prevs_add kernel/locking/lockdep.c:2418 [inline] validate_chain kernel/locking/lockdep.c:2800 [inline] __lock_acquire+0x2469/0x5490 kernel/locking/lockdep.c:3793 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] aio_poll fs/aio.c:1752 [inline] __io_submit_one fs/aio.c:1826 [inline] io_submit_one+0xefa/0x2ef0 fs/aio.c:1863 __do_sys_io_submit fs/aio.c:1922 [inline] __se_sys_io_submit fs/aio.c:1892 [inline] __x64_sys_io_submit+0x1bd/0x570 fs/aio.c:1892 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4597c9 Code: fd b7 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 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f9f0ff49c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000d1 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004597c9 RDX: 0000000020000000 RSI: 0000000000000001 RDI: 00007f9f0ff28000 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9f0ff4a6d4 R13: 00000000004c0b97 R14: 00000000004d3908 R15: 00000000ffffffff