Hello, kernel test robot noticed "WARNING:possible_circular_locking_dependency_detected" on: commit: 46c1b3279220368b60bfa63d4f66452ca860d03b ("mm/mremap: prevent racing change of old pmd type") https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master [test failed on linux-next/master 58ca61c1a866bfdaa5e19fb19a2416764f847d75] in testcase: boot compiler: gcc-12 test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G (please refer to attached dmesg/kmsg for entire log/backtrace) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <oliver.sang@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-lkp/202410071657.6db43df2-lkp@xxxxxxxxx [ 4.678777][ T65] WARNING: possible circular locking dependency detected [ 4.678777][ T65] 6.12.0-rc1-00018-g46c1b3279220 #1 Not tainted [ 4.678777][ T65] ------------------------------------------------------ [ 4.678777][ T65] modprobe/65 is trying to acquire lock: [ 4.678777][ T65] ffff9463c2b8e508 (&anon_vma->rwsem){+.+.}-{3:3}, at: vma_prepare (mm/vma.c:182) [ 4.678777][ T65] [ 4.678777][ T65] but task is already holding lock: [ 4.678777][ T65] ffff9463c62b4900 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: vma_prepare (mm/vma.c:168) [ 4.678777][ T65] [ 4.678777][ T65] which lock already depends on the new lock. [ 4.678777][ T65] [ 4.678777][ T65] the existing dependency chain (in reverse order) is: [ 4.678777][ T65] [ 4.678777][ T65] -> #2 (&mapping->i_mmap_rwsem){++++}-{3:3}: [ 4.678777][ T65] __lock_acquire (kernel/locking/lockdep.c:5202) [ 4.678777][ T65] lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5827 kernel/locking/lockdep.c:5790) [ 4.678777][ T65] down_write (arch/x86/include/asm/preempt.h:79 kernel/locking/rwsem.c:1325 kernel/locking/rwsem.c:1578) [ 4.678777][ T65] dma_resv_lockdep (include/linux/fs.h:517 drivers/dma-buf/dma-resv.c:795) [ 4.678777][ T65] do_one_initcall (init/main.c:1269) [ 4.678777][ T65] do_initcalls (init/main.c:1330 init/main.c:1347) [ 4.678777][ T65] kernel_init_freeable (init/main.c:1584) [ 4.678777][ T65] kernel_init (init/main.c:1471) [ 4.678777][ T65] ret_from_fork (arch/x86/kernel/process.c:147) [ 4.678777][ T65] ret_from_fork_asm (arch/x86/entry/entry_64.S:254) [ 4.678777][ T65] [ 4.678777][ T65] -> #1 (fs_reclaim){+.+.}-{0:0}: [ 4.678777][ T65] __lock_acquire (kernel/locking/lockdep.c:5202) [ 4.678777][ T65] lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5827 kernel/locking/lockdep.c:5790) [ 4.678777][ T65] fs_reclaim_acquire (mm/page_alloc.c:3835 mm/page_alloc.c:3848) [ 4.678777][ T65] __alloc_pages_noprof (include/linux/sched/mm.h:319 mm/page_alloc.c:4493 mm/page_alloc.c:4722) [ 4.678777][ T65] alloc_pages_mpol_noprof (mm/mempolicy.c:2267) [ 4.678777][ T65] __pud_alloc (include/asm-generic/pgalloc.h:175 include/asm-generic/pgalloc.h:195 mm/memory.c:6300) [ 4.678777][ T65] alloc_new_pud+0x158/0x180 [ 4.678777][ T65] move_page_tables (mm/mremap.c:581) [ 4.678777][ T65] relocate_vma_down (mm/mmap.c:2308) [ 4.678777][ T65] setup_arg_pages (fs/exec.c:811) [ 4.678777][ T65] load_elf_binary (fs/binfmt_elf.c:1177) [ 4.678777][ T65] search_binary_handler (fs/exec.c:1752) [ 4.678777][ T65] exec_binprm (fs/exec.c:1795) [ 4.678777][ T65] bprm_execve (fs/exec.c:1846 fs/exec.c:1821) [ 4.678777][ T65] kernel_execve (fs/exec.c:2012) [ 4.678777][ T65] call_usermodehelper_exec_async (kernel/umh.c:119) [ 4.678777][ T65] ret_from_fork (arch/x86/kernel/process.c:147) [ 4.678777][ T65] ret_from_fork_asm (arch/x86/entry/entry_64.S:254) [ 4.678777][ T65] [ 4.678777][ T65] -> #0 (&anon_vma->rwsem){+.+.}-{3:3}: [ 4.678777][ T65] check_prev_add (kernel/locking/lockdep.c:3162) [ 4.678777][ T65] validate_chain (kernel/locking/lockdep.c:3281 kernel/locking/lockdep.c:3904) [ 4.678777][ T65] __lock_acquire (kernel/locking/lockdep.c:5202) [ 4.678777][ T65] lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5827 kernel/locking/lockdep.c:5790) [ 4.678777][ T65] down_write (arch/x86/include/asm/preempt.h:79 kernel/locking/rwsem.c:1325 kernel/locking/rwsem.c:1578) [ 4.678777][ T65] vma_prepare (mm/vma.c:182) [ 4.678777][ T65] __split_vma (mm/vma.c:422) [ 4.678777][ T65] vma_modify (mm/vma.c:1435) [ 4.678777][ T65] vma_modify_flags (mm/vma.c:1452) [ 4.678777][ T65] mprotect_fixup (mm/mprotect.c:665) [ 4.678777][ T65] do_mprotect_pkey (mm/mprotect.c:839) [ 4.678777][ T65] __ia32_sys_mprotect (mm/mprotect.c:856) [ 4.678777][ T65] do_int80_emulation (arch/x86/entry/common.c:165 arch/x86/entry/common.c:253) [ 4.678777][ T65] asm_int80_emulation (arch/x86/include/asm/idtentry.h:626) [ 4.678777][ T65] [ 4.678777][ T65] other info that might help us debug this: [ 4.678777][ T65] [ 4.678777][ T65] Chain exists of: [ 4.678777][ T65] &anon_vma->rwsem --> fs_reclaim --> &mapping->i_mmap_rwsem [ 4.678777][ T65] [ 4.678777][ T65] Possible unsafe locking scenario: [ 4.678777][ T65] [ 4.678777][ T65] CPU0 CPU1 [ 4.678777][ T65] ---- ---- [ 4.678777][ T65] lock(&mapping->i_mmap_rwsem); [ 4.678777][ T65] lock(fs_reclaim); [ 4.678777][ T65] lock(&mapping->i_mmap_rwsem); [ 4.678777][ T65] lock(&anon_vma->rwsem); [ 4.678777][ T65] [ 4.678777][ T65] *** DEADLOCK *** [ 4.678777][ T65] [ 4.678777][ T65] 2 locks held by modprobe/65: [ 4.678777][ T65] #0: ffff9463c0050a70 (&mm->mmap_lock){++++}-{3:3}, at: do_mprotect_pkey (include/linux/mmap_lock.h:122 mm/mprotect.c:740) [ 4.678777][ T65] #1: ffff9463c62b4900 (&mapping->i_mmap_rwsem){++++}-{3:3}, at: vma_prepare (mm/vma.c:168) [ 4.678777][ T65] [ 4.678777][ T65] stack backtrace: [ 4.678777][ T65] CPU: 1 UID: 0 PID: 65 Comm: modprobe Not tainted 6.12.0-rc1-00018-g46c1b3279220 #1 [ 4.678777][ T65] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 [ 4.678777][ T65] Call Trace: [ 4.678777][ T65] <TASK> [ 4.678777][ T65] dump_stack_lvl (lib/dump_stack.c:123) [ 4.678777][ T65] print_circular_bug (kernel/locking/lockdep.c:2077) [ 4.678777][ T65] check_noncircular (kernel/locking/lockdep.c:2209) [ 4.678777][ T65] check_prev_add (kernel/locking/lockdep.c:3162) [ 4.678777][ T65] ? lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5827 kernel/locking/lockdep.c:5790) [ 4.678777][ T65] validate_chain (kernel/locking/lockdep.c:3281 kernel/locking/lockdep.c:3904) [ 4.678777][ T65] __lock_acquire (kernel/locking/lockdep.c:5202) [ 4.678777][ T65] lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5827 kernel/locking/lockdep.c:5790) [ 4.678777][ T65] ? vma_prepare (mm/vma.c:182) [ 4.678777][ T65] down_write (arch/x86/include/asm/preempt.h:79 kernel/locking/rwsem.c:1325 kernel/locking/rwsem.c:1578) [ 4.678777][ T65] ? vma_prepare (mm/vma.c:182) [ 4.678777][ T65] vma_prepare (mm/vma.c:182) [ 4.678777][ T65] __split_vma (mm/vma.c:422) [ 4.678777][ T65] vma_modify (mm/vma.c:1435) [ 4.678777][ T65] vma_modify_flags (mm/vma.c:1452) [ 4.678777][ T65] mprotect_fixup (mm/mprotect.c:665) [ 4.678777][ T65] do_mprotect_pkey (mm/mprotect.c:839) [ 4.678777][ T65] __ia32_sys_mprotect (mm/mprotect.c:856) [ 4.678777][ T65] do_int80_emulation (arch/x86/entry/common.c:165 arch/x86/entry/common.c:253) [ 4.678777][ T65] ? page_ext_get (include/linux/rcupdate.h:337 include/linux/rcupdate.h:849 mm/page_ext.c:525) [ 4.678777][ T65] ? kvm_sched_clock_read (arch/x86/kernel/kvmclock.c:91) [ 4.678777][ T65] ? local_clock_noinstr (kernel/sched/clock.c:270 kernel/sched/clock.c:306) [ 4.678777][ T65] ? local_clock (arch/x86/include/asm/preempt.h:94 kernel/sched/clock.c:316) [ 4.678777][ T65] ? __lock_release+0x13c/0x2c0 [ 4.678777][ T65] ? page_ext_put (include/linux/rcupdate.h:347 include/linux/rcupdate.h:880 mm/page_ext.c:550) [ 4.678777][ T65] ? kvm_sched_clock_read (arch/x86/kernel/kvmclock.c:91) [ 4.678777][ T65] ? local_clock_noinstr (kernel/sched/clock.c:270 kernel/sched/clock.c:306) [ 4.678777][ T65] ? local_clock (arch/x86/include/asm/preempt.h:94 kernel/sched/clock.c:316) [ 4.678777][ T65] ? __lock_release+0x13c/0x2c0 [ 4.678777][ T65] ? rcu_read_unlock (include/linux/rcupdate.h:347 (discriminator 9) include/linux/rcupdate.h:880 (discriminator 9)) [ 4.678777][ T65] ? rcu_read_unlock (include/linux/rcupdate.h:883 (discriminator 9)) [ 4.678777][ T65] ? wp_page_copy (mm/memory.c:3480) [ 4.678777][ T65] ? mark_usage (kernel/locking/lockdep.c:4650) [ 4.678777][ T65] ? __lock_acquire (kernel/locking/lockdep.c:5202) [ 4.678777][ T65] ? __lock_acquire (kernel/locking/lockdep.c:448 kernel/locking/lockdep.c:5190) [ 4.678777][ T65] ? lock_acquire (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5827 kernel/locking/lockdep.c:5790) [ 4.678777][ T65] ? kvm_sched_clock_read (arch/x86/kernel/kvmclock.c:91) [ 4.678777][ T65] ? local_clock_noinstr (kernel/sched/clock.c:270 kernel/sched/clock.c:306) [ 4.678777][ T65] ? local_clock (arch/x86/include/asm/preempt.h:94 kernel/sched/clock.c:316) [ 4.678777][ T65] ? __lock_release+0x13c/0x2c0 [ 4.678777][ T65] ? __ct_user_exit (kernel/context_tracking.c:627) [ 4.678777][ T65] ? vtime_user_exit (include/linux/seqlock.h:429 include/linux/seqlock.h:501 kernel/sched/cputime.c:738) [ 4.678777][ T65] ? trace_user_exit+0x10c/0x180 [ 4.678777][ T65] ? __ct_user_exit (kernel/context_tracking.c:627) [ 4.678777][ T65] ? trace_hardirqs_off_finish (include/trace/events/preemptirq.h:36 kernel/trace/trace_preemptirq.c:78) [ 4.678777][ T65] ? do_int80_emulation (arch/x86/include/asm/jump_label.h:27 arch/x86/entry/common.c:229) [ 4.678777][ T65] asm_int80_emulation (arch/x86/include/asm/idtentry.h:626) [ 4.678777][ T65] RIP: 0023:0xf7f125ed [ 4.678777][ T65] Code: 8b 7c 24 0c 50 e8 06 00 00 00 89 da 5b 5b 5f c3 8b 04 24 05 77 ec 04 00 8b 00 85 c0 74 06 50 8b 44 24 08 c3 8b 44 24 04 cd 80 <c3> 55 50 8b 6c 24 0c 8b 45 00 8b 6d 04 50 8b 44 24 04 e8 b9 ff ff All code ======== 0: 8b 7c 24 0c mov 0xc(%rsp),%edi 4: 50 push %rax 5: e8 06 00 00 00 call 0x10 a: 89 da mov %ebx,%edx c: 5b pop %rbx d: 5b pop %rbx e: 5f pop %rdi f: c3 ret 10: 8b 04 24 mov (%rsp),%eax 13: 05 77 ec 04 00 add $0x4ec77,%eax 18: 8b 00 mov (%rax),%eax 1a: 85 c0 test %eax,%eax 1c: 74 06 je 0x24 1e: 50 push %rax The kernel config and materials to reproduce are available at: https://download.01.org/0day-ci/archive/20241007/202410071657.6db43df2-lkp@xxxxxxxxx -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki