======================================================== WARNING: possible irq lock inversion dependency detected 5.14.0-rc6-syzkaller #0 Not tainted -------------------------------------------------------- systemd-udevd/21071 just changed the state of lock: ffff888146ff7948 (&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: (&f->f_owner.lock){.+.+}-{2:2} and interrupts could create inverse lock ordering between them. other info that might help us debug this: Chain exists of: &timer->lock --> &new->fa_lock --> &f->f_owner.lock Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&f->f_owner.lock); local_irq_disable(); lock(&timer->lock); lock(&new->fa_lock); lock(&timer->lock); *** DEADLOCK *** 1 lock held by systemd-udevd/21071: #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:1411 the shortest dependencies between 2nd lock and 1st lock: -> (&f->f_owner.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 f_getown+0x23/0x2a0 fs/fcntl.c:153 do_fcntl+0xbd8/0x1210 fs/fcntl.c:388 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl fs/fcntl.c:456 [inline] __x64_sys_fcntl+0x165/0x1e0 fs/fcntl.c:456 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 f_getown+0x23/0x2a0 fs/fcntl.c:153 do_fcntl+0xbd8/0x1210 fs/fcntl.c:388 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl fs/fcntl.c:456 [inline] __x64_sys_fcntl+0x165/0x1e0 fs/fcntl.c:456 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 f_modown+0x2a/0x390 fs/fcntl.c:91 __f_setown fs/fcntl.c:110 [inline] f_setown+0xd7/0x230 fs/fcntl.c:138 do_fcntl+0x749/0x1210 fs/fcntl.c:392 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl fs/fcntl.c:456 [inline] __x64_sys_fcntl+0x165/0x1e0 fs/fcntl.c:456 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 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 f_getown+0x23/0x2a0 fs/fcntl.c:153 do_fcntl+0xbd8/0x1210 fs/fcntl.c:388 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl fs/fcntl.c:456 [inline] __x64_sys_fcntl+0x165/0x1e0 fs/fcntl.c:456 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.5+0x0/0x40 ... acquired at: __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:159 [inline] _raw_read_lock_irqsave+0x45/0x90 kernel/locking/spinlock.c:231 send_sigio+0x24/0x380 fs/fcntl.c:795 kill_fasync_rcu fs/fcntl.c:1019 [inline] kill_fasync fs/fcntl.c:1033 [inline] kill_fasync+0x1ec/0x460 fs/fcntl.c:1026 sock_wake_async+0xd2/0x160 net/socket.c:1354 sk_wake_async include/net/sock.h:2327 [inline] sk_wake_async include/net/sock.h:2323 [inline] sock_def_error_report+0x34b/0x4e0 net/core/sock.c:3004 sk_error_report+0x35/0x310 net/core/sock.c:338 __mptcp_error_report+0x25d/0x2f0 net/mptcp/subflow.c:1240 mptcp_release_cb+0x1cc/0x210 net/mptcp/protocol.c:2909 release_sock+0xb4/0x1b0 net/core/sock.c:3185 mptcp_stream_connect+0x243/0x9d0 net/mptcp/protocol.c:3174 __sys_connect_file+0x155/0x1a0 net/socket.c:1879 __sys_connect+0x161/0x190 net/socket.c:1896 __do_sys_connect net/socket.c:1906 [inline] __se_sys_connect net/socket.c:1903 [inline] __x64_sys_connect+0x6f/0xb0 net/socket.c:1903 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 -> (&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+0x36/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 sock_wake_async+0xd2/0x160 net/socket.c:1354 sk_wake_async include/net/sock.h:2327 [inline] sk_wake_async include/net/sock.h:2323 [inline] sock_def_error_report+0x34b/0x4e0 net/core/sock.c:3004 sk_error_report+0x35/0x310 net/core/sock.c:338 __mptcp_error_report+0x25d/0x2f0 net/mptcp/subflow.c:1240 mptcp_release_cb+0x1cc/0x210 net/mptcp/protocol.c:2909 release_sock+0xb4/0x1b0 net/core/sock.c:3185 mptcp_stream_connect+0x243/0x9d0 net/mptcp/protocol.c:3174 __sys_connect_file+0x155/0x1a0 net/socket.c:1879 __sys_connect+0x161/0x190 net/socket.c:1896 __do_sys_connect net/socket.c:1906 [inline] __se_sys_connect net/socket.c:1903 [inline] __x64_sys_connect+0x6f/0xb0 net/socket.c:1903 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 sock_fasync+0x94/0x140 net/socket.c:1325 __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+0x36/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 sock_wake_async+0xd2/0x160 net/socket.c:1354 sk_wake_async include/net/sock.h:2327 [inline] sk_wake_async include/net/sock.h:2323 [inline] sock_def_error_report+0x34b/0x4e0 net/core/sock.c:3004 sk_error_report+0x35/0x310 net/core/sock.c:338 __mptcp_error_report+0x25d/0x2f0 net/mptcp/subflow.c:1240 mptcp_release_cb+0x1cc/0x210 net/mptcp/protocol.c:2909 release_sock+0xb4/0x1b0 net/core/sock.c:3185 mptcp_stream_connect+0x243/0x9d0 net/mptcp/protocol.c:3174 __sys_connect_file+0x155/0x1a0 net/socket.c:1879 __sys_connect+0x161/0x190 net/socket.c:1896 __do_sys_connect net/socket.c:1906 [inline] __se_sys_connect net/socket.c:1903 [inline] __x64_sys_connect+0x6f/0xb0 net/socket.c:1903 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:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x675/0xa20 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 __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 __do_sys_inotify_add_watch fs/notify/inotify/inotify_user.c:725 [inline] __se_sys_inotify_add_watch fs/notify/inotify/inotify_user.c:709 [inline] __x64_sys_inotify_add_watch+0x9b/0x350 fs/notify/inotify/inotify_user.c:709 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:590 [inline] snd_pcm_post_start+0x24a/0x310 sound/core/pcm_native.c:1387 snd_pcm_action_single sound/core/pcm_native.c:1224 [inline] snd_pcm_action+0x143/0x170 sound/core/pcm_native.c:1305 snd_pcm_action_lock_irq+0x9f/0x190 sound/core/pcm_native.c:1320 snd_pcm_start_lock_irq sound/core/pcm_native.c:1413 [inline] snd_pcm_kernel_ioctl+0x9b/0x240 sound/core/pcm_native.c:3358 snd_pcm_oss_set_trigger.isra.0+0x2d5/0x6e0 sound/core/oss/pcm_oss.c:2123 snd_pcm_oss_poll+0x661/0xb10 sound/core/oss/pcm_oss.c:2859 vfs_poll include/linux/poll.h:90 [inline] do_pollfd fs/select.c:869 [inline] do_poll fs/select.c:917 [inline] do_sys_poll+0x60a/0xeb0 fs/select.c:1011 __do_sys_poll fs/select.c:1076 [inline] __se_sys_poll fs/select.c:1064 [inline] __x64_sys_poll+0x18c/0x480 fs/select.c:1064 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.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:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x675/0xa20 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 __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 __do_sys_inotify_add_watch fs/notify/inotify/inotify_user.c:725 [inline] __se_sys_inotify_add_watch fs/notify/inotify/inotify_user.c:709 [inline] __x64_sys_inotify_add_watch+0x9b/0x350 fs/notify/inotify/inotify_user.c:709 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: 21071 Comm: systemd-udevd Not tainted 5.14.0-rc6-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:1421 expire_timers kernel/time/timer.c:1466 [inline] __run_timers.part.0+0x675/0xa20 kernel/time/timer.c:1734 __run_timers kernel/time/timer.c:1715 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1747 __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:__do_sys_inotify_add_watch fs/notify/inotify/inotify_user.c:732 [inline] RIP: 0010:__se_sys_inotify_add_watch fs/notify/inotify/inotify_user.c:709 [inline] RIP: 0010:__x64_sys_inotify_add_watch+0x9b/0x350 fs/notify/inotify/inotify_user.c:709 Code: 3c 28 00 0f 85 87 02 00 00 48 8b 6b 60 31 ff 41 89 ed 41 81 e5 00 10 ff 08 44 89 ee e8 5e cc 9a ff 45 85 ed 0f 85 42 02 00 00 10 c5 9a ff 41 89 ed 31 ff 41 81 e5 ff ef 00 f7 44 89 ee e8 3c RSP: 0018:ffffc90017a0fea0 EFLAGS: 00000246 RAX: 0000000000000000 RBX: ffffc90017a0ff58 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff88802efb9c40 RDI: 0000000000000003 RBP: 0000000000000008 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff81dae3e2 R11: 0000000000000000 R12: 1ffff92002f41fd5 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 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:0x7f619f763397 Code: f0 ff ff 73 01 c3 48 8b 0d fe fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 fe 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d d1 fa 2a 00 f7 d8 64 89 01 48 RSP: 002b:00007ffc0eed54c8 EFLAGS: 00000202 ORIG_RAX: 00000000000000fe RAX: ffffffffffffffda RBX: 0000564b02dec7e0 RCX: 00007f619f763397 RDX: 0000000000000008 RSI: 0000564b02df7940 RDI: 0000000000000009 RBP: 00007ffc0eed5690 R08: 0000564b02515670 R09: 0000000000000008 R10: 0000564b02dea8f8 R11: 0000000000000202 R12: 00007ffc0eed55e0 R13: 0000564b02dec7e0 R14: 0000000000000003 R15: 000000000000000e vkms_vblank_simulate: vblank timer overrun ---------------- Code disassembly (best guess): 0: 3c 28 cmp $0x28,%al 2: 00 0f add %cl,(%rdi) 4: 85 87 02 00 00 48 test %eax,0x48000002(%rdi) a: 8b 6b 60 mov 0x60(%rbx),%ebp d: 31 ff xor %edi,%edi f: 41 89 ed mov %ebp,%r13d 12: 41 81 e5 00 10 ff 08 and $0x8ff1000,%r13d 19: 44 89 ee mov %r13d,%esi 1c: e8 5e cc 9a ff callq 0xff9acc7f 21: 45 85 ed test %r13d,%r13d 24: 0f 85 42 02 00 00 jne 0x26c 2a: e8 10 c5 9a ff callq 0xff9ac53f <-- trapping instruction 2f: 41 89 ed mov %ebp,%r13d 32: 31 ff xor %edi,%edi 34: 41 81 e5 ff ef 00 f7 and $0xf700efff,%r13d 3b: 44 89 ee mov %r13d,%esi 3e: e8 .byte 0xe8 3f: 3c .byte 0x3c