audit: type=1400 audit(1560751472.648:36): avc: denied { map } for pid=7600 comm="syz-executor242" path="/root/syz-executor242166125" dev="sda1" ino=16484 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1 ======================================================== WARNING: possible irq lock inversion dependency detected 4.19.51 #23 Not tainted -------------------------------------------------------- syz-executor242/7602 just changed the state of lock: 0000000085faf78b (&ctx->fault_pending_wqh){+.+.}, at: spin_lock include/linux/spinlock.h:329 [inline] 0000000085faf78b (&ctx->fault_pending_wqh){+.+.}, at: userfaultfd_release+0x4d6/0x720 fs/userfaultfd.c:922 but this lock was taken by another, SOFTIRQ-safe lock in the past: (&(&ctx->ctx_lock)->rlock){..-.} and interrupts could create inverse lock ordering between them. 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 *** no locks held by syz-executor242/7602. the shortest dependencies between 2nd lock and 1st lock: -> (&(&ctx->ctx_lock)->rlock){..-.} ops: 2 { IN-SOFTIRQ-W at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x60/0x80 kernel/locking/spinlock.c:160 spin_lock_irq include/linux/spinlock.h:354 [inline] free_ioctx_users+0x2d/0x490 fs/aio.c:614 percpu_ref_put_many include/linux/percpu-refcount.h:284 [inline] percpu_ref_put include/linux/percpu-refcount.h:300 [inline] percpu_ref_call_confirm_rcu lib/percpu-refcount.c:123 [inline] percpu_ref_switch_to_atomic_rcu+0x407/0x540 lib/percpu-refcount.c:158 __rcu_reclaim kernel/rcu/rcu.h:236 [inline] rcu_do_batch kernel/rcu/tree.c:2584 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline] __rcu_process_callbacks kernel/rcu/tree.c:2864 [inline] rcu_process_callbacks+0xba0/0x1a30 kernel/rcu/tree.c:2881 __do_softirq+0x25c/0x921 kernel/softirq.c:292 invoke_softirq kernel/softirq.c:372 [inline] irq_exit+0x180/0x1d0 kernel/softirq.c:412 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1056 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:869 native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:60 arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:556 default_idle_call+0x36/0x90 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x377/0x560 kernel/sched/idle.c:262 cpu_startup_entry+0xc8/0xe0 kernel/sched/idle.c:368 rest_init+0xf1/0xf6 init/main.c:442 start_kernel+0x88c/0x8c5 init/main.c:738 x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:470 x86_64_start_kernel+0x77/0x7b arch/x86/kernel/head64.c:451 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 INITIAL USE at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x60/0x80 kernel/locking/spinlock.c:160 spin_lock_irq include/linux/spinlock.h:354 [inline] aio_poll fs/aio.c:1739 [inline] __io_submit_one fs/aio.c:1849 [inline] io_submit_one+0xead/0x2eb0 fs/aio.c:1885 __do_sys_io_submit fs/aio.c:1929 [inline] __se_sys_io_submit fs/aio.c:1900 [inline] __x64_sys_io_submit+0x1aa/0x520 fs/aio.c:1900 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe } ... key at: [] __key.50192+0x0/0x40 ... acquired at: __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:329 [inline] aio_poll fs/aio.c:1741 [inline] __io_submit_one fs/aio.c:1849 [inline] io_submit_one+0xef2/0x2eb0 fs/aio.c:1885 __do_sys_io_submit fs/aio.c:1929 [inline] __se_sys_io_submit fs/aio.c:1900 [inline] __x64_sys_io_submit+0x1aa/0x520 fs/aio.c:1900 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> (&ctx->fd_wqh){....} ops: 4 { INITIAL USE at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x60/0x80 kernel/locking/spinlock.c:160 spin_lock_irq include/linux/spinlock.h:354 [inline] userfaultfd_ctx_read fs/userfaultfd.c:1042 [inline] userfaultfd_read+0x262/0x18c0 fs/userfaultfd.c:1204 __vfs_read+0x114/0x800 fs/read_write.c:416 vfs_read+0x194/0x3d0 fs/read_write.c:452 ksys_read+0x14f/0x2d0 fs/read_write.c:579 __do_sys_read fs/read_write.c:589 [inline] __se_sys_read fs/read_write.c:587 [inline] __x64_sys_read+0x73/0xb0 fs/read_write.c:587 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe } ... key at: [] __key.43729+0x0/0x40 ... acquired at: __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:329 [inline] userfaultfd_ctx_read fs/userfaultfd.c:1046 [inline] userfaultfd_read+0x394/0x18c0 fs/userfaultfd.c:1204 __vfs_read+0x114/0x800 fs/read_write.c:416 vfs_read+0x194/0x3d0 fs/read_write.c:452 ksys_read+0x14f/0x2d0 fs/read_write.c:579 __do_sys_read fs/read_write.c:589 [inline] __se_sys_read fs/read_write.c:587 [inline] __x64_sys_read+0x73/0xb0 fs/read_write.c:587 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> (&ctx->fault_pending_wqh){+.+.} ops: 3 { HARDIRQ-ON-W at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:329 [inline] userfaultfd_release+0x4d6/0x720 fs/userfaultfd.c:922 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x933/0x2fa0 kernel/exit.c:876 do_group_exit+0x135/0x370 kernel/exit.c:979 get_signal+0x3ec/0x1fc0 kernel/signal.c:2574 do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821 exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe SOFTIRQ-ON-W at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:329 [inline] userfaultfd_release+0x4d6/0x720 fs/userfaultfd.c:922 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x933/0x2fa0 kernel/exit.c:876 do_group_exit+0x135/0x370 kernel/exit.c:979 get_signal+0x3ec/0x1fc0 kernel/signal.c:2574 do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821 exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe INITIAL USE at: lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:329 [inline] userfaultfd_ctx_read fs/userfaultfd.c:1046 [inline] userfaultfd_read+0x394/0x18c0 fs/userfaultfd.c:1204 __vfs_read+0x114/0x800 fs/read_write.c:416 vfs_read+0x194/0x3d0 fs/read_write.c:452 ksys_read+0x14f/0x2d0 fs/read_write.c:579 __do_sys_read fs/read_write.c:589 [inline] __se_sys_read fs/read_write.c:587 [inline] __x64_sys_read+0x73/0xb0 fs/read_write.c:587 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe } ... key at: [] __key.43726+0x0/0x40 ... acquired at: mark_lock_irq kernel/locking/lockdep.c:2755 [inline] mark_lock+0x420/0x1370 kernel/locking/lockdep.c:3127 mark_irqflags kernel/locking/lockdep.c:3023 [inline] __lock_acquire+0x6b5/0x48f0 kernel/locking/lockdep.c:3368 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:329 [inline] userfaultfd_release+0x4d6/0x720 fs/userfaultfd.c:922 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x933/0x2fa0 kernel/exit.c:876 do_group_exit+0x135/0x370 kernel/exit.c:979 get_signal+0x3ec/0x1fc0 kernel/signal.c:2574 do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821 exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe stack backtrace: CPU: 0 PID: 7602 Comm: syz-executor242 Not tainted 4.19.51 #23 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_irq_inversion_bug.part.0+0x2c0/0x2cd kernel/locking/lockdep.c:2621 print_irq_inversion_bug kernel/locking/lockdep.c:2624 [inline] check_usage_backwards.cold+0x1d/0x26 kernel/locking/lockdep.c:2670 mark_lock_irq kernel/locking/lockdep.c:2755 [inline] mark_lock+0x420/0x1370 kernel/locking/lockdep.c:3127 mark_irqflags kernel/locking/lockdep.c:3023 [inline] __lock_acquire+0x6b5/0x48f0 kernel/locking/lockdep.c:3368 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:3900 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:144 spin_lock include/linux/spinlock.h:329 [inline] userfaultfd_release+0x4d6/0x720 fs/userfaultfd.c:922 __fput+0x2dd/0x8b0 fs/file_table.c:278 ____fput+0x16/0x20 fs/file_table.c:309 task_work_run+0x145/0x1c0 kernel/task_work.c:113 exit_task_work include/linux/task_work.h:22 [inline] do_exit+0x933/0x2fa0 kernel/exit.c:876 do_group_exit+0x135/0x370 kernel/exit.c:979 get_signal+0x3ec/0x1fc0 kernel/signal.c:2574 do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821 exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4458f9 Code: Bad RIP value. RSP: 002b:00007fa4e3bf6db8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca RAX: fffffffffffffe00 RBX: 00000000006dac58 RCX: 00000000004458f9 RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00000000006dac58 RBP: 00