================================ WARNING: inconsistent lock state 5.15.156-syzkaller #0 Not tainted -------------------------------- inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage. syz-executor.1/4560 [HC1[1]:SC0[0]:HE0:SE1] takes: ffff8880b9b35bb8 (lock#10){?.+.}-{2:2}, at: local_lock_acquire+0xd/0x170 include/linux/local_lock_internal.h:28 {HARDIRQ-ON-W} state was registered at: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 local_lock_acquire+0x29/0x170 include/linux/local_lock_internal.h:29 __mmap_lock_do_trace_acquire_returned+0x7c/0x340 mm/mmap_lock.c:237 __mmap_lock_trace_acquire_returned include/linux/mmap_lock.h:36 [inline] mmap_read_trylock include/linux/mmap_lock.h:137 [inline] do_user_addr_fault arch/x86/mm/fault.c:1329 [inline] handle_page_fault arch/x86/mm/fault.c:1476 [inline] exc_page_fault+0x59c/0x740 arch/x86/mm/fault.c:1532 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:568 strncpy_from_user+0x170/0x370 lib/strncpy_from_user.c:139 strncpy_from_bpfptr include/linux/bpfptr.h:84 [inline] bpf_prog_load+0x185/0x1b60 kernel/bpf/syscall.c:2238 __sys_bpf+0x343/0x670 kernel/bpf/syscall.c:4651 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 irq event stamp: 28 hardirqs last enabled at (27): [] asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638 hardirqs last disabled at (28): [] sysvec_call_function_single+0xa/0xb0 arch/x86/kernel/smp.c:243 softirqs last enabled at (0): [] copy_process+0x13b9/0x3ef0 kernel/fork.c:2151 softirqs last disabled at (0): [<0000000000000000>] 0x0 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(lock#10); lock(lock#10); *** DEADLOCK *** 3 locks held by syz-executor.1/4560: #0: ffffffff8cea9358 (tomoyo_ss){....}-{0:0}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 #1: ffffffff8c91fb20 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:311 #2: ffff888011c6c728 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline] #2: ffff888011c6c728 (&mm->mmap_lock){++++}-{3:3}, at: stack_map_get_build_id_offset+0x23e/0x930 kernel/bpf/stackmap.c:185 stack backtrace: CPU: 1 PID: 4560 Comm: syz-executor.1 Not tainted 5.15.156-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 valid_state+0x134/0x1c0 kernel/locking/lockdep.c:3932 mark_lock_irq+0xa8/0xba0 kernel/locking/lockdep.c:4135 mark_lock+0x21a/0x340 kernel/locking/lockdep.c:4591 mark_usage kernel/locking/lockdep.c:4483 [inline] __lock_acquire+0xb5c/0x1ff0 kernel/locking/lockdep.c:4966 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 local_lock_acquire+0x29/0x170 include/linux/local_lock_internal.h:29 __mmap_lock_do_trace_acquire_returned+0x7c/0x340 mm/mmap_lock.c:237 __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+0x612/0x930 kernel/bpf/stackmap.c:185 __bpf_get_stack+0x495/0x570 kernel/bpf/stackmap.c:496 ____bpf_get_stack_raw_tp kernel/trace/bpf_trace.c:1490 [inline] bpf_get_stack_raw_tp+0x1b2/0x220 kernel/trace/bpf_trace.c:1480 bpf_prog_e6cf5f9c69743609+0x3a/0x954 bpf_dispatcher_nop_func include/linux/bpf.h:785 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline] bpf_trace_run2+0x19e/0x340 kernel/trace/bpf_trace.c:1917 trace_tlb_flush+0xed/0x110 include/trace/events/tlb.h:38 flush_tlb_func+0x480/0x590 arch/x86/mm/tlb.c:851 flush_smp_call_function_queue+0x2b5/0x760 kernel/smp.c:628 __sysvec_call_function_single+0x9a/0x250 arch/x86/kernel/smp.c:248 sysvec_call_function_single+0x89/0xb0 arch/x86/kernel/smp.c:243 asm_sysvec_call_function_single+0x16/0x20 arch/x86/include/asm/idtentry.h:646 RIP: 0010:orc_ip arch/x86/kernel/unwind_orc.c:30 [inline] RIP: 0010:__orc_find arch/x86/kernel/unwind_orc.c:52 [inline] RIP: 0010:orc_find arch/x86/kernel/unwind_orc.c:178 [inline] RIP: 0010:unwind_next_frame+0x524/0x1fa0 arch/x86/kernel/unwind_orc.c:448 Code: 29 f0 48 89 c1 48 c1 f9 02 48 c1 e8 3f 48 01 c8 48 83 e0 fe 49 8d 1c 46 48 89 d8 48 c1 e8 03 0f b6 04 10 84 c0 75 27 48 63 03 <48> 01 d8 48 8d 4b 04 4c 39 e8 4c 0f 46 f1 48 8d 43 fc 48 0f 47 e8 RSP: 0018:ffffc900048af6a8 EFLAGS: 00000246 RAX: fffffffff5b6091e RBX: ffffffff8e0d3b48 RCX: 0000000000000014 RDX: dffffc0000000000 RSI: ffffffff8e81ff54 RDI: ffffffff8e0d3b20 RBP: ffffffff8e0d3b70 R08: 0000000000000015 R09: ffffc900048af850 R10: 0000000000000000 R11: dffffc0000000001 R12: ffffffff8e0d3b20 R13: ffffffff83c344dc R14: ffffffff8e0d3b20 R15: ffffc900048af760 arch_stack_walk+0x10d/0x140 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x113/0x1c0 kernel/stacktrace.c:122 kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] __kmalloc+0x168/0x300 mm/slub.c:4407 kmalloc include/linux/slab.h:596 [inline] tomoyo_realpath_from_path+0xd8/0x5e0 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x225/0x810 security/tomoyo/file.c:723 security_file_ioctl+0x6d/0xa0 security/security.c:1555 __do_sys_ioctl fs/ioctl.c:868 [inline] __se_sys_ioctl+0x47/0x160 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fd3877d0c0b Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48 89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1c 48 8b 44 24 18 64 48 2b 04 25 28 00 00 RSP: 002b:00007fd385d430f0 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fd3877d0c0b RDX: 0000000000000000 RSI: 0000000000006364 RDI: 00000000000000d8 RBP: 00007fd3878fef80 R08: 0000000000000000 R09: 00007ffcba103207 R10: 0000000000000008 R11: 0000000000000246 R12: ffffffffffffffb0 R13: 000000000000000b R14: 00007ffcba103120 R15: 00007ffcba103208 ---------------- Code disassembly (best guess): 0: 29 f0 sub %esi,%eax 2: 48 89 c1 mov %rax,%rcx 5: 48 c1 f9 02 sar $0x2,%rcx 9: 48 c1 e8 3f shr $0x3f,%rax d: 48 01 c8 add %rcx,%rax 10: 48 83 e0 fe and $0xfffffffffffffffe,%rax 14: 49 8d 1c 46 lea (%r14,%rax,2),%rbx 18: 48 89 d8 mov %rbx,%rax 1b: 48 c1 e8 03 shr $0x3,%rax 1f: 0f b6 04 10 movzbl (%rax,%rdx,1),%eax 23: 84 c0 test %al,%al 25: 75 27 jne 0x4e 27: 48 63 03 movslq (%rbx),%rax * 2a: 48 01 d8 add %rbx,%rax <-- trapping instruction 2d: 48 8d 4b 04 lea 0x4(%rbx),%rcx 31: 4c 39 e8 cmp %r13,%rax 34: 4c 0f 46 f1 cmovbe %rcx,%r14 38: 48 8d 43 fc lea -0x4(%rbx),%rax 3c: 48 0f 47 e8 cmova %rax,%rbp