syzbot


possible deadlock in kernfs_path_from_node

Status: upstream: reported C repro on 2024/09/12 01:20
Subsystems: kernfs
[Documentation on labels]
Reported-by: syzbot+0772686ab2731ef3b722@syzkaller.appspotmail.com
First crash: 74d, last: 74d
Cause bisection: failed (error log, bisect log)
  
Fix bisection: fixed by (bisect log) :
commit b6273b55d88539c6a7127a697c61d3f89c5831fe
Author: Takaya Saeki <takayas@chromium.org>
Date: Tue Aug 13 10:03:12 2024 +0000

  filemap: add trace events for get_pages, map_pages, and fault

  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [kernfs?] possible deadlock in kernfs_path_from_node 0 (2) 2024/10/13 12:09
Last patch testing requests (4)
Created Duration User Patch Repo Result
2024/09/22 05:35 23m retest repro bpf-next OK log
2024/09/22 05:35 38m retest repro bpf-next OK log
2024/09/22 05:35 23m retest repro bpf-next OK log
2024/09/22 05:35 23m retest repro bpf-next OK log

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.11.0-rc4-syzkaller-00280-g8a3f14bb1e94 #0 Not tainted
--------------------------------------------
syz-executor106/5235 is trying to acquire lock:
ffffffff8eab6458 (kernfs_rename_lock){.-.-}-{2:2}, at: kernfs_path_from_node+0x92/0xb00 fs/kernfs/dir.c:229

but task is already holding lock:
ffffffff8eab6458 (kernfs_rename_lock){.-.-}-{2:2}, at: kernfs_path_from_node+0x92/0xb00 fs/kernfs/dir.c:229

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

2 locks held by syz-executor106/5235:
 #0: ffffffff8eab6458 (kernfs_rename_lock){.-.-}-{2:2}, at: kernfs_path_from_node+0x92/0xb00 fs/kernfs/dir.c:229
 #1: ffffffff8e938320 (rcu_read_lock){....}-{1:2}, at: trace_call_bpf+0xbc/0x8a0

stack backtrace:
CPU: 1 UID: 0 PID: 5235 Comm: syz-executor106 Not tainted 6.11.0-rc4-syzkaller-00280-g8a3f14bb1e94 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 check_deadlock kernel/locking/lockdep.c:3061 [inline]
 validate_chain+0x15d3/0x5900 kernel/locking/lockdep.c:3855
 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline]
 _raw_read_lock_irqsave+0xdd/0x130 kernel/locking/spinlock.c:236
 kernfs_path_from_node+0x92/0xb00 fs/kernfs/dir.c:229
 kernfs_path include/linux/kernfs.h:598 [inline]
 cgroup_path include/linux/cgroup.h:598 [inline]
 get_mm_memcg_path+0xb9/0x380 mm/mmap_lock.c:82
 __mmap_lock_do_trace_start_locking+0x9c/0x2f0 mm/mmap_lock.c:95
 __mmap_lock_trace_start_locking include/linux/mmap_lock.h:29 [inline]
 mmap_read_trylock include/linux/mmap_lock.h:162 [inline]
 stack_map_get_build_id_offset+0x98a/0x9d0 kernel/bpf/stackmap.c:141
 __bpf_get_stack+0x4ad/0x5a0 kernel/bpf/stackmap.c:449
 bpf_prog_e6cf5f9c69743609+0x43/0x47
 bpf_dispatcher_nop_func include/linux/bpf.h:1254 [inline]
 __bpf_prog_run include/linux/filter.h:701 [inline]
 bpf_prog_run include/linux/filter.h:708 [inline]
 bpf_prog_run_array include/linux/bpf.h:2120 [inline]
 trace_call_bpf+0x369/0x8a0 kernel/trace/bpf_trace.c:146
 perf_trace_run_bpf_submit+0x82/0x180 kernel/events/core.c:10304
 perf_trace_lock+0x388/0x490 include/trace/events/lock.h:50
 trace_lock_release include/trace/events/lock.h:69 [inline]
 lock_release+0x9cc/0xa30 kernel/locking/lockdep.c:5770
 __raw_read_unlock_irqrestore include/linux/rwlock_api_smp.h:239 [inline]
 _raw_read_unlock_irqrestore+0x79/0x140 kernel/locking/spinlock.c:268
 kernfs_path_from_node+0x235/0xb00 fs/kernfs/dir.c:231
 kernfs_path include/linux/kernfs.h:598 [inline]
 cgroup_path include/linux/cgroup.h:598 [inline]
 get_mm_memcg_path+0xb9/0x380 mm/mmap_lock.c:82
 __mmap_lock_do_trace_start_locking+0x9c/0x2f0 mm/mmap_lock.c:95
 __mmap_lock_trace_start_locking include/linux/mmap_lock.h:29 [inline]
 mmap_read_lock include/linux/mmap_lock.h:143 [inline]
 acct_collect+0x7e7/0x830 kernel/acct.c:563
 do_exit+0x93e/0x27f0 kernel/exit.c:861
 do_group_exit+0x207/0x2c0 kernel/exit.c:1031
 __do_sys_exit_group kernel/exit.c:1042 [inline]
 __se_sys_exit_group kernel/exit.c:1040 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1040
 x64_sys_call+0x2634/0x2640 arch/x86/include/generated/asm/syscalls_64.h:232
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fc493637139
Code: 90 49 c7 c0 b8 ff ff ff be e7 00 00 00 ba 3c 00 00 00 eb 12 0f 1f 44 00 00 89 d0 0f 05 48 3d 00 f0 ff ff 77 1c f4 89 f0 0f 05 <48> 3d 00 f0 ff ff 76 e7 f7 d8 64 41 89 00 eb df 0f 1f 80 00 00 00
RSP: 002b:00007ffebc5ae538 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc493637139
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 00007fc4936b22b0 R08: ffffffffffffffb8 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc4936b22b0
R13: 0000000000000000 R14: 00007fc4936b2d20 R15: 00007fc4936082f0
 </TASK>

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/08 05:29 bpf-next 8a3f14bb1e94 9750182a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in kernfs_path_from_node
2024/09/08 04:24 bpf-next 8a3f14bb1e94 9750182a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in kernfs_path_from_node
2024/09/08 03:23 bpf-next 8a3f14bb1e94 9750182a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in kernfs_path_from_node
2024/09/08 02:18 bpf-next 8a3f14bb1e94 9750182a .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in kernfs_path_from_node
2024/09/08 01:14 bpf-next 8a3f14bb1e94 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-bpf-next-kasan-gce possible deadlock in kernfs_path_from_node
* Struck through repros no longer work on HEAD.