syzbot


possible deadlock in try_to_wake_up (2)

Status: upstream: reported C repro on 2024/05/09 05:15
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+d45a6d183cbf07c291d8@syzkaller.appspotmail.com
First crash: 37d, last: 45m
Bug presence (1)
Date Name Commit Repro Result
2024/05/09 upstream (ToT) 45db3ab70092 C [report] inconsistent lock state in valid_state
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in try_to_wake_up C done 1 80d 80d 3/3 fixed on 2024/04/29 07:11
linux-5.15 possible deadlock in try_to_wake_up origin:upstream C 6 3d18h 71d 0/3 upstream: reported C repro on 2024/04/05 17:03
upstream possible deadlock in try_to_wake_up (2) mm 1 636d 632d 0/27 auto-obsoleted due to no activity on 2023/01/16 12:10
upstream possible deadlock in try_to_wake_up (4) bpf net C error 19 26d 89d 26/27 fixed on 2024/05/22 23:36
upstream possible deadlock in try_to_wake_up (5) mm 3 11d 16d 0/27 upstream: reported on 2024/05/30 18:36
upstream possible deadlock in try_to_wake_up (3) net 103 241d 251d 0/27 auto-obsoleted due to no activity on 2023/11/27 02:05
upstream possible deadlock in try_to_wake_up mm 39 1979d 2011d 0/27 auto-closed as invalid on 2019/07/13 09:55

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.90-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor172/3561 is trying to acquire lock:
ffff88813fedc598 (&p->pi_lock){-.-.}-{2:2}, at: try_to_wake_up+0xad/0x12e0 kernel/sched/core.c:4112

but task is already holding lock:
ffff8880b9835e90 (lock#9){+.+.}-{2:2}, at: local_lock_acquire include/linux/local_lock_internal.h:29 [inline]
ffff8880b9835e90 (lock#9){+.+.}-{2:2}, at: __mmap_lock_do_trace_acquire_returned+0x84/0x670 mm/mmap_lock.c:237

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (lock#9){+.+.}-{2:2}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       local_lock_acquire include/linux/local_lock_internal.h:29 [inline]
       __mmap_lock_do_trace_acquire_returned+0x9d/0x670 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+0x99e/0x9c0 kernel/bpf/stackmap.c:144
       __bpf_get_stack+0x495/0x570 kernel/bpf/stackmap.c:452
       ____bpf_get_stack_raw_tp kernel/trace/bpf_trace.c:1877 [inline]
       bpf_get_stack_raw_tp+0x1b2/0x220 kernel/trace/bpf_trace.c:1867
       bpf_prog_29a9b850630374f8+0xa/0x25
       bpf_dispatcher_nop_func include/linux/bpf.h:989 [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:2273 [inline]
       bpf_trace_run2+0x1fd/0x410 kernel/trace/bpf_trace.c:2312
       trace_tlb_flush+0x151/0x1a0 include/trace/events/tlb.h:38
       switch_mm_irqs_off+0x84a/0xc20
       context_switch kernel/sched/core.c:5230 [inline]
       __schedule+0x1140/0x4550 kernel/sched/core.c:6558
       preempt_schedule_common+0x83/0xd0 kernel/sched/core.c:6727
       preempt_schedule+0xd9/0xe0 kernel/sched/core.c:6751
       preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:34
       __raw_spin_unlock include/linux/spinlock_api_smp.h:143 [inline]
       _raw_spin_unlock+0x36/0x40 kernel/locking/spinlock.c:186
       spin_unlock include/linux/spinlock.h:391 [inline]
       __text_poke+0x81a/0x9a0 arch/x86/kernel/alternative.c:1216
       text_poke_copy+0x65/0x90 arch/x86/kernel/alternative.c:1289
       bpf_arch_text_copy+0x21/0x40 arch/x86/net/bpf_jit_comp.c:2517
       bpf_jit_binary_pack_finalize+0x36/0x80 kernel/bpf/core.c:1135
       bpf_int_jit_compile+0xbdf3/0xca80 arch/x86/net/bpf_jit_comp.c:2473
       bpf_prog_select_runtime+0x86d/0xb40 kernel/bpf/core.c:2213
       bpf_prog_load+0x1348/0x1bb0 kernel/bpf/syscall.c:2635
       __sys_bpf+0x382/0x6c0 kernel/bpf/syscall.c:5005
       __do_sys_bpf kernel/bpf/syscall.c:5109 [inline]
       __se_sys_bpf kernel/bpf/syscall.c:5107 [inline]
       __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5107
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (&rq->__lock){-.-.}-{2:2}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       _raw_spin_lock_nested+0x2d/0x40 kernel/locking/spinlock.c:378
       raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:537
       raw_spin_rq_lock kernel/sched/sched.h:1354 [inline]
       rq_lock kernel/sched/sched.h:1644 [inline]
       task_fork_fair+0x5d/0x350 kernel/sched/fair.c:11869
       sched_cgroup_fork+0x374/0x400 kernel/sched/core.c:4686
       copy_process+0x2442/0x4060 kernel/fork.c:2384
       kernel_clone+0x222/0x920 kernel/fork.c:2682
       user_mode_thread+0x12e/0x190 kernel/fork.c:2758
       rest_init+0x23/0x300 init/main.c:699
       start_kernel+0x0/0x53f init/main.c:894
       start_kernel+0x496/0x53f init/main.c:1141
       secondary_startup_64_no_verify+0xcf/0xdb

-> #0 (&p->pi_lock){-.-.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
       try_to_wake_up+0xad/0x12e0 kernel/sched/core.c:4112
       rcu_read_unlock_special+0x3d2/0x540 kernel/rcu/tree_plugin.h:655
       __rcu_read_unlock+0x92/0x100 kernel/rcu/tree_plugin.h:426
       rcu_read_unlock include/linux/rcupdate.h:823 [inline]
       put_memcg_path_buf+0xde/0x110 mm/mmap_lock.c:153
       __mmap_lock_do_trace_acquire_returned+0x1f7/0x670 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]
       get_mmap_lock_carefully mm/memory.c:5304 [inline]
       lock_mm_and_find_vma+0x219/0x2e0 mm/memory.c:5366
       do_user_addr_fault arch/x86/mm/fault.c:1343 [inline]
       handle_page_fault arch/x86/mm/fault.c:1462 [inline]
       exc_page_fault+0x169/0x660 arch/x86/mm/fault.c:1518
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570

other info that might help us debug this:

Chain exists of:
  &p->pi_lock --> &rq->__lock --> lock#9

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(lock#9);
                               lock(&rq->__lock);
                               lock(lock#9);
  lock(&p->pi_lock);

 *** DEADLOCK ***

3 locks held by syz-executor172/3561:
 #0: ffff8880289588d8 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_trylock include/linux/mmap_lock.h:136 [inline]
 #0: ffff8880289588d8 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully mm/memory.c:5304 [inline]
 #0: ffff8880289588d8 (&mm->mmap_lock){++++}-{3:3}, at: lock_mm_and_find_vma+0x2e/0x2e0 mm/memory.c:5366
 #1: ffff8880b9835e90 (lock#9){+.+.}-{2:2}, at: local_lock_acquire include/linux/local_lock_internal.h:29 [inline]
 #1: ffff8880b9835e90 (lock#9){+.+.}-{2:2}, at: __mmap_lock_do_trace_acquire_returned+0x84/0x670 mm/mmap_lock.c:237
 #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: get_memcg_path_buf mm/mmap_lock.c:139 [inline]
 #2: ffffffff8d12ac80 (rcu_read_lock){....}-{1:2}, at: get_mm_memcg_path+0xb1/0x600 mm/mmap_lock.c:209

stack backtrace:
CPU: 0 PID: 3561 Comm: syz-executor172 Not tainted 6.1.90-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
 try_to_wake_up+0xad/0x12e0 kernel/sched/core.c:4112
 rcu_read_unlock_special+0x3d2/0x540 kernel/rcu/tree_plugin.h:655
 __rcu_read_unlock+0x92/0x100 kernel/rcu/tree_plugin.h:426
 rcu_read_unlock include/linux/rcupdate.h:823 [inline]
 put_memcg_path_buf+0xde/0x110 mm/mmap_lock.c:153
 __mmap_lock_do_trace_acquire_returned+0x1f7/0x670 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]
 get_mmap_lock_carefully mm/memory.c:5304 [inline]
 lock_mm_and_find_vma+0x219/0x2e0 mm/memory.c:5366
 do_user_addr_fault arch/x86/mm/fault.c:1343 [inline]
 handle_page_fault arch/x86/mm/fault.c:1462 [inline]
 exc_page_fault+0x169/0x660 arch/x86/mm/fault.c:1518
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0033:0x7f68ca1ea3df
Code: 00 00 00 0f 1f 84 00 00 00 00 00 c5 f9 6e c6 89 f8 25 ff 0f 00 00 c4 e2 7d 78 c0 c5 f1 ef c9 3d e0 0f 00 00 0f 87 91 01 00 00 <c5> fe 6f 17 c5 fd 74 da c5 f5 74 d2 c5 ed eb db c5 fd d7 c3 85 c0
RSP: 002b:00007ffd2fb9c998 EFLAGS: 00010283
RAX: 000000000000001d RBX: 00007ffd2fb9cf00 RCX: 0000000000000000
RDX: 00007ffd2fb9d088 RSI: 0000000000000025 RDI: 00007f68ca24001d
RBP: 00000000fbad8001 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f68ca24001d
R13: 00007ffd2fb9d088 R14: 0000000000000000 R15: 00007ffd2fb9cf00
 </TASK>

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/09 05:15 linux-6.1.y 909ba1f1b414 20bf80e1 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
2024/06/15 17:52 linux-6.1.y ae9f2a70d69e f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
2024/06/15 08:05 linux-6.1.y ae9f2a70d69e f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
2024/06/15 08:04 linux-6.1.y ae9f2a70d69e f429ab00 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
2024/06/10 14:42 linux-6.1.y 88690811da69 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
2024/06/10 14:42 linux-6.1.y 88690811da69 048c640a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
2024/06/03 21:47 linux-6.1.y 88690811da69 a1feae05 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
2024/05/23 08:38 linux-6.1.y 4078fa637fcd 4c2072ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-perf possible deadlock in try_to_wake_up
* Struck through repros no longer work on HEAD.