===================================================== WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected 5.14.0-rc7-syzkaller #0 Not tainted ----------------------------------------------------- syz-executor813/8426 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire: ffff8880236463b8 (&f->f_owner.lock){.+.+}-{2:2}, at: send_sigio+0x2f/0x300 fs/fcntl.c:795 and this task is already holding: ffff88801824f018 (&new->fa_lock){....}-{2:2}, at: kill_fasync_rcu fs/fcntl.c:1012 [inline] ffff88801824f018 (&new->fa_lock){....}-{2:2}, at: kill_fasync+0x13b/0x430 fs/fcntl.c:1033 which would create a new lock dependency: (&new->fa_lock){....}-{2:2} -> (&f->f_owner.lock){.+.+}-{2:2} but this new dependency connects a HARDIRQ-irq-safe lock: (&dev->event_lock){-...}-{2:2} ... which became HARDIRQ-irq-safe at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb3/0x100 kernel/locking/spinlock.c:159 input_event+0x89/0xc0 drivers/input/input.c:445 input_report_key include/linux/input.h:425 [inline] psmouse_report_standard_buttons drivers/input/mouse/psmouse-base.c:123 [inline] psmouse_report_standard_packet+0x4f/0x200 drivers/input/mouse/psmouse-base.c:141 psmouse_process_byte+0x44f/0x640 drivers/input/mouse/psmouse-base.c:232 psmouse_handle_byte+0x44/0x4a0 drivers/input/mouse/psmouse-base.c:274 psmouse_interrupt+0x6d0/0x10c0 drivers/input/mouse/psmouse-base.c:426 serio_interrupt+0x88/0x130 drivers/input/serio/serio.c:1002 i8042_interrupt+0x34c/0x740 drivers/input/serio/i8042.c:602 __handle_irq_event_percpu+0x20a/0x6d0 kernel/irq/handle.c:156 handle_irq_event_percpu kernel/irq/handle.c:196 [inline] handle_irq_event+0x10a/0x300 kernel/irq/handle.c:213 handle_edge_irq+0x245/0xbe0 kernel/irq/chip.c:822 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0xce/0x1e0 arch/x86/kernel/irq.c:250 common_interrupt+0x9c/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 console_unlock+0xb2b/0xec0 kernel/printk/printk.c:2653 vprintk_emit+0x21a/0x2f0 kernel/printk/printk.c:2174 vprintk+0x30d/0x370 kernel/printk/printk_safe.c:392 printk+0xc0/0x108 kernel/printk/printk.c:2216 usb_register_driver+0x2d3/0x3d0 drivers/usb/core/driver.c:1069 do_one_initcall+0x197/0x3f0 init/main.c:1287 do_initcall_level+0x14a/0x1f5 init/main.c:1360 do_initcalls+0x4b/0x8c init/main.c:1376 kernel_init_freeable+0x3f1/0x57e init/main.c:1598 kernel_init+0x19/0x2a0 init/main.c:1490 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 to a HARDIRQ-irq-unsafe lock: (&f->f_owner.lock){.+.+}-{2:2} ... which became HARDIRQ-irq-unsafe at: ... lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 f_getowner_uids fs/fcntl.c:252 [inline] do_fcntl+0x24c/0x1510 fs/fcntl.c:401 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl+0xd8/0x1b0 fs/fcntl.c:456 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Chain exists of: &dev->event_lock --> &new->fa_lock --> &f->f_owner.lock Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&f->f_owner.lock); local_irq_disable(); lock(&dev->event_lock); lock(&new->fa_lock); lock(&dev->event_lock); *** DEADLOCK *** 8 locks held by syz-executor813/8426: #0: ffff888022984110 (&evdev->mutex){+.+.}-{3:3}, at: evdev_write+0x234/0x780 drivers/input/evdev.c:513 #1: ffff88801d278230 (&dev->event_lock){-...}-{2:2}, at: input_inject_event+0xb4/0x270 drivers/input/input.c:471 #2: ffffffff8c717ec0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:266 #3: ffffffff8c717ec0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:266 #4: ffffffff8c717ec0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:266 #5: ffff88802889d028 (&client->buffer_lock){....}-{2:2}, at: spin_lock include/linux/spinlock.h:354 [inline] #5: ffff88802889d028 (&client->buffer_lock){....}-{2:2}, at: evdev_pass_values+0xd9/0xaa0 drivers/input/evdev.c:261 #6: ffffffff8c717ec0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:266 #7: ffff88801824f018 (&new->fa_lock){....}-{2:2}, at: kill_fasync_rcu fs/fcntl.c:1012 [inline] #7: ffff88801824f018 (&new->fa_lock){....}-{2:2}, at: kill_fasync+0x13b/0x430 fs/fcntl.c:1033 the dependencies between HARDIRQ-irq-safe lock and the holding lock: -> (&dev->event_lock){-...}-{2:2} { IN-HARDIRQ-W at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb3/0x100 kernel/locking/spinlock.c:159 input_event+0x89/0xc0 drivers/input/input.c:445 input_report_key include/linux/input.h:425 [inline] psmouse_report_standard_buttons drivers/input/mouse/psmouse-base.c:123 [inline] psmouse_report_standard_packet+0x4f/0x200 drivers/input/mouse/psmouse-base.c:141 psmouse_process_byte+0x44f/0x640 drivers/input/mouse/psmouse-base.c:232 psmouse_handle_byte+0x44/0x4a0 drivers/input/mouse/psmouse-base.c:274 psmouse_interrupt+0x6d0/0x10c0 drivers/input/mouse/psmouse-base.c:426 serio_interrupt+0x88/0x130 drivers/input/serio/serio.c:1002 i8042_interrupt+0x34c/0x740 drivers/input/serio/i8042.c:602 __handle_irq_event_percpu+0x20a/0x6d0 kernel/irq/handle.c:156 handle_irq_event_percpu kernel/irq/handle.c:196 [inline] handle_irq_event+0x10a/0x300 kernel/irq/handle.c:213 handle_edge_irq+0x245/0xbe0 kernel/irq/chip.c:822 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0xce/0x1e0 arch/x86/kernel/irq.c:250 common_interrupt+0x9c/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 console_unlock+0xb2b/0xec0 kernel/printk/printk.c:2653 vprintk_emit+0x21a/0x2f0 kernel/printk/printk.c:2174 vprintk+0x30d/0x370 kernel/printk/printk_safe.c:392 printk+0xc0/0x108 kernel/printk/printk.c:2216 usb_register_driver+0x2d3/0x3d0 drivers/usb/core/driver.c:1069 do_one_initcall+0x197/0x3f0 init/main.c:1287 do_initcall_level+0x14a/0x1f5 init/main.c:1360 do_initcalls+0x4b/0x8c init/main.c:1376 kernel_init_freeable+0x3f1/0x57e init/main.c:1598 kernel_init+0x19/0x2a0 init/main.c:1490 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 INITIAL USE at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xb3/0x100 kernel/locking/spinlock.c:159 input_inject_event+0xb4/0x270 drivers/input/input.c:471 led_trigger_event+0x6f/0xd0 drivers/leds/led-triggers.c:388 kbd_led_trigger_activate+0xb8/0x100 drivers/tty/vt/keyboard.c:1029 led_trigger_set+0x514/0x940 drivers/leds/led-triggers.c:195 led_trigger_set_default+0x1ca/0x200 drivers/leds/led-triggers.c:259 led_classdev_register_ext+0x690/0x870 drivers/leds/led-class.c:412 led_classdev_register include/linux/leds.h:190 [inline] input_leds_connect+0x53e/0x790 drivers/input/input-leds.c:139 input_attach_handler drivers/input/input.c:1035 [inline] input_register_device+0xe25/0x1350 drivers/input/input.c:2335 atkbd_connect+0x74f/0xa60 drivers/input/keyboard/atkbd.c:1293 serio_connect_driver drivers/input/serio/serio.c:47 [inline] serio_driver_probe+0x76/0x90 drivers/input/serio/serio.c:778 call_driver_probe+0x96/0x250 drivers/base/dd.c:517 really_probe+0x223/0x9b0 drivers/base/dd.c:595 __driver_probe_device+0x1f8/0x3e0 drivers/base/dd.c:747 driver_probe_device+0x50/0x240 drivers/base/dd.c:777 __driver_attach+0x2ba/0x520 drivers/base/dd.c:1136 bus_for_each_dev+0x168/0x1d0 drivers/base/bus.c:301 serio_attach_driver drivers/input/serio/serio.c:808 [inline] serio_handle_event+0x8d1/0x1070 drivers/input/serio/serio.c:227 process_one_work+0x833/0x10c0 kernel/workqueue.c:2276 worker_thread+0xac1/0x1320 kernel/workqueue.c:2422 kthread+0x453/0x480 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 } ... key at: [] input_allocate_device.__key.6+0x0/0x40 -> (&client->buffer_lock){....}-{2:2} { INITIAL USE at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:354 [inline] evdev_pass_values+0xd9/0xaa0 drivers/input/evdev.c:261 evdev_events+0x195/0x280 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x87c/0x11e0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x189/0x270 drivers/input/input.c:476 evdev_write+0x5f0/0x780 drivers/input/evdev.c:530 vfs_write+0x289/0xc90 fs/read_write.c:603 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] evdev_open.__key.23+0x0/0x40 ... acquired at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:354 [inline] evdev_pass_values+0xd9/0xaa0 drivers/input/evdev.c:261 evdev_events+0x195/0x280 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x87c/0x11e0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x189/0x270 drivers/input/input.c:476 evdev_write+0x5f0/0x780 drivers/input/evdev.c:530 vfs_write+0x289/0xc90 fs/read_write.c:603 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae -> (&new->fa_lock){....}-{2:2} { INITIAL READ USE at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 kill_fasync_rcu fs/fcntl.c:1012 [inline] kill_fasync+0x13b/0x430 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x195/0x280 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x87c/0x11e0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x189/0x270 drivers/input/input.c:476 evdev_write+0x5f0/0x780 drivers/input/evdev.c:530 vfs_write+0x289/0xc90 fs/read_write.c:603 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] fasync_insert_entry.__key+0x0/0x40 ... acquired at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 kill_fasync_rcu fs/fcntl.c:1012 [inline] kill_fasync+0x13b/0x430 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x195/0x280 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x87c/0x11e0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x189/0x270 drivers/input/input.c:476 evdev_write+0x5f0/0x780 drivers/input/evdev.c:530 vfs_write+0x289/0xc90 fs/read_write.c:603 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae the dependencies between the lock to be acquired and HARDIRQ-irq-unsafe lock: -> (&f->f_owner.lock){.+.+}-{2:2} { HARDIRQ-ON-R at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 f_getowner_uids fs/fcntl.c:252 [inline] do_fcntl+0x24c/0x1510 fs/fcntl.c:401 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl+0xd8/0x1b0 fs/fcntl.c:456 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae SOFTIRQ-ON-R at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 f_getowner_uids fs/fcntl.c:252 [inline] do_fcntl+0x24c/0x1510 fs/fcntl.c:401 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl+0xd8/0x1b0 fs/fcntl.c:456 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL READ USE at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 f_getowner_uids fs/fcntl.c:252 [inline] do_fcntl+0x24c/0x1510 fs/fcntl.c:401 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl+0xd8/0x1b0 fs/fcntl.c:456 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] __alloc_file.__key+0x0/0x10 ... acquired at: lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:159 [inline] _raw_read_lock_irqsave+0xbb/0x100 kernel/locking/spinlock.c:231 send_sigio+0x2f/0x300 fs/fcntl.c:795 kill_fasync_rcu fs/fcntl.c:1019 [inline] kill_fasync+0x1e3/0x430 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x195/0x280 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x87c/0x11e0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x189/0x270 drivers/input/input.c:476 evdev_write+0x5f0/0x780 drivers/input/evdev.c:530 vfs_write+0x289/0xc90 fs/read_write.c:603 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae stack backtrace: CPU: 1 PID: 8426 Comm: syz-executor813 Not tainted 5.14.0-rc7-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+0x1ae/0x29f lib/dump_stack.c:105 print_bad_irq_dependency kernel/locking/lockdep.c:2565 [inline] check_irq_usage kernel/locking/lockdep.c:2804 [inline] check_prev_add kernel/locking/lockdep.c:3055 [inline] check_prevs_add+0x4eaa/0x5b30 kernel/locking/lockdep.c:3174 validate_chain kernel/locking/lockdep.c:3789 [inline] __lock_acquire+0x4476/0x6100 kernel/locking/lockdep.c:5015 lock_acquire+0x182/0x4a0 kernel/locking/lockdep.c:5625 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:159 [inline] _raw_read_lock_irqsave+0xbb/0x100 kernel/locking/spinlock.c:231 send_sigio+0x2f/0x300 fs/fcntl.c:795 kill_fasync_rcu fs/fcntl.c:1019 [inline] kill_fasync+0x1e3/0x430 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x195/0x280 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x87c/0x11e0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x189/0x270 drivers/input/input.c:476 evdev_write+0x5f0/0x780 drivers/input/evdev.c:530 vfs_write+0x289/0xc90 fs/read_write.c:603 ksys_write+0x171/0x2a0 fs/read_write.c:658 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x446479 Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffcb15a7f48 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00000000004004a0 RCX: 0000000000446479 RDX: 0000000000003888 RSI: 0000000020000080 RDI: 0000000000000005 RBP: 0000000000405d90 R08: 00000000004004a0 R09: 00000000004004a0 R10: 00000000004004a0 R11: 00000000000