=====================================================
WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
5.2.0-rc5+ #31 Not tainted
-----------------------------------------------------
syz-executor.4/17862 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
000000002b06a547 (&ctx->fault_pending_wqh){+.+.}, at: spin_lock include/linux/spinlock.h:338 [inline]
000000002b06a547 (&ctx->fault_pending_wqh){+.+.}, at: userfaultfd_ctx_read fs/userfaultfd.c:1047 [inline]
000000002b06a547 (&ctx->fault_pending_wqh){+.+.}, at: userfaultfd_read+0x540/0x1940 fs/userfaultfd.c:1205

and this task is already holding:
000000003b8030e3 (&ctx->fd_wqh){....}, at: spin_lock_irq include/linux/spinlock.h:363 [inline]
000000003b8030e3 (&ctx->fd_wqh){....}, at: userfaultfd_ctx_read fs/userfaultfd.c:1043 [inline]
000000003b8030e3 (&ctx->fd_wqh){....}, at: userfaultfd_read+0x27a/0x1940 fs/userfaultfd.c:1205
which would create a new lock dependency:
 (&ctx->fd_wqh){....} -> (&ctx->fault_pending_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
  invoke_softirq kernel/softirq.c:373 [inline]
  irq_exit+0x180/0x1d0 kernel/softirq.c:413
  exiting_irq arch/x86/include/asm/apic.h:536 [inline]
  smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1068
  apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:806
  arch_local_irq_restore arch/x86/include/asm/paravirt.h:767 [inline]
  console_unlock+0xb7c/0xec0 kernel/printk/printk.c:2471
  vprintk_emit+0x2a0/0x700 kernel/printk/printk.c:1986
  vprintk_default+0x28/0x30 kernel/printk/printk.c:2013
  vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:386
  printk+0xba/0xed kernel/printk/printk.c:2046
  ovl_parse_opt fs/overlayfs/super.c:565 [inline]
  ovl_fill_super.cold+0x345/0x8f5 fs/overlayfs/super.c:1571
  mount_nodev+0x66/0x110 fs/super.c:1392
  ovl_mount+0x2d/0x40 fs/overlayfs/super.c:1702
  legacy_get_tree+0x108/0x220 fs/fs_context.c:661
  vfs_get_tree+0x8e/0x390 fs/super.c:1476
  do_new_mount fs/namespace.c:2791 [inline]
  do_mount+0x138c/0x1c00 fs/namespace.c:3111
  ksys_mount+0xdb/0x150 fs/namespace.c:3320
  __do_sys_mount fs/namespace.c:3334 [inline]
  __se_sys_mount fs/namespace.c:3331 [inline]
  __x64_sys_mount+0xbe/0x150 fs/namespace.c:3331
  do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

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]
  userfaultfd_release+0x4ca/0x710 fs/userfaultfd.c:923
  __fput+0x2ff/0x890 fs/file_table.c:280
  ____fput+0x16/0x20 fs/file_table.c:313
  task_work_run+0x145/0x1c0 kernel/task_work.c:113
  tracehook_notify_resume include/linux/tracehook.h:185 [inline]
  exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:168
  prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
  syscall_return_slowpath arch/x86/entry/common.c:279 [inline]
  do_syscall_64+0x58e/0x680 arch/x86/entry/common.c:304
  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);
  <Interrupt>
    lock(&(&ctx->ctx_lock)->rlock);

 *** DEADLOCK ***

1 lock held by syz-executor.4/17862:
 #0: 000000003b8030e3 (&ctx->fd_wqh){....}, at: spin_lock_irq include/linux/spinlock.h:363 [inline]
 #0: 000000003b8030e3 (&ctx->fd_wqh){....}, at: userfaultfd_ctx_read fs/userfaultfd.c:1043 [inline]
 #0: 000000003b8030e3 (&ctx->fd_wqh){....}, at: userfaultfd_read+0x27a/0x1940 fs/userfaultfd.c:1205

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
                      invoke_softirq kernel/softirq.c:373 [inline]
                      irq_exit+0x180/0x1d0 kernel/softirq.c:413
                      exiting_irq arch/x86/include/asm/apic.h:536 [inline]
                      smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1068
                      apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:806
                      arch_local_irq_restore arch/x86/include/asm/paravirt.h:767 [inline]
                      console_unlock+0xb7c/0xec0 kernel/printk/printk.c:2471
                      vprintk_emit+0x2a0/0x700 kernel/printk/printk.c:1986
                      vprintk_default+0x28/0x30 kernel/printk/printk.c:2013
                      vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:386
                      printk+0xba/0xed kernel/printk/printk.c:2046
                      ovl_parse_opt fs/overlayfs/super.c:565 [inline]
                      ovl_fill_super.cold+0x345/0x8f5 fs/overlayfs/super.c:1571
                      mount_nodev+0x66/0x110 fs/super.c:1392
                      ovl_mount+0x2d/0x40 fs/overlayfs/super.c:1702
                      legacy_get_tree+0x108/0x220 fs/fs_context.c:661
                      vfs_get_tree+0x8e/0x390 fs/super.c:1476
                      do_new_mount fs/namespace.c:2791 [inline]
                      do_mount+0x138c/0x1c00 fs/namespace.c:3111
                      ksys_mount+0xdb/0x150 fs/namespace.c:3320
                      __do_sys_mount fs/namespace.c:3334 [inline]
                      __se_sys_mount fs/namespace.c:3331 [inline]
                      __x64_sys_mount+0xbe/0x150 fs/namespace.c:3331
                      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_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
                     invoke_softirq kernel/softirq.c:373 [inline]
                     irq_exit+0x180/0x1d0 kernel/softirq.c:413
                     exiting_irq arch/x86/include/asm/apic.h:536 [inline]
                     smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1068
                     apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:806
                     arch_local_irq_restore arch/x86/include/asm/paravirt.h:767 [inline]
                     console_unlock+0xb7c/0xec0 kernel/printk/printk.c:2471
                     vprintk_emit+0x2a0/0x700 kernel/printk/printk.c:1986
                     vprintk_default+0x28/0x30 kernel/printk/printk.c:2013
                     vprintk_func+0x7e/0x189 kernel/printk/printk_safe.c:386
                     printk+0xba/0xed kernel/printk/printk.c:2046
                     ovl_parse_opt fs/overlayfs/super.c:565 [inline]
                     ovl_fill_super.cold+0x345/0x8f5 fs/overlayfs/super.c:1571
                     mount_nodev+0x66/0x110 fs/super.c:1392
                     ovl_mount+0x2d/0x40 fs/overlayfs/super.c:1702
                     legacy_get_tree+0x108/0x220 fs/fs_context.c:661
                     vfs_get_tree+0x8e/0x390 fs/super.c:1476
                     do_new_mount fs/namespace.c:2791 [inline]
                     do_mount+0x138c/0x1c00 fs/namespace.c:3111
                     ksys_mount+0xdb/0x150 fs/namespace.c:3320
                     __do_sys_mount fs/namespace.c:3334 [inline]
                     __se_sys_mount fs/namespace.c:3331 [inline]
                     __x64_sys_mount+0xbe/0x150 fs/namespace.c:3331
                     do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
                     entry_SYSCALL_64_after_hwframe+0x49/0xbe
  }
  ... key      at: [<ffffffff8a67b220>] __key.53435+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]
   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

-> (&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
                   add_wait_queue+0x4c/0x170 kernel/sched/wait.c:23
                   aio_poll_queue_proc+0x9e/0x110 fs/aio.c:1715
                   poll_wait include/linux/poll.h:51 [inline]
                   userfaultfd_poll+0x91/0x210 fs/userfaultfd.c:972
                   vfs_poll include/linux/poll.h:90 [inline]
                   aio_poll fs/aio.c:1749 [inline]
                   __io_submit_one fs/aio.c:1826 [inline]
                   io_submit_one+0xe53/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
 }
 ... key      at: [<ffffffff8a67afa0>] __key.46111+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]
   userfaultfd_ctx_read fs/userfaultfd.c:1047 [inline]
   userfaultfd_read+0x540/0x1940 fs/userfaultfd.c:1205
   __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


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]
                    userfaultfd_release+0x4ca/0x710 fs/userfaultfd.c:923
                    __fput+0x2ff/0x890 fs/file_table.c:280
                    ____fput+0x16/0x20 fs/file_table.c:313
                    task_work_run+0x145/0x1c0 kernel/task_work.c:113
                    tracehook_notify_resume include/linux/tracehook.h:185 [inline]
                    exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:168
                    prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
                    syscall_return_slowpath arch/x86/entry/common.c:279 [inline]
                    do_syscall_64+0x58e/0x680 arch/x86/entry/common.c:304
                    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]
                    userfaultfd_release+0x4ca/0x710 fs/userfaultfd.c:923
                    __fput+0x2ff/0x890 fs/file_table.c:280
                    ____fput+0x16/0x20 fs/file_table.c:313
                    task_work_run+0x145/0x1c0 kernel/task_work.c:113
                    tracehook_notify_resume include/linux/tracehook.h:185 [inline]
                    exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:168
                    prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
                    syscall_return_slowpath arch/x86/entry/common.c:279 [inline]
                    do_syscall_64+0x58e/0x680 arch/x86/entry/common.c:304
                    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]
                   userfaultfd_release+0x4ca/0x710 fs/userfaultfd.c:923
                   __fput+0x2ff/0x890 fs/file_table.c:280
                   ____fput+0x16/0x20 fs/file_table.c:313
                   task_work_run+0x145/0x1c0 kernel/task_work.c:113
                   tracehook_notify_resume include/linux/tracehook.h:185 [inline]
                   exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:168
                   prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
                   syscall_return_slowpath arch/x86/entry/common.c:279 [inline]
                   do_syscall_64+0x58e/0x680 arch/x86/entry/common.c:304
                   entry_SYSCALL_64_after_hwframe+0x49/0xbe
 }
 ... key      at: [<ffffffff8a67b060>] __key.46108+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]
   userfaultfd_ctx_read fs/userfaultfd.c:1047 [inline]
   userfaultfd_read+0x540/0x1940 fs/userfaultfd.c:1205
   __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


stack backtrace:
CPU: 1 PID: 17862 Comm: syz-executor.4 Not tainted 5.2.0-rc5+ #31
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]
 userfaultfd_ctx_read fs/userfaultfd.c:1047 [inline]
 userfaultfd_read+0x540/0x1940 fs/userfaultfd.c:1205
 __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
RIP: 0033:0x4592c9
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:00007f4eda439c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004592c9
RDX: 0000000000000028 RSI: 0000000020000280 RDI: 0000000000000003
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f4eda43a6d4
R13: 00000000004c6503 R14: 00000000004db168 R15: 00000000ffffffff