[v6.1] possible deadlock in kernfs_path_from_node

1 view
Skip to first unread message

syzbot

unread,
Oct 5, 2025, 7:40:35 PM (6 days ago) Oct 5
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 882efbdd9d34 Linux 6.1.155
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1165dee2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=7eb38bd5021fec61
dashboard link: https://syzkaller.appspot.com/bug?extid=18eb478943431ff9dcf2
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14f9c304580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=111495cd980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/92dcc467d133/disk-882efbdd.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/9b1ac6d1ee0e/vmlinux-882efbdd.xz
kernel image: https://storage.googleapis.com/syzbot-assets/afb3b2815837/bzImage-882efbdd.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+18eb47...@syzkaller.appspotmail.com

============================================
WARNING: possible recursive locking detected
syzkaller #0 Not tainted
--------------------------------------------
syz-execprog/4267 is trying to acquire lock:
ffffffff8cc81038 (kernfs_rename_lock){..-.}-{2:2}, at: kernfs_path_from_node+0x87/0xd10 fs/kernfs/dir.c:232

but task is already holding lock:
ffffffff8cc81038 (kernfs_rename_lock){..-.}-{2:2}, at: kernfs_path_from_node+0x87/0xd10 fs/kernfs/dir.c:232

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(kernfs_rename_lock);
lock(kernfs_rename_lock);

*** DEADLOCK ***

May be due to missing lock nesting notation

4 locks held by syz-execprog/4267:
#0: ffff88801db2f958 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
#0: ffff88801db2f958 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5322 [inline]
#0: ffff88801db2f958 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x2e/0x2f0 mm/memory.c:5384
#1: ffffffff8cc81038 (kernfs_rename_lock){..-.}-{2:2}, at: kernfs_path_from_node+0x87/0xd10 fs/kernfs/dir.c:232
#2: ffffffff8cb2abe0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
#2: ffffffff8cb2abe0 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
#2: ffffffff8cb2abe0 (rcu_read_lock){....}-{1:2}, at: __bpf_trace_run kernel/trace/bpf_trace.c:2284 [inline]
#2: ffffffff8cb2abe0 (rcu_read_lock){....}-{1:2}, at: bpf_trace_run2+0xda/0x3b0 kernel/trace/bpf_trace.c:2324
#3: ffff88801db2f958 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
#3: ffff88801db2f958 (&mm->mmap_lock){++++}-{3:3}, at: stack_map_get_build_id_offset+0x1fd/0x9c0 kernel/bpf/stackmap.c:144

stack backtrace:
CPU: 1 PID: 4267 Comm: syz-execprog Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
<TASK>
dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
__lock_acquire+0x122f/0x7c50 kernel/locking/lockdep.c:-1
lock_acquire+0x1b4/0x490 kernel/locking/lockdep.c:5662
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0xa4/0xf0 kernel/locking/spinlock.c:162
kernfs_path_from_node+0x87/0xd10 fs/kernfs/dir.c:232
kernfs_path include/linux/kernfs.h:595 [inline]
cgroup_path include/linux/cgroup.h:674 [inline]
get_mm_memcg_path+0xb9/0x360 mm/mmap_lock.c:82
__mmap_lock_do_trace_acquire_returned+0x9b/0x330 mm/mmap_lock.c:102
__mmap_lock_trace_acquire_returned include/linux/mmap_lock.h:36 [inline]
mmap_read_trylock include/linux/mmap_lock.h:137 [inline]
stack_map_get_build_id_offset+0x68d/0x9c0 kernel/bpf/stackmap.c:144
__bpf_get_stack+0x44d/0x4f0 kernel/bpf/stackmap.c:452
____bpf_get_stack_raw_tp kernel/trace/bpf_trace.c:1880 [inline]
bpf_get_stack_raw_tp+0x189/0x1c0 kernel/trace/bpf_trace.c:1870
bpf_prog_ec3b2eefa702d8d3+0x3a/0x3e
bpf_dispatcher_nop_func include/linux/bpf.h:1011 [inline]
__bpf_prog_run include/linux/filter.h:603 [inline]
bpf_prog_run include/linux/filter.h:610 [inline]
__bpf_trace_run kernel/trace/bpf_trace.c:2285 [inline]
bpf_trace_run2+0x1cd/0x3b0 kernel/trace/bpf_trace.c:2324
trace_contention_end+0x13f/0x190 include/trace/events/lock.h:122
__pv_queued_spin_lock_slowpath+0x7e8/0x9c0 kernel/locking/qspinlock.c:560
pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
queued_spin_lock_slowpath+0x43/0x50 arch/x86/include/asm/qspinlock.h:51
queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
do_raw_spin_lock+0x217/0x280 kernel/locking/spinlock_debug.c:115
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
_raw_spin_lock_irqsave+0xb0/0xf0 kernel/locking/spinlock.c:162
kernfs_path_from_node+0x87/0xd10 fs/kernfs/dir.c:232
kernfs_path include/linux/kernfs.h:595 [inline]
cgroup_path include/linux/cgroup.h:674 [inline]
get_mm_memcg_path+0xb9/0x360 mm/mmap_lock.c:82
__mmap_lock_do_trace_acquire_returned+0x9b/0x330 mm/mmap_lock.c:102
__mmap_lock_trace_acquire_returned include/linux/mmap_lock.h:36 [inline]
mmap_read_trylock include/linux/mmap_lock.h:137 [inline]
get_mmap_lock_carefully mm/memory.c:5322 [inline]
lock_mm_and_find_vma+0x21f/0x2f0 mm/memory.c:5384
do_user_addr_fault+0x2db/0xb10 arch/x86/mm/fault.c:1312
handle_page_fault arch/x86/mm/fault.c:1431 [inline]
exc_page_fault+0x60/0x100 arch/x86/mm/fault.c:1487
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:608
RIP: 0033:0x47efab
Code: 1f f8 c3 f3 44 0f 7f 3f f3 44 0f 7f 7c 1f f0 c3 f3 44 0f 7f 3f f3 44 0f 7f 7f 10 f3 44 0f 7f 7c 1f e0 f3 44 0f 7f 7c 1f f0 c3 <f3> 44 0f 7f 3f f3 44 0f 7f 7f 10 f3 44 0f 7f 7f 20 f3 44 0f 7f 7f
RSP: 002b:000000c004055248 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000080 RCX: 0000000000000010
RDX: 000000c0085a1f80 RSI: 0000000000000000 RDI: 000000c0085a1f80
RBP: 000000c004055260 R08: 0000000000000001 R09: 000000c0085a0000
R10: 0000000000000001 R11: 00007f2c9ac7d000 R12: 000000000002bf00
R13: 0000000000000016 R14: 000000c004030e00 R15: 0000000000000000
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages