======================================================== WARNING: possible irq lock inversion dependency detected 5.13.0-rc2-syzkaller #0 Not tainted -------------------------------------------------------- syz-executor.5/14107 just changed the state of lock: ffff8880170e63b8 (&f->f_owner.lock){.+..}-{2:2}, at: f_getown+0x22/0x210 fs/fcntl.c:153 but this lock was taken by another, HARDIRQ-safe lock in the past: (&dev->event_lock){-...}-{2:2} and interrupts could create inverse lock ordering between them. 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 *** no locks held by syz-executor.5/14107. the shortest dependencies between 2nd lock and 1st lock: -> (&dev->event_lock){-...}-{2:2} { IN-HARDIRQ-W at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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/0x2f0 kernel/irq/handle.c:213 handle_edge_irq+0x245/0xbe0 kernel/irq/chip.c:819 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:638 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline] _raw_spin_unlock_irqrestore+0xbc/0x120 kernel/locking/spinlock.c:191 spin_unlock_irqrestore include/linux/spinlock.h:409 [inline] i8042_command drivers/input/serio/i8042.c:352 [inline] i8042_aux_write+0x118/0x190 drivers/input/serio/i8042.c:387 serio_write include/linux/serio.h:125 [inline] ps2_do_sendbyte+0x210/0x710 drivers/input/serio/libps2.c:40 ps2_sendbyte+0x5c/0x120 drivers/input/serio/libps2.c:92 cypress_ps2_sendbyte drivers/input/mouse/cypress_ps2.c:42 [inline] cypress_ps2_read_cmd_status+0x151/0x600 drivers/input/mouse/cypress_ps2.c:116 cypress_send_ext_cmd+0xfa/0x3e0 drivers/input/mouse/cypress_ps2.c:189 cypress_detect+0x80/0x210 drivers/input/mouse/cypress_ps2.c:205 psmouse_do_detect drivers/input/mouse/psmouse-base.c:1009 [inline] psmouse_try_protocol drivers/input/mouse/psmouse-base.c:1023 [inline] psmouse_extensions+0x14a1/0x2130 drivers/input/mouse/psmouse-base.c:1146 psmouse_switch_protocol+0x307/0x840 drivers/input/mouse/psmouse-base.c:1542 psmouse_connect+0x918/0x1630 drivers/input/mouse/psmouse-base.c:1632 serio_connect_driver drivers/input/serio/serio.c:47 [inline] serio_driver_probe+0x76/0x90 drivers/input/serio/serio.c:778 really_probe+0x385/0x1020 drivers/base/dd.c:576 driver_probe_device+0x178/0x350 drivers/base/dd.c:763 device_driver_attach+0x176/0x280 drivers/base/dd.c:1039 __driver_attach+0xa7/0x390 drivers/base/dd.c:1117 bus_for_each_dev+0x168/0x1d0 drivers/base/bus.c:305 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:2275 worker_thread+0xac1/0x1300 kernel/workqueue.c:2421 kthread+0x39a/0x3c0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 INITIAL USE at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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+0xb3/0x280 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:416 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/0xa70 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 really_probe+0x385/0x1020 drivers/base/dd.c:576 driver_probe_device+0x178/0x350 drivers/base/dd.c:763 device_driver_attach+0x176/0x280 drivers/base/dd.c:1039 __driver_attach+0xa7/0x390 drivers/base/dd.c:1117 bus_for_each_dev+0x168/0x1d0 drivers/base/bus.c:305 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:2275 worker_thread+0xac1/0x1300 kernel/workqueue.c:2421 kthread+0x39a/0x3c0 kernel/kthread.c:313 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294 } ... key at: [] input_allocate_device.__key.6+0x0/0x40 ... acquired at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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+0x1c5/0x270 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x89c/0x11d0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x1e8/0x280 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_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae -> (&client->buffer_lock){....}-{2:2} { INITIAL USE at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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+0x1c5/0x270 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x89c/0x11d0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x1e8/0x280 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_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] evdev_open.__key.23+0x0/0x40 ... acquired at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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+0x19b/0x440 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x1c5/0x270 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x89c/0x11d0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x1e8/0x280 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_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae -> (&new->fa_lock){....}-{2:2} { INITIAL USE at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __raw_write_lock_irq include/linux/rwlock_api_smp.h:196 [inline] _raw_write_lock_irq+0xae/0xf0 kernel/locking/spinlock.c:311 fasync_remove_entry+0xff/0x1d0 fs/fcntl.c:890 lease_modify+0x4dd/0x6a0 fs/locks.c:1522 locks_remove_lease fs/locks.c:2771 [inline] locks_remove_file+0x52e/0xfd0 fs/locks.c:2796 __fput+0x2bf/0x7b0 fs/file_table.c:272 task_work_run+0x146/0x1c0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x10b/0x200 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x26/0x70 kernel/entry/common.c:301 do_syscall_64+0x4b/0xb0 arch/x86/entry/common.c:57 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL READ USE at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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+0x19b/0x440 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x1c5/0x270 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x89c/0x11d0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x1e8/0x280 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_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] fasync_insert_entry.__key+0x0/0x40 ... acquired at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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+0x243/0x440 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x1c5/0x270 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x89c/0x11d0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x1e8/0x280 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_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae -> (&f->f_owner.lock){.+..}-{2:2} { HARDIRQ-ON-R at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 f_getown+0x22/0x210 fs/fcntl.c:153 sock_ioctl+0x2c6/0x6a0 net/socket.c:1124 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL USE at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __raw_write_lock_irq include/linux/rwlock_api_smp.h:196 [inline] _raw_write_lock_irq+0xae/0xf0 kernel/locking/spinlock.c:311 f_modown+0x38/0x340 fs/fcntl.c:91 generic_add_lease fs/locks.c:1942 [inline] generic_setlease+0xbde/0x1330 fs/locks.c:2021 vfs_setlease fs/locks.c:2111 [inline] do_fcntl_add_lease fs/locks.c:2132 [inline] fcntl_setlease+0x632/0x740 fs/locks.c:2154 do_fcntl+0xf8/0x1510 fs/fcntl.c:418 __do_sys_fcntl fs/fcntl.c:471 [inline] __se_sys_fcntl+0xd8/0x1b0 fs/fcntl.c:456 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL READ USE at: lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __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+0x243/0x440 fs/fcntl.c:1033 __pass_event drivers/input/evdev.c:240 [inline] evdev_pass_values+0x58a/0xaa0 drivers/input/evdev.c:278 evdev_events+0x1c5/0x270 drivers/input/evdev.c:306 input_to_handler drivers/input/input.c:115 [inline] input_pass_values+0x89c/0x11d0 drivers/input/input.c:145 input_handle_event+0xb99/0x1550 drivers/input/input.c:404 input_inject_event+0x1e8/0x280 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_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] __alloc_file.__key+0x0/0x10 ... acquired at: mark_usage kernel/locking/lockdep.c:4381 [inline] __lock_acquire+0xd10/0x6040 kernel/locking/lockdep.c:4856 lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 f_getown+0x22/0x210 fs/fcntl.c:153 sock_ioctl+0x2c6/0x6a0 net/socket.c:1124 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae stack backtrace: CPU: 1 PID: 14107 Comm: syz-executor.5 Not tainted 5.13.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:79 [inline] dump_stack+0x202/0x31e lib/dump_stack.c:120 print_irq_inversion_bug+0xa58/0xda0 kernel/locking/lockdep.c:3887 check_usage_backwards kernel/locking/lockdep.c:2482 [inline] mark_lock_irq kernel/locking/lockdep.c:4043 [inline] mark_lock+0x110b/0x1eb0 kernel/locking/lockdep.c:4480 mark_usage kernel/locking/lockdep.c:4381 [inline] __lock_acquire+0xd10/0x6040 kernel/locking/lockdep.c:4856 lock_acquire+0x17f/0x720 kernel/locking/lockdep.c:5512 __raw_read_lock include/linux/rwlock_api_smp.h:149 [inline] _raw_read_lock+0x32/0x40 kernel/locking/spinlock.c:223 f_getown+0x22/0x210 fs/fcntl.c:153 sock_ioctl+0x2c6/0x6a0 net/socket.c:1124 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:1069 [inline] __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:1055 do_syscall_64+0x3f/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665d9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f707cea3188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665d9 RDX: 0000000020000300 RSI: 0000000000008903 RDI: 0000000000000005 RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 0000000000000004 R14: 0000000000000000 R15: 000000000000c34d