syzbot


inconsistent lock state in kernfs_path_from_node

Status: upstream: reported C repro on 2026/06/08 05:10
Reported-by: syzbot+0b2db953e598e71c5a7e@syzkaller.appspotmail.com
First crash: 1d07h, last: 1d04h
Similar bugs (2)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 inconsistent lock state in kernfs_path_from_node origin:lts-only 4 C error 21 1d00h 19d 0/3 upstream: reported C repro on 2026/05/20 14:09
linux-6.1 inconsistent lock state in kernfs_path_from_node 4 C 4 1d20h 10d 0/3 upstream: reported C repro on 2026/05/30 05:20

Sample crash report:
================================
WARNING: inconsistent lock state
syzkaller #0 Not tainted
--------------------------------
inconsistent {INITIAL USE} -> {IN-NMI} usage.
syz.0.17/5927 [HC1[1]:SC0[0]:HE0:SE1] takes:
ffffffff8d297c78 (kernfs_rename_lock){....}-{2:2}, at: kernfs_path_from_node+0x89/0xbb0 fs/kernfs/dir.c:229
{INITIAL USE} state was registered at:
  lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
  __raw_write_lock_irq include/linux/rwlock_api_smp.h:195 [inline]
  _raw_write_lock_irq+0xaf/0xf0 kernel/locking/spinlock.c:326
  kernfs_rename_ns+0x5d0/0x810 fs/kernfs/dir.c:1762
  sysfs_rename_link_ns+0x175/0x1b0 fs/sysfs/symlink.c:192
  device_rename+0x110/0x1e0 drivers/base/core.c:4597
  dev_change_name+0x307/0x8c0 net/core/dev.c:1291
  do_setlink+0x9fc/0x4130 net/core/rtnetlink.c:2889
  __rtnl_newlink net/core/rtnetlink.c:3707 [inline]
  rtnl_newlink+0x17da/0x20a0 net/core/rtnetlink.c:3754
  rtnetlink_rcv_msg+0x869/0xfa0 net/core/rtnetlink.c:6476
  netlink_rcv_skb+0x241/0x4d0 net/netlink/af_netlink.c:2545
  netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
  netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
  netlink_sendmsg+0x8d0/0xbf0 net/netlink/af_netlink.c:1894
  sock_sendmsg_nosec net/socket.c:730 [inline]
  __sock_sendmsg net/socket.c:745 [inline]
  __sys_sendto+0x4a9/0x6b0 net/socket.c:2200
  __do_sys_sendto net/socket.c:2212 [inline]
  __se_sys_sendto net/socket.c:2208 [inline]
  __x64_sys_sendto+0xde/0xf0 net/socket.c:2208
  do_syscall_x64 arch/x86/entry/common.c:46 [inline]
  do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
  entry_SYSCALL_64_after_hwframe+0x68/0xd2
irq event stamp: 3168
hardirqs last  enabled at (3167): [<ffffffff8a920546>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last  enabled at (3167): [<ffffffff8a920546>] _raw_spin_unlock_irqrestore+0x86/0x120 kernel/locking/spinlock.c:194
hardirqs last disabled at (3168): [<ffffffff8a8829a3>] exc_debug_kernel arch/x86/kernel/traps.c:1063 [inline]
hardirqs last disabled at (3168): [<ffffffff8a8829a3>] exc_debug+0x73/0x140 arch/x86/kernel/traps.c:1199
softirqs last  enabled at (3034): [<ffffffff88b56c1f>] netlink_insert+0x109f/0x13a0 net/netlink/af_netlink.c:589
softirqs last disabled at (3032): [<ffffffff8873073f>] spin_lock_bh include/linux/spinlock.h:356 [inline]
softirqs last disabled at (3032): [<ffffffff8873073f>] release_sock+0x2f/0x1c0 net/core/sock.c:3548

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

       CPU0
       ----
  lock(kernfs_rename_lock);
  <Interrupt>
    lock(kernfs_rename_lock);

 *** DEADLOCK ***

no locks held by syz.0.17/5927.

stack backtrace:
CPU: 0 PID: 5927 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/18/2026
Call Trace:
 <#DB>
 dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
 lock_acquire+0x2c2/0x420 kernel/locking/lockdep.c:5745
 __raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline]
 _raw_read_lock_irqsave+0xbc/0x100 kernel/locking/spinlock.c:236
 kernfs_path_from_node+0x89/0xbb0 fs/kernfs/dir.c:229
 kernfs_path include/linux/kernfs.h:597 [inline]
 cgroup_path include/linux/cgroup.h:601 [inline]
 get_mm_memcg_path+0xb9/0x360 mm/mmap_lock.c:82
 __mmap_lock_do_trace_acquire_returned+0xea/0x300 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:166 [inline]
 stack_map_get_build_id_offset+0x5f2/0x720 kernel/bpf/stackmap.c:141
 __bpf_get_stackid+0x55c/0x900 kernel/bpf/stackmap.c:247
 bpf_prog_12712c88fd19bd5b+0x29/0x2d
 bpf_dispatcher_nop_func include/linux/bpf.h:1224 [inline]
 __bpf_prog_run include/linux/filter.h:616 [inline]
 bpf_prog_run include/linux/filter.h:623 [inline]
 bpf_overflow_handler+0x1fc/0x510 kernel/events/core.c:10584
 __perf_event_overflow+0x447/0x630 kernel/events/core.c:9720
 perf_swevent_overflow kernel/events/core.c:9803 [inline]
 perf_swevent_event+0x319/0x570 kernel/events/core.c:9854
 perf_bp_event+0x319/0x430 kernel/events/core.c:10781
 hw_breakpoint_handler arch/x86/kernel/hw_breakpoint.c:555 [inline]
 hw_breakpoint_exceptions_notify+0x23e/0x670 arch/x86/kernel/hw_breakpoint.c:586
 notifier_call_chain+0x197/0x380 kernel/notifier.c:93
 atomic_notifier_call_chain+0xda/0x180 kernel/notifier.c:231
 notify_die+0x145/0x1a0 kernel/notifier.c:596
 notify_debug+0x2e/0x50 arch/x86/kernel/traps.c:1042
 exc_debug_kernel arch/x86/kernel/traps.c:1099 [inline]
 exc_debug+0xde/0x140 arch/x86/kernel/traps.c:1199
 asm_exc_debug+0x1e/0x40 arch/x86/include/asm/idtentry.h:644
RIP: 0010:rep_movs_alternative+0x4a/0x90 arch/x86/lib/copy_user_64.S:71
Code: 75 f1 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 8b 06 48 89 07 48 83 c6 08 48 83 c7 08 83 e9 08 74 df 83 f9 08 73 e8 eb c9 <f3> a4 c3 48 8b 06 48 89 07 48 8d 47 08 48 83 e0 f8 48 29 f8 48 01
RSP: 0018:ffffc9000478f798 EFLAGS: 00050206
RAX: ffffffff84284301 RBX: 0000000000033fe0 RCX: 0000000000033d00
RDX: 0000000000000001 RSI: 0000200000000320 RDI: ffffc900033392e0
RBP: ffffc9000478f8f0 R08: ffffc9000336cfdf R09: 1ffff9200066d9fb
R10: dffffc0000000000 R11: fffff5200066d9fc R12: ffffc90003339000
R13: 0000200000000040 R14: ffffc9000478fe38 R15: 1ffff920008f1fc7
 </#DB>
 <TASK>
 copy_user_generic arch/x86/include/asm/uaccess_64.h:112 [inline]
 raw_copy_from_user arch/x86/include/asm/uaccess_64.h:127 [inline]
 copyin lib/iov_iter.c:193 [inline]
 _copy_from_iter+0x24e/0x12e0 lib/iov_iter.c:390
 copy_from_iter include/linux/uio.h:209 [inline]
 copy_from_iter_full include/linux/uio.h:216 [inline]
 memcpy_from_msg include/linux/skbuff.h:4109 [inline]
 netlink_sendmsg+0x76b/0xbf0 net/netlink/af_netlink.c:1879
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x5ba/0x960 net/socket.c:2594
 ___sys_sendmsg+0x2a6/0x360 net/socket.c:2648
 __sys_sendmsg net/socket.c:2677 [inline]
 __do_sys_sendmsg net/socket.c:2686 [inline]
 __se_sys_sendmsg+0x1c2/0x2b0 net/socket.c:2684
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f10fdb9ce59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff03061e48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f10fde15fa0 RCX: 00007f10fdb9ce59
RDX: 0000000000000000 RSI: 0000200000000000 RDI: 0000000000000007
RBP: 00007f10fdc32d6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f10fde15fac R14: 00007f10fde15fa0 R15: 00007f10fde15fa0
 </TASK>
----------------
Code disassembly (best guess):
   0:	75 f1                	jne    0xfffffff3
   2:	c3                   	ret
   3:	66 2e 0f 1f 84 00 00 	cs nopw 0x0(%rax,%rax,1)
   a:	00 00 00
   d:	0f 1f 00             	nopl   (%rax)
  10:	48 8b 06             	mov    (%rsi),%rax
  13:	48 89 07             	mov    %rax,(%rdi)
  16:	48 83 c6 08          	add    $0x8,%rsi
  1a:	48 83 c7 08          	add    $0x8,%rdi
  1e:	83 e9 08             	sub    $0x8,%ecx
  21:	74 df                	je     0x2
  23:	83 f9 08             	cmp    $0x8,%ecx
  26:	73 e8                	jae    0x10
  28:	eb c9                	jmp    0xfffffff3
* 2a:	f3 a4                	rep movsb %ds:(%rsi),%es:(%rdi) <-- trapping instruction
  2c:	c3                   	ret
  2d:	48 8b 06             	mov    (%rsi),%rax
  30:	48 89 07             	mov    %rax,(%rdi)
  33:	48 8d 47 08          	lea    0x8(%rdi),%rax
  37:	48 83 e0 f8          	and    $0xfffffffffffffff8,%rax
  3b:	48 29 f8             	sub    %rdi,%rax
  3e:	48                   	rex.W
  3f:	01                   	.byte 0x1

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/06/08 08:12 linux-6.6.y 924b4a879cbb cc095639 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf inconsistent lock state in kernfs_path_from_node
2026/06/08 05:09 linux-6.6.y 924b4a879cbb cc095639 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf inconsistent lock state in kernfs_path_from_node
* Struck through repros no longer work on HEAD.