======================================================== WARNING: possible irq lock inversion dependency detected 5.9.0-syzkaller #0 Not tainted -------------------------------------------------------- syz-executor.3/8346 just changed the state of lock: ffff88809a3d8108 (&group->lock){..-.}-{2:2}, at: _snd_pcm_stream_lock_irqsave+0x9f/0xd0 sound/core/pcm_native.c:170 but this lock took another, SOFTIRQ-READ-unsafe lock in the past: (&card->ctl_files_rwlock){.+.+}-{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(&card->ctl_files_rwlock); local_irq_disable(); lock(&group->lock); lock(&card->ctl_files_rwlock); lock(&group->lock); *** DEADLOCK *** 1 lock held by syz-executor.3/8346: #0: ffffc90000007d80 ((&dpcm->timer)){+.-.}-{0:0}, at: lockdep_copy_map include/linux/lockdep.h:35 [inline] #0: ffffc90000007d80 ((&dpcm->timer)){+.-.}-{0:0}, at: call_timer_fn+0xd5/0x6b0 kernel/time/timer.c:1405 the shortest dependencies between 2nd lock and 1st lock: -> (&card->ctl_files_rwlock){.+.+}-{2:2} { HARDIRQ-ON-R at: lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x219/0x9d0 kernel/locking/lockdep.c:5407 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:223 snd_ctl_notify.part.0+0x36/0x550 sound/core/control.c:153 snd_ctl_notify+0x8f/0xb0 sound/core/control.c:181 __snd_ctl_add_replace+0x638/0x800 sound/core/control.c:382 snd_ctl_add_replace+0x76/0x130 sound/core/control.c:399 snd_card_dummy_new_mixer sound/drivers/dummy.c:885 [inline] snd_dummy_probe+0xc22/0x1180 sound/drivers/dummy.c:1080 platform_drv_probe+0x87/0x140 drivers/base/platform.c:747 really_probe+0x282/0x9f0 drivers/base/dd.c:553 driver_probe_device+0xfe/0x1d0 drivers/base/dd.c:738 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:844 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431 __device_attach+0x228/0x470 drivers/base/dd.c:912 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491 device_add+0xb17/0x1c40 drivers/base/core.c:2926 platform_device_add+0x34f/0x6d0 drivers/base/platform.c:597 platform_device_register_full+0x38c/0x4e0 drivers/base/platform.c:720 platform_device_register_resndata include/linux/platform_device.h:131 [inline] platform_device_register_simple include/linux/platform_device.h:160 [inline] alsa_card_dummy_init+0x1e0/0x309 sound/drivers/dummy.c:1168 do_one_initcall+0x103/0x6f0 init/main.c:1205 do_initcall_level init/main.c:1278 [inline] do_initcalls init/main.c:1294 [inline] do_basic_setup init/main.c:1314 [inline] kernel_init_freeable+0x652/0x6d6 init/main.c:1514 kernel_init+0xd/0x1b8 init/main.c:1403 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 SOFTIRQ-ON-R at: lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x219/0x9d0 kernel/locking/lockdep.c:5407 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:223 snd_ctl_notify.part.0+0x36/0x550 sound/core/control.c:153 snd_ctl_notify+0x8f/0xb0 sound/core/control.c:181 __snd_ctl_add_replace+0x638/0x800 sound/core/control.c:382 snd_ctl_add_replace+0x76/0x130 sound/core/control.c:399 snd_card_dummy_new_mixer sound/drivers/dummy.c:885 [inline] snd_dummy_probe+0xc22/0x1180 sound/drivers/dummy.c:1080 platform_drv_probe+0x87/0x140 drivers/base/platform.c:747 really_probe+0x282/0x9f0 drivers/base/dd.c:553 driver_probe_device+0xfe/0x1d0 drivers/base/dd.c:738 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:844 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431 __device_attach+0x228/0x470 drivers/base/dd.c:912 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491 device_add+0xb17/0x1c40 drivers/base/core.c:2926 platform_device_add+0x34f/0x6d0 drivers/base/platform.c:597 platform_device_register_full+0x38c/0x4e0 drivers/base/platform.c:720 platform_device_register_resndata include/linux/platform_device.h:131 [inline] platform_device_register_simple include/linux/platform_device.h:160 [inline] alsa_card_dummy_init+0x1e0/0x309 sound/drivers/dummy.c:1168 do_one_initcall+0x103/0x6f0 init/main.c:1205 do_initcall_level init/main.c:1278 [inline] do_initcalls init/main.c:1294 [inline] do_basic_setup init/main.c:1314 [inline] kernel_init_freeable+0x652/0x6d6 init/main.c:1514 kernel_init+0xd/0x1b8 init/main.c:1403 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 INITIAL READ USE at: lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x219/0x9d0 kernel/locking/lockdep.c:5407 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x5b/0x70 kernel/locking/spinlock.c:223 snd_ctl_notify.part.0+0x36/0x550 sound/core/control.c:153 snd_ctl_notify+0x8f/0xb0 sound/core/control.c:181 __snd_ctl_add_replace+0x638/0x800 sound/core/control.c:382 snd_ctl_add_replace+0x76/0x130 sound/core/control.c:399 snd_card_dummy_new_mixer sound/drivers/dummy.c:885 [inline] snd_dummy_probe+0xc22/0x1180 sound/drivers/dummy.c:1080 platform_drv_probe+0x87/0x140 drivers/base/platform.c:747 really_probe+0x282/0x9f0 drivers/base/dd.c:553 driver_probe_device+0xfe/0x1d0 drivers/base/dd.c:738 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:844 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431 __device_attach+0x228/0x470 drivers/base/dd.c:912 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491 device_add+0xb17/0x1c40 drivers/base/core.c:2926 platform_device_add+0x34f/0x6d0 drivers/base/platform.c:597 platform_device_register_full+0x38c/0x4e0 drivers/base/platform.c:720 platform_device_register_resndata include/linux/platform_device.h:131 [inline] platform_device_register_simple include/linux/platform_device.h:160 [inline] alsa_card_dummy_init+0x1e0/0x309 sound/drivers/dummy.c:1168 do_one_initcall+0x103/0x6f0 init/main.c:1205 do_initcall_level init/main.c:1278 [inline] do_initcalls init/main.c:1294 [inline] do_basic_setup init/main.c:1314 [inline] kernel_init_freeable+0x652/0x6d6 init/main.c:1514 kernel_init+0xd/0x1b8 init/main.c:1403 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 } ... key at: [] __key.11+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 snd_ctl_notify.part.0+0x36/0x550 sound/core/control.c:153 snd_ctl_notify+0x8f/0xb0 sound/core/control.c:181 loopback_check_format sound/drivers/aloop.c:358 [inline] loopback_trigger+0x112f/0x1ab0 sound/drivers/aloop.c:387 snd_pcm_do_start sound/core/pcm_native.c:1350 [inline] snd_pcm_do_start+0xb1/0xf0 sound/core/pcm_native.c:1345 snd_pcm_action_single sound/core/pcm_native.c:1207 [inline] snd_pcm_action+0xc8/0x170 sound/core/pcm_native.c:1290 __snd_pcm_lib_xfer+0x1202/0x1a90 sound/core/pcm_lib.c:2247 snd_pcm_oss_write3+0x107/0x320 sound/core/oss/pcm_oss.c:1221 io_playback_transfer+0x27e/0x330 sound/core/oss/io.c:47 snd_pcm_plug_write_transfer+0x2cd/0x3f0 sound/core/oss/pcm_plugin.c:624 snd_pcm_oss_write2+0x245/0x3f0 sound/core/oss/pcm_oss.c:1353 snd_pcm_oss_write1 sound/core/oss/pcm_oss.c:1419 [inline] snd_pcm_oss_write+0x705/0x940 sound/core/oss/pcm_oss.c:2765 vfs_write+0x2b0/0x730 fs/read_write.c:584 ksys_write+0x12d/0x250 fs/read_write.c:639 do_syscall_32_irqs_on arch/x86/entry/common.c:78 [inline] __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:137 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:160 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c -> (&group->lock){..-.}-{2:2} { IN-SOFTIRQ-W at: lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x219/0x9d0 kernel/locking/lockdep.c:5407 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x94/0xd0 kernel/locking/spinlock.c:159 _snd_pcm_stream_lock_irqsave+0x9f/0xd0 sound/core/pcm_native.c:170 snd_pcm_period_elapsed+0x24/0x250 sound/core/pcm_lib.c:1799 loopback_jiffies_timer_function+0x1a8/0x220 sound/drivers/aloop.c:669 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1415 expire_timers kernel/time/timer.c:1460 [inline] __run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1757 __run_timers kernel/time/timer.c:1738 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1770 __do_softirq+0x203/0xac5 kernel/softirq.c:298 asm_call_irq_on_stack+0xf/0x20 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline] do_softirq_own_stack+0xaa/0xd0 arch/x86/kernel/irq_64.c:77 invoke_softirq kernel/softirq.c:393 [inline] __irq_exit_rcu kernel/softirq.c:423 [inline] irq_exit_rcu+0x235/0x280 kernel/softirq.c:435 sysvec_apic_timer_interrupt+0x4d/0x100 arch/x86/kernel/apic/apic.c:1091 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:581 arch_local_irq_restore arch/x86/include/asm/paravirt.h:653 [inline] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] _raw_spin_unlock_irqrestore+0x4d/0x90 kernel/locking/spinlock.c:191 __debug_object_init+0x409/0xd10 lib/debugobjects.c:600 hrtimer_init_sleeper_on_stack kernel/time/hrtimer.c:450 [inline] hrtimer_nanosleep+0x173/0x430 kernel/time/hrtimer.c:1934 __do_sys_nanosleep_time32 kernel/time/hrtimer.c:1991 [inline] __se_sys_nanosleep_time32 kernel/time/hrtimer.c:1978 [inline] __ia32_sys_nanosleep_time32+0x1e6/0x270 kernel/time/hrtimer.c:1978 do_syscall_32_irqs_on arch/x86/entry/common.c:78 [inline] __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:137 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:160 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c INITIAL USE at: lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x219/0x9d0 kernel/locking/lockdep.c:5407 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x94/0xd0 kernel/locking/spinlock.c:167 spin_lock_irq include/linux/spinlock.h:379 [inline] snd_pcm_group_lock_irq sound/core/pcm_native.c:97 [inline] snd_pcm_stream_lock_irq sound/core/pcm_native.c:136 [inline] snd_pcm_hw_params+0x12a/0x1920 sound/core/pcm_native.c:672 snd_pcm_kernel_ioctl+0xd1/0x240 sound/core/pcm_native.c:3325 snd_pcm_oss_change_params_locked+0x130a/0x3420 sound/core/oss/pcm_oss.c:941 snd_pcm_oss_make_ready_locked+0xb3/0x230 sound/core/oss/pcm_oss.c:1166 snd_pcm_oss_write1 sound/core/oss/pcm_oss.c:1384 [inline] snd_pcm_oss_write+0x45d/0x940 sound/core/oss/pcm_oss.c:2765 vfs_write+0x2b0/0x730 fs/read_write.c:584 ksys_write+0x12d/0x250 fs/read_write.c:639 do_syscall_32_irqs_on arch/x86/entry/common.c:78 [inline] __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:137 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:160 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c } ... key at: [] __key.7+0x0/0x40 ... acquired at: mark_usage kernel/locking/lockdep.c:4305 [inline] __lock_acquire+0x1190/0x5590 kernel/locking/lockdep.c:4791 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x219/0x9d0 kernel/locking/lockdep.c:5407 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x94/0xd0 kernel/locking/spinlock.c:159 _snd_pcm_stream_lock_irqsave+0x9f/0xd0 sound/core/pcm_native.c:170 snd_pcm_period_elapsed+0x24/0x250 sound/core/pcm_lib.c:1799 loopback_jiffies_timer_function+0x1a8/0x220 sound/drivers/aloop.c:669 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1415 expire_timers kernel/time/timer.c:1460 [inline] __run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1757 __run_timers kernel/time/timer.c:1738 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1770 __do_softirq+0x203/0xac5 kernel/softirq.c:298 asm_call_irq_on_stack+0xf/0x20 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline] do_softirq_own_stack+0xaa/0xd0 arch/x86/kernel/irq_64.c:77 invoke_softirq kernel/softirq.c:393 [inline] __irq_exit_rcu kernel/softirq.c:423 [inline] irq_exit_rcu+0x235/0x280 kernel/softirq.c:435 sysvec_apic_timer_interrupt+0x4d/0x100 arch/x86/kernel/apic/apic.c:1091 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:581 arch_local_irq_restore arch/x86/include/asm/paravirt.h:653 [inline] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] _raw_spin_unlock_irqrestore+0x4d/0x90 kernel/locking/spinlock.c:191 __debug_object_init+0x409/0xd10 lib/debugobjects.c:600 hrtimer_init_sleeper_on_stack kernel/time/hrtimer.c:450 [inline] hrtimer_nanosleep+0x173/0x430 kernel/time/hrtimer.c:1934 __do_sys_nanosleep_time32 kernel/time/hrtimer.c:1991 [inline] __se_sys_nanosleep_time32 kernel/time/hrtimer.c:1978 [inline] __ia32_sys_nanosleep_time32+0x1e6/0x270 kernel/time/hrtimer.c:1978 do_syscall_32_irqs_on arch/x86/entry/common.c:78 [inline] __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:137 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:160 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c stack backtrace: CPU: 0 PID: 8346 Comm: syz-executor.3 Not tainted 5.9.0-syzkaller #0 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+0x198/0x1fb lib/dump_stack.c:118 print_irq_inversion_bug kernel/locking/lockdep.c:4410 [inline] check_usage_forwards kernel/locking/lockdep.c:3848 [inline] mark_lock_irq kernel/locking/lockdep.c:3980 [inline] mark_lock.cold+0x20/0x74 kernel/locking/lockdep.c:4408 mark_usage kernel/locking/lockdep.c:4305 [inline] __lock_acquire+0x1190/0x5590 kernel/locking/lockdep.c:4791 lock_acquire kernel/locking/lockdep.c:5442 [inline] lock_acquire+0x219/0x9d0 kernel/locking/lockdep.c:5407 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x94/0xd0 kernel/locking/spinlock.c:159 _snd_pcm_stream_lock_irqsave+0x9f/0xd0 sound/core/pcm_native.c:170 snd_pcm_period_elapsed+0x24/0x250 sound/core/pcm_lib.c:1799 loopback_jiffies_timer_function+0x1a8/0x220 sound/drivers/aloop.c:669 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1415 expire_timers kernel/time/timer.c:1460 [inline] __run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1757 __run_timers kernel/time/timer.c:1738 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1770 __do_softirq+0x203/0xac5 kernel/softirq.c:298 asm_call_irq_on_stack+0xf/0x20 __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline] do_softirq_own_stack+0xaa/0xd0 arch/x86/kernel/irq_64.c:77 invoke_softirq kernel/softirq.c:393 [inline] __irq_exit_rcu kernel/softirq.c:423 [inline] irq_exit_rcu+0x235/0x280 kernel/softirq.c:435 sysvec_apic_timer_interrupt+0x4d/0x100 arch/x86/kernel/apic/apic.c:1091 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:581 RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:653 [inline] RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline] RIP: 0010:_raw_spin_unlock_irqrestore+0x4d/0x90 kernel/locking/spinlock.c:191 Code: 48 c7 c0 a8 ee 1c 8a 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 3c 48 83 3d b2 df ed 01 00 74 29 48 89 df 57 9d <0f> 1f 44 00 00 bf 01 00 00 00 e8 24 e4 20 f9 65 8b 05 6d ef d2 77 RSP: 0018:ffffc90016037c68 EFLAGS: 00000282 RAX: 1ffffffff1439dd5 RBX: 0000000000000282 RCX: 1ffffffff1720709 RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000282 RBP: ffffffff8dab33f0 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000000 R12: ffffc90016037dc8 R13: 1ffff92002c06f9f R14: ffffffff8dab33f0 R15: ffffffff8dab33e8 __debug_object_init+0x409/0xd10 lib/debugobjects.c:600 hrtimer_init_sleeper_on_stack kernel/time/hrtimer.c:450 [inline] hrtimer_nanosleep+0x173/0x430 kernel/time/hrtimer.c:1934 __do_sys_nanosleep_time32 kernel/time/hrtimer.c:1991 [inline] __se_sys_nanosleep_time32 kernel/time/hrtimer.c:1978 [inline] __ia32_sys_nanosleep_time32+0x1e6/0x270 kernel/time/hrtimer.c:1978 do_syscall_32_irqs_on arch/x86/entry/common.c:78 [inline] __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:137 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:160 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf7fbb549 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90 RSP: 002b:00000000090bfbc8 EFLAGS: 00000216 ORIG_RAX: 00000000000000a2 RAX: ffffffffffffffda RBX: 00000000090bfbf8 RCX: 0000000000000000 RDX: 0000000008bab680 RSI: 0000000008baaf80 RDI: 00000000000229f5 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000