syzbot


possible deadlock in task_fork_fair

Status: auto-obsoleted due to no activity on 2024/01/09 18:17
Reported-by: syzbot+33f08371df33493cf06e@syzkaller.appspotmail.com
First crash: 198d, last: 198d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in task_fork_fair C 59 5d14h 64d 0/3 upstream: reported C repro on 2024/02/11 15:37
upstream possible deadlock in task_fork_fair bpf C done 8605 4h01m 190d 0/26 upstream: reported C repro on 2023/10/08 06:28
linux-5.15 possible deadlock in task_fork_fair (2) C 41 5d08h 53d 0/3 upstream: reported C repro on 2024/02/22 05:55

Sample crash report:
FAULT_INJECTION: forcing a failure.
name fail_page_alloc, interval 1, probability 0, space 0, times 1
======================================================
WARNING: possible circular locking dependency detected
5.15.133-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/25630 is trying to acquire lock:
ffffffff8c7fb8d8 ((console_sem).lock){-.-.}-{2:2}, at: down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138

but task is already holding lock:
ffff8880b9a39718 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0xa8/0x140 kernel/sched/core.c:483

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&rq->__lock){-.-.}-{2:2}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       _raw_spin_lock_nested+0x2d/0x40 kernel/locking/spinlock.c:368
       raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:475
       raw_spin_rq_lock kernel/sched/sched.h:1326 [inline]
       rq_lock kernel/sched/sched.h:1621 [inline]
       task_fork_fair+0x5d/0x350 kernel/sched/fair.c:11494
       sched_cgroup_fork+0x2d3/0x330 kernel/sched/core.c:4462
       copy_process+0x224a/0x3ef0 kernel/fork.c:2320
       kernel_clone+0x210/0x960 kernel/fork.c:2604
       kernel_thread+0x168/0x1e0 kernel/fork.c:2656
       rest_init+0x21/0x330 init/main.c:699
       start_kernel+0x48c/0x535 init/main.c:1133
       secondary_startup_64_no_verify+0xb1/0xbb

-> #1 (&p->pi_lock){-.-.}-{2:2}:
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       __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+0xae/0x1300 kernel/sched/core.c:4026
       up+0x6e/0x90 kernel/locking/semaphore.c:190
       __up_console_sem+0x11a/0x1e0 kernel/printk/printk.c:256
       console_unlock+0x1145/0x12b0 kernel/printk/printk.c:2754
       vprintk_emit+0xbf/0x150 kernel/printk/printk.c:2268
       _printk+0xd1/0x111 kernel/printk/printk.c:2293
       kauditd_printk_skb kernel/audit.c:538 [inline]
       kauditd_hold_skb+0x1b5/0x200 kernel/audit.c:573
       kauditd_send_queue+0x2a3/0x2f0 kernel/audit.c:758
       kauditd_thread+0x6fb/0xae0 kernel/audit.c:882
       kthread+0x3f6/0x4f0 kernel/kthread.c:319
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

-> #0 ((console_sem).lock){-.-.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3053 [inline]
       check_prevs_add kernel/locking/lockdep.c:3172 [inline]
       validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
       __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
       lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
       down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138
       __down_trylock_console_sem+0x105/0x250 kernel/printk/printk.c:239
       console_trylock kernel/printk/printk.c:2569 [inline]
       console_trylock_spinning+0x8a/0x3f0 kernel/printk/printk.c:1867
       vprintk_emit+0xa6/0x150 kernel/printk/printk.c:2267
       _printk+0xd1/0x111 kernel/printk/printk.c:2293
       fail_dump lib/fault-inject.c:45 [inline]
       should_fail+0x36c/0x4c0 lib/fault-inject.c:146
       prepare_alloc_pages+0x1db/0x5b0 mm/page_alloc.c:5198
       __alloc_pages+0x14f/0x700 mm/page_alloc.c:5410
       stack_depot_save+0x319/0x440 lib/stackdepot.c:302
       kasan_save_stack+0x4d/0x60 mm/kasan/common.c:40
       kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
       irq_work_queue_on+0x113/0x240 kernel/irq_work.c:101
       pull_rt_task kernel/sched/rt.c:2219 [inline]
       balance_rt+0x2de/0x470 kernel/sched/rt.c:1560
       put_prev_task_balance kernel/sched/core.c:5620 [inline]
       pick_next_task kernel/sched/core.c:5793 [inline]
       __schedule+0x234e/0x4590 kernel/sched/core.c:6336
       schedule+0x11b/0x1f0 kernel/sched/core.c:6455
       schedule_preempt_disabled+0xf/0x20 kernel/sched/core.c:6514
       __mutex_lock_common+0xe34/0x25a0 kernel/locking/mutex.c:669
       __mutex_lock kernel/locking/mutex.c:729 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
       wdev_lock net/wireless/core.h:220 [inline]
       cfg80211_change_iface+0x2ea/0xf20 net/wireless/util.c:1041
       nl80211_set_interface+0x5f8/0x890 net/wireless/nl80211.c:3946
       genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
       genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
       genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792
       netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
       genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
       netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
       netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
       netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
       sock_sendmsg_nosec net/socket.c:704 [inline]
       sock_sendmsg net/socket.c:724 [inline]
       ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
       ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
       __sys_sendmsg net/socket.c:2495 [inline]
       __do_sys_sendmsg net/socket.c:2504 [inline]
       __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x61/0xcb

other info that might help us debug this:

Chain exists of:
  (console_sem).lock --> &p->pi_lock --> &rq->__lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&rq->__lock);
                               lock(&p->pi_lock);
                               lock(&rq->__lock);
  lock((console_sem).lock);

 *** DEADLOCK ***

5 locks held by syz-executor.2/25630:
 #0: ffffffff8da41450 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:802
 #1: ffffffff8d9e1b88 (rtnl_mutex){+.+.}-{3:3}, at: nl80211_pre_doit+0x28/0x540 net/wireless/nl80211.c:14960
 #2: ffff888086928628 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: wiphy_lock include/net/cfg80211.h:5314 [inline]
 #2: ffff888086928628 (&rdev->wiphy.mtx){+.+.}-{3:3}, at: nl80211_pre_doit+0x1aa/0x540 net/wireless/nl80211.c:15002
 #3: ffff88801a384d40 (&wdev->mtx){+.+.}-{3:3}, at: wdev_lock net/wireless/core.h:220 [inline]
 #3: ffff88801a384d40 (&wdev->mtx){+.+.}-{3:3}, at: cfg80211_change_iface+0x2ea/0xf20 net/wireless/util.c:1041
 #4: ffff8880b9a39718 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0xa8/0x140 kernel/sched/core.c:483

stack backtrace:
CPU: 1 PID: 25630 Comm: syz-executor.2 Not tainted 5.15.133-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
 check_prev_add kernel/locking/lockdep.c:3053 [inline]
 check_prevs_add kernel/locking/lockdep.c:3172 [inline]
 validate_chain+0x1646/0x58b0 kernel/locking/lockdep.c:3787
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5011
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
 down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138
 __down_trylock_console_sem+0x105/0x250 kernel/printk/printk.c:239
 console_trylock kernel/printk/printk.c:2569 [inline]
 console_trylock_spinning+0x8a/0x3f0 kernel/printk/printk.c:1867
 vprintk_emit+0xa6/0x150 kernel/printk/printk.c:2267
 _printk+0xd1/0x111 kernel/printk/printk.c:2293
 fail_dump lib/fault-inject.c:45 [inline]
 should_fail+0x36c/0x4c0 lib/fault-inject.c:146
 prepare_alloc_pages+0x1db/0x5b0 mm/page_alloc.c:5198
 __alloc_pages+0x14f/0x700 mm/page_alloc.c:5410
 stack_depot_save+0x319/0x440 lib/stackdepot.c:302
 kasan_save_stack+0x4d/0x60 mm/kasan/common.c:40
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 irq_work_queue_on+0x113/0x240 kernel/irq_work.c:101
 pull_rt_task kernel/sched/rt.c:2219 [inline]
 balance_rt+0x2de/0x470 kernel/sched/rt.c:1560
 put_prev_task_balance kernel/sched/core.c:5620 [inline]
 pick_next_task kernel/sched/core.c:5793 [inline]
 __schedule+0x234e/0x4590 kernel/sched/core.c:6336
 schedule+0x11b/0x1f0 kernel/sched/core.c:6455
 schedule_preempt_disabled+0xf/0x20 kernel/sched/core.c:6514
 __mutex_lock_common+0xe34/0x25a0 kernel/locking/mutex.c:669
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
 wdev_lock net/wireless/core.h:220 [inline]
 cfg80211_change_iface+0x2ea/0xf20 net/wireless/util.c:1041
 nl80211_set_interface+0x5f8/0x890 net/wireless/nl80211.c:3946
 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
 genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
 __sys_sendmsg net/socket.c:2495 [inline]
 __do_sys_sendmsg net/socket.c:2504 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f4de839dae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f4de68dd0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f4de84bd120 RCX: 00007f4de839dae9
RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000008
RBP: 00007f4de68dd120 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 000000000000006e R14: 00007f4de84bd120 R15: 00007ffce31109f8
 </TASK>
CPU: 1 PID: 25630 Comm: syz-executor.2 Not tainted 5.15.133-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 fail_dump lib/fault-inject.c:52 [inline]
 should_fail+0x38a/0x4c0 lib/fault-inject.c:146
 prepare_alloc_pages+0x1db/0x5b0 mm/page_alloc.c:5198
 __alloc_pages+0x14f/0x700 mm/page_alloc.c:5410
 stack_depot_save+0x319/0x440 lib/stackdepot.c:302
 kasan_save_stack+0x4d/0x60 mm/kasan/common.c:40
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 irq_work_queue_on+0x113/0x240 kernel/irq_work.c:101
 pull_rt_task kernel/sched/rt.c:2219 [inline]
 balance_rt+0x2de/0x470 kernel/sched/rt.c:1560
 put_prev_task_balance kernel/sched/core.c:5620 [inline]
 pick_next_task kernel/sched/core.c:5793 [inline]
 __schedule+0x234e/0x4590 kernel/sched/core.c:6336
 schedule+0x11b/0x1f0 kernel/sched/core.c:6455
 schedule_preempt_disabled+0xf/0x20 kernel/sched/core.c:6514
 __mutex_lock_common+0xe34/0x25a0 kernel/locking/mutex.c:669
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
 wdev_lock net/wireless/core.h:220 [inline]
 cfg80211_change_iface+0x2ea/0xf20 net/wireless/util.c:1041
 nl80211_set_interface+0x5f8/0x890 net/wireless/nl80211.c:3946
 genl_family_rcv_msg_doit net/netlink/genetlink.c:731 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
 genl_rcv_msg+0xfbd/0x14a0 net/netlink/genetlink.c:792
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2412
 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2466
 __sys_sendmsg net/socket.c:2495 [inline]
 __do_sys_sendmsg net/socket.c:2504 [inline]
 __se_sys_sendmsg+0x19a/0x260 net/socket.c:2502
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f4de839dae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f4de68dd0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f4de84bd120 RCX: 00007f4de839dae9
RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000008
RBP: 00007f4de68dd120 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 000000000000006e R14: 00007f4de84bd120 R15: 00007ffce31109f8
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/30 06:53 linux-5.15.y b911329317b4 8e26a358 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in task_fork_fair
* Struck through repros no longer work on HEAD.