syzbot


possible deadlock in bpf_trace_printk

Status: upstream: reported C repro on 2022/06/09 17:07
Reported-by: syzbot+c49e17557ddb5725583d@syzkaller.appspotmail.com
First crash: 107d, last: 19h20m

Cause bisection: introduced by (bisect log) :
commit dc1f7893a70fe403983bd8492f177bf993940e2c
Author: Peter Zijlstra <peterz@infradead.org>
Date: Wed Mar 30 11:06:54 2022 +0000

  locking/mutex: Make contention tracepoints more consistent wrt adaptive spinning

Crash: possible deadlock in bpf_trace_printk (log)
Repro: C syz .config
Patch testing requests:
Created Duration User Patch Repo Result
2022/06/11 00:56 18m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git d678cbd2f867 OK log
2022/06/10 15:17 9m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git d678cbd2f867 report log

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.0.0-rc5-syzkaller-00094-ga335366bad13 #0 Not tainted
--------------------------------------------
sshd/3608 is trying to acquire lock:
ffffffff8cd7d4f8 (trace_printk_lock){....}-{2:2}, at: ____bpf_trace_printk kernel/trace/bpf_trace.c:388 [inline]
ffffffff8cd7d4f8 (trace_printk_lock){....}-{2:2}, at: bpf_trace_printk+0x151/0x200 kernel/trace/bpf_trace.c:374

but task is already holding lock:
ffffffff8cd7d4f8 (trace_printk_lock){....}-{2:2}, at: ____bpf_trace_printk kernel/trace/bpf_trace.c:388 [inline]
ffffffff8cd7d4f8 (trace_printk_lock){....}-{2:2}, at: bpf_trace_printk+0x151/0x200 kernel/trace/bpf_trace.c:374

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

       CPU0
       ----
  lock(trace_printk_lock);
  lock(trace_printk_lock);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

4 locks held by sshd/3608:
 #0: ffff888078095868 (&pipe->mutex/1){+.+.}-{3:3}, at: __pipe_lock fs/pipe.c:103 [inline]
 #0: ffff888078095868 (&pipe->mutex/1){+.+.}-{3:3}, at: pipe_read+0x121/0x12a0 fs/pipe.c:244
 #1: ffffffff8cd208a0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:279
 #2: ffffffff8cd7d4f8 (trace_printk_lock){....}-{2:2}, at: ____bpf_trace_printk kernel/trace/bpf_trace.c:388 [inline]
 #2: ffffffff8cd7d4f8 (trace_printk_lock){....}-{2:2}, at: bpf_trace_printk+0x151/0x200 kernel/trace/bpf_trace.c:374
 #3: ffffffff8cd208a0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x5/0x30 include/linux/rcupdate.h:279

stack backtrace:
CPU: 1 PID: 3608 Comm: sshd Not tainted 6.0.0-rc5-syzkaller-00094-ga335366bad13 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_deadlock_bug kernel/locking/lockdep.c:2988 [inline]
 check_deadlock kernel/locking/lockdep.c:3031 [inline]
 validate_chain+0x4897/0x6600 kernel/locking/lockdep.c:3816
 __lock_acquire+0x1292/0x1f60 kernel/locking/lockdep.c:5053
 lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5666
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
 ____bpf_trace_printk kernel/trace/bpf_trace.c:388 [inline]
 bpf_trace_printk+0x151/0x200 kernel/trace/bpf_trace.c:374
 bpf_prog_0605f9f479290f07+0x2f/0x33
 bpf_dispatcher_nop_func include/linux/bpf.h:903 [inline]
 __bpf_prog_run include/linux/filter.h:594 [inline]
 bpf_prog_run include/linux/filter.h:601 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2046 [inline]
 bpf_trace_run2+0x18a/0x320 kernel/trace/bpf_trace.c:2083
 trace_contention_begin+0x16b/0x190 include/trace/events/lock.h:95
 __pv_queued_spin_lock_slowpath+0x10f/0xc60 kernel/locking/qspinlock.c:405
 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
 queued_spin_lock_slowpath+0x42/0x50 arch/x86/include/asm/qspinlock.h:51
 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
 do_raw_spin_lock+0x264/0x360 kernel/locking/spinlock_debug.c:115
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
 _raw_spin_lock_irqsave+0xdd/0x120 kernel/locking/spinlock.c:162
 ____bpf_trace_printk kernel/trace/bpf_trace.c:388 [inline]
 bpf_trace_printk+0x151/0x200 kernel/trace/bpf_trace.c:374
 bpf_prog_0605f9f479290f07+0x2f/0x33
 bpf_dispatcher_nop_func include/linux/bpf.h:903 [inline]
 __bpf_prog_run include/linux/filter.h:594 [inline]
 bpf_prog_run include/linux/filter.h:601 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2046 [inline]
 bpf_trace_run2+0x18a/0x320 kernel/trace/bpf_trace.c:2083
 trace_contention_begin+0x122/0x140 include/trace/events/lock.h:95
 __mutex_lock_common+0x1ef/0x26c0 kernel/locking/mutex.c:605
 __mutex_lock kernel/locking/mutex.c:747 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
 __pipe_lock fs/pipe.c:103 [inline]
 pipe_read+0x121/0x12a0 fs/pipe.c:244
 call_read_iter include/linux/fs.h:2181 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x7cf/0xbc0 fs/read_write.c:470
 ksys_read+0x19b/0x2c0 fs/read_write.c:607
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f096fe288fe
Code: c0 e9 e6 fe ff ff 50 48 8d 3d 0e c7 09 00 e8 c9 cf 01 00 66 0f 1f 84 00 00 00 00 00 64 8b 04 25 18 00 00 00 85 c0 75 14 0f 05 <48> 3d 00 f0 ff ff 77 5a c3 66 0f 1f 84 00 00 00 00 00 48 83 ec 28
RSP: 002b:00007fffbf5b9ed8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f096fe288fe
RDX: 0000000000004000 RSI: 00007fffbf5b9ee8 RDI: 0000000000000009
RBP: 0000558f34c30450 R08: 0000558f34c31750 R09: 0000000000000070
R10: 00007fffbf5ce118 R11: 0000000000000246 R12: 000000000000002d
R13: 0000558f34c2f030 R14: 00007fffbf5b9ee8 R15: 0000558f34c318d0
 </TASK>

Crashes (50):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2022/09/18 03:33 upstream a335366bad13 dd9a85ff .config log report syz C possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-root 2022/07/23 04:03 upstream 4ba1329cbb94 22343af4 .config log report syz C possible deadlock in bpf_trace_printk
ci-upstream-bpf-kasan-gce 2022/06/09 00:39 bpf d678cbd2f867 b2706118 .config log report syz C possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/06/09 00:08 net f5826c8c9d57 b2706118 .config log report syz C possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/06/09 01:27 net-next da6e113ff010 b2706118 .config log report syz C possible deadlock in bpf_trace_printk
ci-upstream-bpf-next-kasan-gce 2022/06/09 00:44 bpf-next d352bd889b6a b2706118 .config log report syz C possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-root 2022/09/18 04:00 upstream a335366bad13 dd9a85ff .config log report syz possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/09/18 04:13 net 96628951869c dd9a85ff .config log report syz possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/09/18 04:34 net-next 44a8535fb87c dd9a85ff .config log report syz possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/09/24 00:57 upstream 1707c39ae309 0042f2b4 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/09/23 12:11 upstream bf682942cd26 0042f2b4 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-root 2022/09/12 09:35 upstream 4ed9c1e971b1 356d8217 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/09/11 20:04 upstream b96fbd602d35 356d8217 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-root 2022/09/05 08:23 upstream 7e18e42e4b28 28811d0a .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/09/01 13:11 upstream c5e4d5e99162 b01ec571 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/08/20 04:09 upstream 4c2d0b039c5c 26a13b38 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-root 2022/08/17 20:04 upstream 7ebfc85e2cd7 4e72d229 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/08/16 20:00 upstream 7ebfc85e2cd7 7a7cb304 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-root 2022/08/16 00:27 upstream 7ebfc85e2cd7 8dfcaa3d .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-selinux-root 2022/07/24 08:17 upstream 515f71412bb7 22343af4 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/07/24 07:40 upstream 515f71412bb7 22343af4 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-selinux-root 2022/07/10 14:31 upstream b1c428b6c368 b5765a15 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/07/07 17:14 upstream 9f09069cde34 bff65f44 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-selinux-root 2022/07/05 16:16 upstream c1084b6c5620 bff65f44 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-selinux-root 2022/06/28 01:15 upstream 941e3e791269 ef82eb2c .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-selinux-root 2022/06/21 09:20 upstream 78ca55889a54 0fc5c330 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-smack-root 2022/06/16 07:10 upstream 979086f5e006 1719ee24 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-kasan-gce-root 2022/06/11 00:24 upstream 874c8ca1e60b 0d5abf15 .config log report info possible deadlock in bpf_trace_printk
ci-qemu-upstream-386 2022/07/24 07:06 upstream 4a57a8400075 22343af4 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/08/28 01:22 net ebe5555c2f34 07177916 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/08/27 14:32 net 7498a457ecf7 07177916 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/08/16 22:47 net ae806c780557 7a7cb304 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/07/26 23:37 net 9b134b1694ec 279b89c2 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/07/24 11:51 net 4d8f24eeedc5 22343af4 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/07/19 22:31 net b3fcfc4f0c50 72a3cc0c .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/07/16 10:52 net 11052589cf5c 95cb00d1 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/07/03 00:02 net d28b25a62a47 1434eec0 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/06/18 02:38 net b4a028c4d031 cb58b3b2 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-this-kasan-gce 2022/06/08 23:38 net f5826c8c9d57 b2706118 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-bpf-next-kasan-gce 2022/09/13 06:23 bpf-next 1bfe26fb0827 f371ed7e .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/09/02 19:06 net-next c3f760ef1287 25194605 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/08/26 01:59 net-next c19d893fbf3f 9b5bf4cd .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/08/20 02:05 net-next 268603d79cc4 26a13b38 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/08/14 06:06 net-next 7ebfc85e2cd7 8dfcaa3d .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/07/18 00:00 net-next 2acd1022549e 95cb00d1 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-net-kasan-gce 2022/06/28 03:38 net-next c83bc86a0596 ef82eb2c .config log report info possible deadlock in bpf_trace_printk
ci-upstream-linux-next-kasan-gce-root 2022/08/14 20:39 linux-next 6c8f479764eb 8dfcaa3d .config log report info possible deadlock in bpf_trace_printk
ci-upstream-linux-next-kasan-gce-root 2022/08/01 10:37 linux-next cb71b93c2dc3 fef302b1 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-linux-next-kasan-gce-root 2022/07/24 06:57 linux-next cb71b93c2dc3 22343af4 .config log report info possible deadlock in bpf_trace_printk
ci-upstream-linux-next-kasan-gce-root 2022/07/13 16:21 linux-next cb71b93c2dc3 5d921b08 .config log report info possible deadlock in bpf_trace_printk
* Struck through repros no longer work on HEAD.