======================================================== WARNING: possible irq lock inversion dependency detected 5.14.0-rc2-syzkaller #0 Not tainted -------------------------------------------------------- syz-fuzzer/8458 just changed the state of lock: ffff888147c37148 (&timer->lock){..-.}-{2:2}, at: snd_timer_interrupt.part.0+0x34/0xcf0 sound/core/timer.c:857 but this lock took another, SOFTIRQ-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(&timer->lock); lock(&new->fa_lock); lock(&timer->lock); *** DEADLOCK *** 1 lock held by syz-fuzzer/8458: #0: ffffc90000007d70 ((&priv->tlist)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:35 [inline] #0: ffffc90000007d70 ((&priv->tlist)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x6b0 kernel/time/timer.c:1407 the shortest dependencies between 2nd lock and 1st lock: -> (&new->fa_lock){.+.+}-{2:2} { HARDIRQ-ON-R at: lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __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:1012 [inline] kill_fasync fs/fcntl.c:1033 [inline] kill_fasync+0x132/0x460 fs/fcntl.c:1026 fsnotify_add_event+0x3ba/0x500 fs/notify/notification.c:128 inotify_handle_inode_event+0x31b/0x5c0 fs/notify/inotify/inotify_fsnotify.c:119 fsnotify_handle_inode_event.isra.0+0x1b8/0x270 fs/notify/fsnotify.c:263 fsnotify_handle_event fs/notify/fsnotify.c:310 [inline] send_to_group fs/notify/fsnotify.c:364 [inline] fsnotify+0xc27/0x1050 fs/notify/fsnotify.c:541 fsnotify_parent include/linux/fsnotify.h:71 [inline] fsnotify_file include/linux/fsnotify.h:90 [inline] fsnotify_open include/linux/fsnotify.h:268 [inline] do_sys_openat2+0x3a3/0x420 fs/open.c:1209 do_sys_open fs/open.c:1220 [inline] __do_sys_open fs/open.c:1228 [inline] __se_sys_open fs/open.c:1224 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1224 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae SOFTIRQ-ON-R at: lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __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:1012 [inline] kill_fasync fs/fcntl.c:1033 [inline] kill_fasync+0x132/0x460 fs/fcntl.c:1026 fsnotify_add_event+0x3ba/0x500 fs/notify/notification.c:128 inotify_handle_inode_event+0x31b/0x5c0 fs/notify/inotify/inotify_fsnotify.c:119 fsnotify_handle_inode_event.isra.0+0x1b8/0x270 fs/notify/fsnotify.c:263 fsnotify_handle_event fs/notify/fsnotify.c:310 [inline] send_to_group fs/notify/fsnotify.c:364 [inline] fsnotify+0xc27/0x1050 fs/notify/fsnotify.c:541 fsnotify_parent include/linux/fsnotify.h:71 [inline] fsnotify_file include/linux/fsnotify.h:90 [inline] fsnotify_open include/linux/fsnotify.h:268 [inline] do_sys_openat2+0x3a3/0x420 fs/open.c:1209 do_sys_open fs/open.c:1220 [inline] __do_sys_open fs/open.c:1228 [inline] __se_sys_open fs/open.c:1224 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1224 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL USE at: lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __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:890 fasync_helper+0x9e/0xb0 fs/fcntl.c:993 fsnotify_fasync+0x4d/0x80 fs/notify/group.c:162 __fput+0x712/0x920 fs/file_table.c:277 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL READ USE at: lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __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:1012 [inline] kill_fasync fs/fcntl.c:1033 [inline] kill_fasync+0x132/0x460 fs/fcntl.c:1026 fsnotify_add_event+0x3ba/0x500 fs/notify/notification.c:128 inotify_handle_inode_event+0x31b/0x5c0 fs/notify/inotify/inotify_fsnotify.c:119 fsnotify_handle_inode_event.isra.0+0x1b8/0x270 fs/notify/fsnotify.c:263 fsnotify_handle_event fs/notify/fsnotify.c:310 [inline] send_to_group fs/notify/fsnotify.c:364 [inline] fsnotify+0xc27/0x1050 fs/notify/fsnotify.c:541 fsnotify_parent include/linux/fsnotify.h:71 [inline] fsnotify_file include/linux/fsnotify.h:90 [inline] fsnotify_open include/linux/fsnotify.h:268 [inline] do_sys_openat2+0x3a3/0x420 fs/open.c:1209 do_sys_open fs/open.c:1220 [inline] __do_sys_open fs/open.c:1228 [inline] __se_sys_open fs/open.c:1224 [inline] __x64_sys_open+0x119/0x1c0 fs/open.c:1224 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... 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:1012 [inline] kill_fasync fs/fcntl.c:1033 [inline] kill_fasync+0x132/0x460 fs/fcntl.c:1026 snd_timer_user_ccallback+0x298/0x330 sound/core/timer.c:1387 snd_timer_notify1+0x11c/0x3b0 sound/core/timer.c:516 snd_timer_start1+0x4d4/0x800 sound/core/timer.c:578 snd_timer_start sound/core/timer.c:697 [inline] snd_timer_start sound/core/timer.c:690 [inline] snd_timer_user_start.isra.0+0x1e3/0x260 sound/core/timer.c:1985 __snd_timer_user_ioctl.isra.0+0xda8/0x24c0 sound/core/timer.c:2108 snd_timer_user_ioctl+0x77/0xb0 sound/core/timer.c:2129 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl fs/ioctl.c:1055 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:1055 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> (&timer->lock){..-.}-{2:2} { IN-SOFTIRQ-W at: lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 snd_timer_interrupt.part.0+0x34/0xcf0 sound/core/timer.c:857 snd_timer_interrupt sound/core/timer.c:1155 [inline] snd_timer_s_function+0x14b/0x200 sound/core/timer.c:1155 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1417 expire_timers kernel/time/timer.c:1462 [inline] __run_timers.part.0+0x675/0xa50 kernel/time/timer.c:1731 __run_timers kernel/time/timer.c:1712 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1744 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x16e/0x1c0 kernel/softirq.c:636 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 get_current arch/x86/include/asm/current.h:15 [inline] finish_task_switch.isra.0+0x23c/0xa50 kernel/sched/core.c:4557 context_switch kernel/sched/core.c:4686 [inline] __schedule+0x942/0x26f0 kernel/sched/core.c:5940 schedule+0xd3/0x270 kernel/sched/core.c:6019 freezable_schedule include/linux/freezer.h:172 [inline] do_nanosleep+0x24e/0x690 kernel/time/hrtimer.c:1896 hrtimer_nanosleep+0x1f9/0x4a0 kernel/time/hrtimer.c:1949 __do_sys_nanosleep kernel/time/hrtimer.c:1983 [inline] __se_sys_nanosleep kernel/time/hrtimer.c:1970 [inline] __x64_sys_nanosleep+0x1dc/0x260 kernel/time/hrtimer.c:1970 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL USE at: lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 snd_timer_notify sound/core/timer.c:1087 [inline] snd_timer_notify+0x10c/0x3d0 sound/core/timer.c:1074 snd_pcm_timer_notify sound/core/pcm_native.c:587 [inline] snd_pcm_post_stop+0x195/0x1f0 sound/core/pcm_native.c:1445 snd_pcm_action_single sound/core/pcm_native.c:1221 [inline] snd_pcm_action+0x143/0x170 sound/core/pcm_native.c:1302 snd_pcm_stop sound/core/pcm_native.c:1468 [inline] snd_pcm_drop+0x1ab/0x320 sound/core/pcm_native.c:2147 snd_pcm_kernel_ioctl+0x12f/0x240 sound/core/pcm_native.c:3359 snd_pcm_oss_sync+0x230/0x800 sound/core/oss/pcm_oss.c:1721 snd_pcm_oss_release+0x276/0x300 sound/core/oss/pcm_oss.c:2571 __fput+0x288/0x920 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:209 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] __key.12+0x0/0x40 ... acquired at: mark_usage kernel/locking/lockdep.c:4488 [inline] __lock_acquire+0x11d5/0x54a0 kernel/locking/lockdep.c:4969 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 snd_timer_interrupt.part.0+0x34/0xcf0 sound/core/timer.c:857 snd_timer_interrupt sound/core/timer.c:1155 [inline] snd_timer_s_function+0x14b/0x200 sound/core/timer.c:1155 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1417 expire_timers kernel/time/timer.c:1462 [inline] __run_timers.part.0+0x675/0xa50 kernel/time/timer.c:1731 __run_timers kernel/time/timer.c:1712 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1744 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x16e/0x1c0 kernel/softirq.c:636 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 get_current arch/x86/include/asm/current.h:15 [inline] finish_task_switch.isra.0+0x23c/0xa50 kernel/sched/core.c:4557 context_switch kernel/sched/core.c:4686 [inline] __schedule+0x942/0x26f0 kernel/sched/core.c:5940 schedule+0xd3/0x270 kernel/sched/core.c:6019 freezable_schedule include/linux/freezer.h:172 [inline] do_nanosleep+0x24e/0x690 kernel/time/hrtimer.c:1896 hrtimer_nanosleep+0x1f9/0x4a0 kernel/time/hrtimer.c:1949 __do_sys_nanosleep kernel/time/hrtimer.c:1983 [inline] __se_sys_nanosleep kernel/time/hrtimer.c:1970 [inline] __x64_sys_nanosleep+0x1dc/0x260 kernel/time/hrtimer.c:1970 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae stack backtrace: CPU: 0 PID: 8458 Comm: syz-fuzzer Not tainted 5.14.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105 print_irq_inversion_bug kernel/locking/lockdep.c:203 [inline] check_usage_forwards kernel/locking/lockdep.c:4031 [inline] mark_lock_irq kernel/locking/lockdep.c:4163 [inline] mark_lock.cold+0x86/0x8e kernel/locking/lockdep.c:4593 mark_usage kernel/locking/lockdep.c:4488 [inline] __lock_acquire+0x11d5/0x54a0 kernel/locking/lockdep.c:4969 lock_acquire kernel/locking/lockdep.c:5625 [inline] lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 snd_timer_interrupt.part.0+0x34/0xcf0 sound/core/timer.c:857 snd_timer_interrupt sound/core/timer.c:1155 [inline] snd_timer_s_function+0x14b/0x200 sound/core/timer.c:1155 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1417 expire_timers kernel/time/timer.c:1462 [inline] __run_timers.part.0+0x675/0xa50 kernel/time/timer.c:1731 __run_timers kernel/time/timer.c:1712 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1744 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x16e/0x1c0 kernel/softirq.c:636 irq_exit_rcu+0x5/0x20 kernel/softirq.c:648 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:finish_task_switch.isra.0+0x23c/0xa50 kernel/sched/core.c:4557 Code: 8b 3a 4c 89 e7 48 c7 02 00 00 00 00 ff d1 4d 85 ff 75 bf 4c 89 e7 e8 43 a5 dd 07 e8 0e e5 2b 00 fb 65 48 8b 1c 25 00 f0 01 00 <48> 8d bb 10 15 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc90001227b88 EFLAGS: 00000202 RAX: 00000000003245a7 RBX: ffff8880319fe300 RCX: 1ffffffff1ad7f01 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffc90001227bc8 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff817ae278 R11: 0000000000000001 R12: ffff8880b9c51b80 R13: ffff888083ff2000 R14: 0000000000000000 R15: ffff8880b9c51b98 context_switch kernel/sched/core.c:4686 [inline] __schedule+0x942/0x26f0 kernel/sched/core.c:5940 schedule+0xd3/0x270 kernel/sched/core.c:6019 freezable_schedule include/linux/freezer.h:172 [inline] do_nanosleep+0x24e/0x690 kernel/time/hrtimer.c:1896 hrtimer_nanosleep+0x1f9/0x4a0 kernel/time/hrtimer.c:1949 __do_sys_nanosleep kernel/time/hrtimer.c:1983 [inline] __se_sys_nanosleep kernel/time/hrtimer.c:1970 [inline] __x64_sys_nanosleep+0x1dc/0x260 kernel/time/hrtimer.c:1970 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x46dabd Code: 8b 44 24 20 b9 40 42 0f 00 f7 f1 48 89 04 24 b8 e8 03 00 00 f7 e2 48 89 44 24 08 48 89 e7 be 00 00 00 00 b8 23 00 00 00 0f 05 <48> 8b 6c 24 10 48 83 c4 18 c3 cc cc cc cc cc cc cc cc cc cc cc cc RSP: 002b:000000c00003df18 EFLAGS: 00000202 ORIG_RAX: 0000000000000023 RAX: ffffffffffffffda RBX: 0000000000000014 RCX: 000000000046dabd RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000c00003df18 RBP: 000000c00003df28 R08: 000000000007f3a9 R09: 00007ffd8b3c5080 R10: 00007ffd8b3c5090 R11: 0000000000000202 R12: 000000000043b6a0 R13: 0000000000000000 R14: 000000000094dc48 R15: 0000000000000000