======================================================== WARNING: possible irq lock inversion dependency detected 4.14.176-syzkaller #0 Not tainted -------------------------------------------------------- syz-executor.3/7701 just changed the state of lock: (&(&info->lock)->rlock){+...}, at: [] spin_lock include/linux/spinlock.h:317 [inline] (&(&info->lock)->rlock){+...}, at: [] shmem_mfill_atomic_pte+0x11ba/0x1790 mm/shmem.c:2333 but this lock was taken by another, HARDIRQ-safe lock in the past: (&(&mapping->tree_lock)->rlock){-.-.} 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(&(&info->lock)->rlock); local_irq_disable(); lock(&(&mapping->tree_lock)->rlock); lock(&(&info->lock)->rlock); lock(&(&mapping->tree_lock)->rlock); *** DEADLOCK *** 2 locks held by syz-executor.3/7701: #0: (&mm->mmap_sem){++++}, at: [] __mcopy_atomic mm/userfaultfd.c:464 [inline] #0: (&mm->mmap_sem){++++}, at: [] mfill_zeropage+0x86/0xcd0 mm/userfaultfd.c:604 #1: (&(ptlock_ptr(page))->rlock#2){+.+.}, at: [] spin_lock include/linux/spinlock.h:317 [inline] #1: (&(ptlock_ptr(page))->rlock#2){+.+.}, at: [] shmem_mfill_atomic_pte+0xbdb/0x1790 mm/shmem.c:2320 the shortest dependencies between 2nd lock and 1st lock: -> (&(&mapping->tree_lock)->rlock){-.-.} ops: 1348523 { IN-HARDIRQ-W at: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:160 test_clear_page_writeback+0x199/0xc20 mm/page-writeback.c:2742 end_page_writeback+0xe4/0x210 mm/filemap.c:1153 ext4_finish_bio+0x483/0x710 fs/ext4/page-io.c:118 ext4_end_bio+0x14b/0x5a0 fs/ext4/page-io.c:342 bio_endio+0x315/0x670 block/bio.c:1918 req_bio_endio block/blk-core.c:204 [inline] blk_update_request+0x27a/0x9d0 block/blk-core.c:2763 scsi_end_request+0x7d/0x9b0 drivers/scsi/scsi_lib.c:659 scsi_io_completion+0xa63/0x1590 drivers/scsi/scsi_lib.c:885 scsi_softirq_done+0x2c8/0x360 drivers/scsi/scsi_lib.c:1671 __blk_mq_complete_request+0x30b/0x6c0 block/blk-mq.c:571 blk_mq_complete_request+0x51/0x60 block/blk-mq.c:591 virtscsi_vq_done+0xa7/0x130 drivers/scsi/virtio_scsi.c:223 vring_interrupt+0x101/0x150 drivers/virtio/virtio_ring.c:951 __handle_irq_event_percpu+0x125/0x7e0 kernel/irq/handle.c:147 handle_irq_event_percpu+0x66/0x120 kernel/irq/handle.c:187 handle_irq_event+0xa2/0x12d kernel/irq/handle.c:204 handle_edge_irq+0x215/0x810 kernel/irq/chip.c:770 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline] handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87 do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230 ret_from_intr+0x0/0x1e arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline] lock_acquire+0x1ec/0x3f0 kernel/locking/lockdep.c:3997 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:152 spin_lock include/linux/spinlock.h:317 [inline] list_lru_del+0x80/0x4c0 mm/list_lru.c:131 d_lru_del+0xa9/0x100 fs/dcache.c:418 __dentry_kill+0x420/0x550 fs/dcache.c:583 dentry_kill fs/dcache.c:632 [inline] dput.part.0+0x4be/0x710 fs/dcache.c:847 dput+0x1b/0x30 fs/dcache.c:811 SYSC_renameat2 fs/namei.c:4648 [inline] SyS_renameat2 fs/namei.c:4533 [inline] SYSC_rename fs/namei.c:4684 [inline] SyS_rename+0x61d/0x6d0 fs/namei.c:4682 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 IN-SOFTIRQ-W at: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:160 test_clear_page_writeback+0x199/0xc20 mm/page-writeback.c:2742 end_page_writeback+0xe4/0x210 mm/filemap.c:1153 end_buffer_async_write+0x367/0x6a0 fs/buffer.c:377 end_bio_bh_io_sync+0xbf/0x100 fs/buffer.c:3038 bio_endio+0x315/0x670 block/bio.c:1918 req_bio_endio block/blk-core.c:204 [inline] blk_update_request+0x27a/0x9d0 block/blk-core.c:2763 scsi_end_request+0x7d/0x9b0 drivers/scsi/scsi_lib.c:659 scsi_io_completion+0xa63/0x1590 drivers/scsi/scsi_lib.c:885 scsi_softirq_done+0x2c8/0x360 drivers/scsi/scsi_lib.c:1671 __blk_mq_complete_request+0x30b/0x6c0 block/blk-mq.c:571 blk_mq_complete_request+0x51/0x60 block/blk-mq.c:591 virtscsi_vq_done+0xa7/0x130 drivers/scsi/virtio_scsi.c:223 vring_interrupt+0x101/0x150 drivers/virtio/virtio_ring.c:951 __handle_irq_event_percpu+0x125/0x7e0 kernel/irq/handle.c:147 handle_irq_event_percpu+0x66/0x120 kernel/irq/handle.c:187 handle_irq_event+0xa2/0x12d kernel/irq/handle.c:204 handle_edge_irq+0x215/0x810 kernel/irq/chip.c:770 generic_handle_irq_desc include/linux/irqdesc.h:159 [inline] handle_irq+0x35/0x50 arch/x86/kernel/irq_64.c:87 do_IRQ+0x93/0x1d0 arch/x86/kernel/irq.c:230 ret_from_intr+0x0/0x1e arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline] kmem_cache_free+0xa9/0x2b0 mm/slab.c:3759 __rcu_reclaim kernel/rcu/rcu.h:195 [inline] rcu_do_batch kernel/rcu/tree.c:2699 [inline] invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline] __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline] rcu_process_callbacks+0x792/0x1190 kernel/rcu/tree.c:2946 __do_softirq+0x254/0x9bf kernel/softirq.c:288 invoke_softirq kernel/softirq.c:368 [inline] irq_exit+0x15b/0x1a0 kernel/softirq.c:409 exiting_irq arch/x86/include/asm/apic.h:648 [inline] smp_apic_timer_interrupt+0x141/0x5e0 arch/x86/kernel/apic/apic.c:1102 apic_timer_interrupt+0x8f/0xa0 arch/x86/entry/entry_64.S:792 stack_access_ok+0x0/0x130 arch/x86/kernel/unwind_orc.c:149 deref_stack_reg+0x56/0xc0 arch/x86/kernel/unwind_orc.c:289 unwind_next_frame+0xa06/0x17a0 arch/x86/kernel/unwind_orc.c:425 __save_stack_trace+0x6b/0xd0 arch/x86/kernel/stacktrace.c:44 save_stack+0x32/0xa0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc mm/kasan/kasan.c:551 [inline] kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529 slab_post_alloc_hook mm/slab.h:442 [inline] slab_alloc mm/slab.c:3390 [inline] kmem_cache_alloc+0x114/0x770 mm/slab.c:3550 alloc_inode+0xa0/0x170 fs/inode.c:212 iget_locked+0x151/0x400 fs/inode.c:1127 kernfs_get_inode+0x4c/0x550 fs/kernfs/inode.c:269 kernfs_iop_lookup+0x17e/0x200 fs/kernfs/dir.c:1071 lookup_open+0x5d1/0x1750 fs/namei.c:3220 do_last fs/namei.c:3334 [inline] path_openat+0x1878/0x3c50 fs/namei.c:3569 do_filp_open+0x18e/0x250 fs/namei.c:3603 do_sys_open+0x29d/0x3f0 fs/open.c:1081 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 INITIAL USE at: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x5b/0x80 kernel/locking/spinlock.c:168 spin_lock_irq include/linux/spinlock.h:342 [inline] __add_to_page_cache_locked+0x286/0x870 mm/filemap.c:781 add_to_page_cache_lru+0xe9/0x300 mm/filemap.c:830 do_read_cache_page+0x6d5/0x12a0 mm/filemap.c:2703 read_mapping_page include/linux/pagemap.h:398 [inline] read_dev_sector+0xbf/0x3d0 block/partition-generic.c:659 read_part_sector block/partitions/check.h:38 [inline] adfspart_check_ICS+0xf3/0xc10 block/partitions/acorn.c:366 check_partition+0x33f/0x62d block/partitions/check.c:167 rescan_partitions+0x1e5/0x850 block/partition-generic.c:523 __blkdev_get+0x926/0x10d0 fs/block_dev.c:1503 blkdev_get+0x84/0x8a0 fs/block_dev.c:1612 register_disk block/genhd.c:616 [inline] device_add_disk+0x897/0xd80 block/genhd.c:679 add_disk include/linux/genhd.h:396 [inline] brd_init+0x214/0x3c9 drivers/block/brd.c:586 do_one_initcall+0x88/0x202 init/main.c:824 do_initcall_level init/main.c:890 [inline] do_initcalls init/main.c:898 [inline] do_basic_setup init/main.c:916 [inline] kernel_init_freeable+0x465/0x526 init/main.c:1073 kernel_init+0xd/0x15b init/main.c:998 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 } ... key at: [] __key.49022+0x0/0x40 ... acquired at: __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:160 shmem_uncharge+0x24/0x250 mm/shmem.c:318 __split_huge_page mm/huge_memory.c:2387 [inline] split_huge_page_to_list+0x1590/0x1f40 mm/huge_memory.c:2649 split_huge_page include/linux/huge_mm.h:141 [inline] shmem_unused_huge_shrink+0x5ca/0x1180 mm/shmem.c:526 shmem_unused_huge_scan+0x70/0xa0 mm/shmem.c:558 super_cache_scan+0x333/0x460 fs/super.c:107 do_shrink_slab mm/vmscan.c:401 [inline] shrink_slab.part.0+0x3bb/0xa50 mm/vmscan.c:504 shrink_slab mm/vmscan.c:468 [inline] shrink_node+0x848/0xb60 mm/vmscan.c:2672 kswapd_shrink_node mm/vmscan.c:3299 [inline] balance_pgdat mm/vmscan.c:3405 [inline] kswapd+0x88d/0x14b0 mm/vmscan.c:3623 kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 -> (&(&info->lock)->rlock){+...} ops: 110062 { HARDIRQ-ON-W at: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:152 spin_lock include/linux/spinlock.h:317 [inline] shmem_mfill_atomic_pte+0x11ba/0x1790 mm/shmem.c:2333 shmem_mfill_zeropage_pte+0x81/0xa0 mm/shmem.c:2382 mfill_atomic_pte mm/userfaultfd.c:429 [inline] __mcopy_atomic mm/userfaultfd.c:549 [inline] mfill_zeropage+0x773/0xcd0 mm/userfaultfd.c:604 userfaultfd_zeropage fs/userfaultfd.c:1760 [inline] userfaultfd_ioctl+0x10da/0x2f80 fs/userfaultfd.c:1861 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 INITIAL USE at: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline] _raw_spin_lock_irq+0x5b/0x80 kernel/locking/spinlock.c:168 spin_lock_irq include/linux/spinlock.h:342 [inline] shmem_getpage_gfp+0x17c6/0x2790 mm/shmem.c:1829 shmem_getpage mm/shmem.c:131 [inline] shmem_write_begin+0xf4/0x190 mm/shmem.c:2413 generic_perform_write+0x1c9/0x420 mm/filemap.c:3047 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3172 generic_file_write_iter+0x2fa/0x650 mm/filemap.c:3200 call_write_iter include/linux/fs.h:1778 [inline] new_sync_write fs/read_write.c:469 [inline] __vfs_write+0x44e/0x630 fs/read_write.c:482 vfs_write+0x192/0x4e0 fs/read_write.c:544 SYSC_write fs/read_write.c:590 [inline] SyS_write+0xf2/0x210 fs/read_write.c:582 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 } ... key at: [] __key.49220+0x0/0x40 ... acquired at: mark_lock_irq kernel/locking/lockdep.c:2800 [inline] mark_lock+0x3c8/0x10b0 kernel/locking/lockdep.c:3190 mark_irqflags kernel/locking/lockdep.c:3082 [inline] __lock_acquire+0xbcf/0x4620 kernel/locking/lockdep.c:3444 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:152 spin_lock include/linux/spinlock.h:317 [inline] shmem_mfill_atomic_pte+0x11ba/0x1790 mm/shmem.c:2333 shmem_mfill_zeropage_pte+0x81/0xa0 mm/shmem.c:2382 mfill_atomic_pte mm/userfaultfd.c:429 [inline] __mcopy_atomic mm/userfaultfd.c:549 [inline] mfill_zeropage+0x773/0xcd0 mm/userfaultfd.c:604 userfaultfd_zeropage fs/userfaultfd.c:1760 [inline] userfaultfd_ioctl+0x10da/0x2f80 fs/userfaultfd.c:1861 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 stack backtrace: CPU: 0 PID: 7701 Comm: syz-executor.3 Not tainted 4.14.176-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x13e/0x194 lib/dump_stack.c:58 print_irq_inversion_bug kernel/locking/lockdep.c:152 [inline] check_usage_backwards.cold+0x41/0x4a kernel/locking/lockdep.c:2715 mark_lock_irq kernel/locking/lockdep.c:2800 [inline] mark_lock+0x3c8/0x10b0 kernel/locking/lockdep.c:3190 mark_irqflags kernel/locking/lockdep.c:3082 [inline] __lock_acquire+0xbcf/0x4620 kernel/locking/lockdep.c:3444 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3994 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:152 spin_lock include/linux/spinlock.h:317 [inline] shmem_mfill_atomic_pte+0x11ba/0x1790 mm/shmem.c:2333 shmem_mfill_zeropage_pte+0x81/0xa0 mm/shmem.c:2382 mfill_atomic_pte mm/userfaultfd.c:429 [inline] __mcopy_atomic mm/userfaultfd.c:549 [inline] mfill_zeropage+0x773/0xcd0 mm/userfaultfd.c:604 userfaultfd_zeropage fs/userfaultfd.c:1760 [inline] userfaultfd_ioctl+0x10da/0x2f80 fs/userfaultfd.c:1861 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:500 [inline] do_vfs_ioctl+0x75a/0xfe0 fs/ioctl.c:684 SYSC_ioctl fs/ioctl.c:701 [inline] SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x42/0xb7 RIP: 0033:0x45c829 RSP: 002b:00007f3f18b8ec78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000004ef8c0 RCX: 000000000045c829 RDX: 0000000020000080 RSI: 00000000c020aa04 RDI: 0000000000000005 RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000005b8 R14: 00000000004c8567 R15: 00007f3f18b8f6d4 netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 256 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 25 bytes leftover after parsing attributes in process `syz-executor.3'. IPv6: ADDRCONF(NETDEV_UP): veth3: link is not ready team0: Port device veth3 added netlink: 256 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 25 bytes leftover after parsing attributes in process `syz-executor.3'. IPv6: ADDRCONF(NETDEV_UP): veth5: link is not ready team0: Port device veth5 added netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 256 bytes leftover after parsing attributes in process `syz-executor.3'. netlink: 25 bytes leftover after parsing attributes in process `syz-executor.3'. IPv6: ADDRCONF(NETDEV_UP): veth7: link is not ready team0: Port device veth7 added netlink: 4 bytes leftover after parsing attributes in process `syz-executor.4'. netlink: 256 bytes leftover after parsing attributes in process `syz-executor.3'. IPv6: ADDRCONF(NETDEV_UP): veth9: link is not ready team0: Port device veth9 added IPv6: ADDRCONF(NETDEV_UP): veth11: link is not ready team0: Port device veth11 added IPv6: ADDRCONF(NETDEV_UP): veth13: link is not ready team0: Port device veth13 added IPv6: ADDRCONF(NETDEV_UP): veth5: link is not ready team0: Port device veth5 added