====================================================== WARNING: possible circular locking dependency detected 6.8.0-rc1-next-20240125-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.0/32623 is trying to acquire lock: ffffffff8d725f60 (fs_reclaim){+.+.}-{0:0}, at: might_alloc include/linux/sched/mm.h:303 [inline] ffffffff8d725f60 (fs_reclaim){+.+.}-{0:0}, at: slab_pre_alloc_hook mm/slub.c:3762 [inline] ffffffff8d725f60 (fs_reclaim){+.+.}-{0:0}, at: slab_alloc_node mm/slub.c:3843 [inline] ffffffff8d725f60 (fs_reclaim){+.+.}-{0:0}, at: kmalloc_trace+0x51/0x330 mm/slub.c:4008 but task is already holding lock: ffff888045472918 (ptlock_ptr(ptdesc)){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] ffff888045472918 (ptlock_ptr(ptdesc)){+.+.}-{2:2}, at: huge_pte_lock include/linux/hugetlb.h:1232 [inline] ffff888045472918 (ptlock_ptr(ptdesc)){+.+.}-{2:2}, at: __unmap_hugepage_range+0x4e5/0x1bf0 mm/hugetlb.c:5611 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (ptlock_ptr(ptdesc)){+.+.}-{2:2}: __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline] _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:351 [inline] pmd_lock include/linux/mm.h:3036 [inline] __split_huge_pmd+0x21f/0x2ec0 mm/huge_memory.c:2631 split_huge_pmd_address mm/huge_memory.c:2664 [inline] split_huge_pmd_if_needed mm/huge_memory.c:2676 [inline] split_huge_pmd_if_needed mm/huge_memory.c:2667 [inline] vma_adjust_trans_huge+0x2da/0x560 mm/huge_memory.c:2688 __split_vma+0xcb9/0x1190 mm/mmap.c:2365 split_vma mm/mmap.c:2401 [inline] vma_modify+0x261/0x460 mm/mmap.c:2436 vma_modify_flags include/linux/mm.h:3283 [inline] mprotect_fixup+0x228/0xc90 mm/mprotect.c:635 do_mprotect_pkey+0x8a4/0xdc0 mm/mprotect.c:809 __do_sys_mprotect mm/mprotect.c:830 [inline] __se_sys_mprotect mm/mprotect.c:827 [inline] __x64_sys_mprotect+0x78/0xc0 mm/mprotect.c:827 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 -> #1 (&mapping->i_mmap_rwsem){++++}-{3:3}: down_write+0x3a/0x50 kernel/locking/rwsem.c:1579 i_mmap_lock_write include/linux/fs.h:512 [inline] dma_resv_lockdep+0x292/0x620 drivers/dma-buf/dma-resv.c:787 do_one_initcall+0x128/0x690 init/main.c:1236 do_initcall_level init/main.c:1298 [inline] do_initcalls init/main.c:1314 [inline] do_basic_setup init/main.c:1333 [inline] kernel_init_freeable+0x698/0xc30 init/main.c:1551 kernel_init+0x1c/0x2a0 init/main.c:1441 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:242 -> #0 (fs_reclaim){+.+.}-{0:0}: check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719 __fs_reclaim_acquire mm/page_alloc.c:3728 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:3742 might_alloc include/linux/sched/mm.h:303 [inline] slab_pre_alloc_hook mm/slub.c:3762 [inline] slab_alloc_node mm/slub.c:3843 [inline] kmalloc_trace+0x51/0x330 mm/slub.c:4008 kmalloc include/linux/slab.h:590 [inline] allocate_file_region_entries+0x1a3/0x620 mm/hugetlb.c:666 region_chg+0x85/0x140 mm/hugetlb.c:786 __vma_reservation_common+0x443/0x740 mm/hugetlb.c:2832 vma_needs_reservation mm/hugetlb.c:2899 [inline] __unmap_hugepage_range+0xfdb/0x1bf0 mm/hugetlb.c:5681 unmap_single_vma+0x24b/0x2b0 mm/memory.c:1813 unmap_vmas+0x22f/0x490 mm/memory.c:1861 exit_mmap+0x1c1/0xbe0 mm/mmap.c:3260 __mmput+0x12a/0x4d0 kernel/fork.c:1343 mmput+0x62/0x70 kernel/fork.c:1365 exit_mm kernel/exit.c:569 [inline] do_exit+0x999/0x2ac0 kernel/exit.c:858 do_group_exit+0xd3/0x2a0 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 other info that might help us debug this: Chain exists of: fs_reclaim --> &mapping->i_mmap_rwsem --> ptlock_ptr(ptdesc) Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(ptlock_ptr(ptdesc)); lock(&mapping->i_mmap_rwsem); lock(ptlock_ptr(ptdesc)); lock(fs_reclaim); *** DEADLOCK *** 4 locks held by syz-executor.0/32623: #0: ffff888026c181a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:168 [inline] #0: ffff888026c181a0 (&mm->mmap_lock){++++}-{3:3}, at: exit_mmap+0x107/0xbe0 mm/mmap.c:3244 #1: ffff88807d9ca4e8 (&resv_map->rw_sema){++++}-{3:3}, at: hugetlb_vma_lock_write mm/hugetlb.c:300 [inline] #1: ffff88807d9ca4e8 (&resv_map->rw_sema){++++}-{3:3}, at: hugetlb_vma_lock_write+0x105/0x140 mm/hugetlb.c:291 #2: ffff8880111808e0 (&hugetlbfs_i_mmap_rwsem_key){+.+.}-{3:3}, at: i_mmap_lock_write include/linux/fs.h:512 [inline] #2: ffff8880111808e0 (&hugetlbfs_i_mmap_rwsem_key){+.+.}-{3:3}, at: __hugetlb_zap_begin+0x242/0x2b0 mm/hugetlb.c:5726 #3: ffff888045472918 (ptlock_ptr(ptdesc)){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline] #3: ffff888045472918 (ptlock_ptr(ptdesc)){+.+.}-{2:2}, at: huge_pte_lock include/linux/hugetlb.h:1232 [inline] #3: ffff888045472918 (ptlock_ptr(ptdesc)){+.+.}-{2:2}, at: __unmap_hugepage_range+0x4e5/0x1bf0 mm/hugetlb.c:5611 stack backtrace: CPU: 0 PID: 32623 Comm: syz-executor.0 Not tainted 6.8.0-rc1-next-20240125-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2187 check_prev_add kernel/locking/lockdep.c:3134 [inline] check_prevs_add kernel/locking/lockdep.c:3253 [inline] validate_chain kernel/locking/lockdep.c:3869 [inline] __lock_acquire+0x2478/0x3b30 kernel/locking/lockdep.c:5137 lock_acquire kernel/locking/lockdep.c:5754 [inline] lock_acquire+0x1b1/0x540 kernel/locking/lockdep.c:5719 __fs_reclaim_acquire mm/page_alloc.c:3728 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:3742 might_alloc include/linux/sched/mm.h:303 [inline] slab_pre_alloc_hook mm/slub.c:3762 [inline] slab_alloc_node mm/slub.c:3843 [inline] kmalloc_trace+0x51/0x330 mm/slub.c:4008 kmalloc include/linux/slab.h:590 [inline] allocate_file_region_entries+0x1a3/0x620 mm/hugetlb.c:666 region_chg+0x85/0x140 mm/hugetlb.c:786 __vma_reservation_common+0x443/0x740 mm/hugetlb.c:2832 vma_needs_reservation mm/hugetlb.c:2899 [inline] __unmap_hugepage_range+0xfdb/0x1bf0 mm/hugetlb.c:5681 unmap_single_vma+0x24b/0x2b0 mm/memory.c:1813 unmap_vmas+0x22f/0x490 mm/memory.c:1861 exit_mmap+0x1c1/0xbe0 mm/mmap.c:3260 __mmput+0x12a/0x4d0 kernel/fork.c:1343 mmput+0x62/0x70 kernel/fork.c:1365 exit_mm kernel/exit.c:569 [inline] do_exit+0x999/0x2ac0 kernel/exit.c:858 do_group_exit+0xd3/0x2a0 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 RIP: 0033:0x7f494207cda9 Code: Unable to access opcode bytes at 0x7f494207cd7f. RSP: 002b:00007ffed4a8f738 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000000001e RCX: 00007f494207cda9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000001 R08: 0000000000000590 R09: 0000000000000000 R10: 0000001b2e920000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000001 BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 32623, name: syz-executor.0 preempt_count: 1, expected: 0 RCU nest depth: 0, expected: 0 INFO: lockdep is turned off. Preemption disabled at: [<0000000000000000>] 0x0 CPU: 0 PID: 32623 Comm: syz-executor.0 Not tainted 6.8.0-rc1-next-20240125-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x125/0x1b0 lib/dump_stack.c:106 __might_resched+0x3c0/0x5e0 kernel/sched/core.c:10178 might_alloc include/linux/sched/mm.h:306 [inline] might_alloc include/linux/sched/mm.h:301 [inline] slab_pre_alloc_hook mm/slub.c:3762 [inline] slab_alloc_node mm/slub.c:3843 [inline] kmalloc_trace+0x2a3/0x330 mm/slub.c:4008 kmalloc include/linux/slab.h:590 [inline] allocate_file_region_entries+0x1a3/0x620 mm/hugetlb.c:666 region_chg+0x85/0x140 mm/hugetlb.c:786 __vma_reservation_common+0x443/0x740 mm/hugetlb.c:2832 vma_needs_reservation mm/hugetlb.c:2899 [inline] __unmap_hugepage_range+0xfdb/0x1bf0 mm/hugetlb.c:5681 unmap_single_vma+0x24b/0x2b0 mm/memory.c:1813 unmap_vmas+0x22f/0x490 mm/memory.c:1861 exit_mmap+0x1c1/0xbe0 mm/mmap.c:3260 __mmput+0x12a/0x4d0 kernel/fork.c:1343 mmput+0x62/0x70 kernel/fork.c:1365 exit_mm kernel/exit.c:569 [inline] do_exit+0x999/0x2ac0 kernel/exit.c:858 do_group_exit+0xd3/0x2a0 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 RIP: 0033:0x7f494207cda9 Code: Unable to access opcode bytes at 0x7f494207cd7f. RSP: 002b:00007ffed4a8f738 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000000001e RCX: 00007f494207cda9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000001 R08: 0000000000000590 R09: 0000000000000000 R10: 0000001b2e920000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000001 ------------[ cut here ]------------ kernel BUG at mm/hugetlb.c:1129! invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 0 PID: 32623 Comm: syz-executor.0 Tainted: G W 6.8.0-rc1-next-20240125-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 RIP: 0010:resv_map_release mm/hugetlb.c:1129 [inline] RIP: 0010:resv_map_release+0x1f3/0x290 mm/hugetlb.c:1114 Code: aa ff 48 85 db 75 1d e8 3b f3 aa ff 48 8b 7c 24 08 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e 41 5f e9 03 09 fb ff e8 1e f3 aa ff 90 <0f> 0b 4c 89 ef e8 83 76 05 00 e9 3d ff ff ff 48 89 ef e8 86 75 05 RSP: 0018:ffffc90012f7fb40 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81e14c2b RDX: ffff88807e4b5a00 RSI: ffffffff81e14c52 RDI: 0000000000000007 RBP: ffff88807d9ca460 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000001 R11: ffffffff8ac000e6 R12: ffff88807d9ca460 R13: ffff88807d9ca460 R14: ffff888021314308 R15: dead000000000100 FS: 0000000000000000(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f6b24329d58 CR3: 0000000069c10000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: kref_put include/linux/kref.h:65 [inline] hugetlb_vm_op_close+0x4f5/0x5d0 mm/hugetlb.c:5165 remove_vma+0x8b/0x180 mm/mmap.c:141 exit_mmap+0x511/0xbe0 mm/mmap.c:3284 __mmput+0x12a/0x4d0 kernel/fork.c:1343 mmput+0x62/0x70 kernel/fork.c:1365 exit_mm kernel/exit.c:569 [inline] do_exit+0x999/0x2ac0 kernel/exit.c:858 do_group_exit+0xd3/0x2a0 kernel/exit.c:1020 __do_sys_exit_group kernel/exit.c:1031 [inline] __se_sys_exit_group kernel/exit.c:1029 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xd2/0x260 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x6d/0x75 RIP: 0033:0x7f494207cda9 Code: Unable to access opcode bytes at 0x7f494207cd7f. RSP: 002b:00007ffed4a8f738 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 000000000000001e RCX: 00007f494207cda9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000001 R08: 0000000000000590 R09: 0000000000000000 R10: 0000001b2e920000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000001 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:resv_map_release mm/hugetlb.c:1129 [inline] RIP: 0010:resv_map_release+0x1f3/0x290 mm/hugetlb.c:1114 Code: aa ff 48 85 db 75 1d e8 3b f3 aa ff 48 8b 7c 24 08 48 83 c4 18 5b 5d 41 5c 41 5d 41 5e 41 5f e9 03 09 fb ff e8 1e f3 aa ff 90 <0f> 0b 4c 89 ef e8 83 76 05 00 e9 3d ff ff ff 48 89 ef e8 86 75 05 RSP: 0018:ffffc90012f7fb40 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffffffff81e14c2b RDX: ffff88807e4b5a00 RSI: ffffffff81e14c52 RDI: 0000000000000007 RBP: ffff88807d9ca460 R08: 0000000000000007 R09: 0000000000000000 R10: 0000000000000001 R11: ffffffff8ac000e6 R12: ffff88807d9ca460 R13: ffff88807d9ca460 R14: ffff888021314308 R15: dead000000000100 FS: 0000000000000000(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b31a28000 CR3: 000000001f444000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400