syzbot


WARNING in bpf_bprintf_prepare (2)

Status: upstream: reported C repro on 2022/09/04 21:21
Reported-by: syzbot+2251879aa068ad9c960d@syzkaller.appspotmail.com
Fix commit: 05b24ff9b2cf bpf: Prevent bpf program recursion for raw tracepoint probes
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 159d, last: 116d
similar bugs (1):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING in bpf_bprintf_prepare C unreliable 96 599d 637d 22/24 fixed on 2021/11/10 00:50

Sample crash report:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3607 at kernel/bpf/helpers.c:770 try_get_fmt_tmp_buf kernel/bpf/helpers.c:770 [inline]
WARNING: CPU: 1 PID: 3607 at kernel/bpf/helpers.c:770 bpf_bprintf_prepare+0xf31/0x11a0 kernel/bpf/helpers.c:818
Modules linked in:
CPU: 1 PID: 3607 Comm: sshd Not tainted 6.0.0-syzkaller-09589-g55be6084c8e0 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
RIP: 0010:try_get_fmt_tmp_buf kernel/bpf/helpers.c:770 [inline]
RIP: 0010:bpf_bprintf_prepare+0xf31/0x11a0 kernel/bpf/helpers.c:818
Code: ff e8 13 3a ea ff 48 83 7c 24 08 00 41 bd 04 00 00 00 0f 85 8a fa ff ff e8 fc 39 ea ff 8d 6b 03 e9 f7 f6 ff ff e8 ef 39 ea ff <0f> 0b 65 ff 0d 7e 04 73 7e bf 01 00 00 00 41 bc f0 ff ff ff e8 66
RSP: 0018:ffffc900034564a8 EFLAGS: 00010093
RAX: 0000000000000000 RBX: 0000000000000002 RCX: 0000000000000000
RDX: ffff8880170860c0 RSI: ffffffff81903cc1 RDI: 0000000000000005
RBP: ffffc900034565d8 R08: 0000000000000005 R09: 0000000000000003
R10: 0000000000000004 R11: 0000000000000001 R12: 0000000000000003
R13: 0000000000000004 R14: ffffc90003456730 R15: 0000000000000003
FS:  00007fa65b88f800(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f82d08601d0 CR3: 000000001cc27000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 ____bpf_trace_printk kernel/trace/bpf_trace.c:385 [inline]
 bpf_trace_printk+0xab/0x170 kernel/trace/bpf_trace.c:376
 ___bpf_prog_run+0x369d/0x7960 kernel/bpf/core.c:1818
 __bpf_prog_run32+0x8a/0xd0 kernel/bpf/core.c:2041
 bpf_dispatcher_nop_func include/linux/bpf.h:963 [inline]
 __bpf_prog_run include/linux/filter.h:600 [inline]
 bpf_prog_run include/linux/filter.h:607 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2252 [inline]
 bpf_trace_run2+0x14d/0x3d0 kernel/trace/bpf_trace.c:2291
 __bpf_trace_contention_begin+0xb5/0xf0 include/trace/events/lock.h:95
 __traceiter_contention_begin+0x56/0x90 include/trace/events/lock.h:95
 trace_contention_begin.constprop.0+0xda/0x1b0 include/trace/events/lock.h:95
 __pv_queued_spin_lock_slowpath+0x103/0xb50 kernel/locking/qspinlock.c:405
 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
 queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline]
 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
 do_raw_spin_lock+0x200/0x2a0 kernel/locking/spinlock_debug.c:115
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
 _raw_spin_lock_irqsave+0x41/0x50 kernel/locking/spinlock.c:162
 ____bpf_trace_printk kernel/trace/bpf_trace.c:390 [inline]
 bpf_trace_printk+0xcf/0x170 kernel/trace/bpf_trace.c:376
 ___bpf_prog_run+0x369d/0x7960 kernel/bpf/core.c:1818
 __bpf_prog_run32+0x8a/0xd0 kernel/bpf/core.c:2041
 bpf_dispatcher_nop_func include/linux/bpf.h:963 [inline]
 __bpf_prog_run include/linux/filter.h:600 [inline]
 bpf_prog_run include/linux/filter.h:607 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2252 [inline]
 bpf_trace_run2+0x14d/0x3d0 kernel/trace/bpf_trace.c:2291
 __bpf_trace_contention_begin+0xb5/0xf0 include/trace/events/lock.h:95
 __traceiter_contention_begin+0x56/0x90 include/trace/events/lock.h:95
 trace_contention_begin.constprop.0+0xda/0x1b0 include/trace/events/lock.h:95
 __pv_queued_spin_lock_slowpath+0x103/0xb50 kernel/locking/qspinlock.c:405
 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
 queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline]
 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
 do_raw_spin_lock+0x200/0x2a0 kernel/locking/spinlock_debug.c:115
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
 _raw_spin_lock_irqsave+0x41/0x50 kernel/locking/spinlock.c:162
 ____bpf_trace_printk kernel/trace/bpf_trace.c:390 [inline]
 bpf_trace_printk+0xcf/0x170 kernel/trace/bpf_trace.c:376
 ___bpf_prog_run+0x369d/0x7960 kernel/bpf/core.c:1818
 __bpf_prog_run32+0x8a/0xd0 kernel/bpf/core.c:2041
 bpf_dispatcher_nop_func include/linux/bpf.h:963 [inline]
 __bpf_prog_run include/linux/filter.h:600 [inline]
 bpf_prog_run include/linux/filter.h:607 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2252 [inline]
 bpf_trace_run2+0x14d/0x3d0 kernel/trace/bpf_trace.c:2291
 __bpf_trace_contention_begin+0xb5/0xf0 include/trace/events/lock.h:95
 __traceiter_contention_begin+0x56/0x90 include/trace/events/lock.h:95
 trace_contention_begin.constprop.0+0xda/0x1b0 include/trace/events/lock.h:95
 __pv_queued_spin_lock_slowpath+0x103/0xb50 kernel/locking/qspinlock.c:405
 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:591 [inline]
 queued_spin_lock_slowpath arch/x86/include/asm/qspinlock.h:51 [inline]
 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline]
 do_raw_spin_lock+0x200/0x2a0 kernel/locking/spinlock_debug.c:115
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline]
 _raw_spin_lock_irqsave+0x41/0x50 kernel/locking/spinlock.c:162
 ____bpf_trace_printk kernel/trace/bpf_trace.c:390 [inline]
 bpf_trace_printk+0xcf/0x170 kernel/trace/bpf_trace.c:376
 ___bpf_prog_run+0x369d/0x7960 kernel/bpf/core.c:1818
 __bpf_prog_run32+0x8a/0xd0 kernel/bpf/core.c:2041
 bpf_dispatcher_nop_func include/linux/bpf.h:963 [inline]
 __bpf_prog_run include/linux/filter.h:600 [inline]
 bpf_prog_run include/linux/filter.h:607 [inline]
 __bpf_trace_run kernel/trace/bpf_trace.c:2252 [inline]
 bpf_trace_run2+0x14d/0x3d0 kernel/trace/bpf_trace.c:2291
 __bpf_trace_contention_begin+0xb5/0xf0 include/trace/events/lock.h:95
 __traceiter_contention_begin+0x56/0x90 include/trace/events/lock.h:95
 trace_contention_begin+0xc0/0x150 include/trace/events/lock.h:95
 __mutex_lock_common kernel/locking/mutex.c:605 [inline]
 __mutex_lock+0x13c/0x1350 kernel/locking/mutex.c:747
 __pipe_lock fs/pipe.c:103 [inline]
 pipe_read+0x139/0x1100 fs/pipe.c:244
 call_read_iter include/linux/fs.h:2184 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x7f6/0x930 fs/read_write.c:470
 ksys_read+0x1e8/0x250 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fa65b4fe8fe
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:00007fff66dd8c08 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fa65b4fe8fe
RDX: 0000000000004000 RSI: 00007fff66dd8c18 RDI: 0000000000000009
RBP: 0000564450d403b0 R08: 0000564450d41900 R09: 00007fff66df7080
R10: 00007fff66df70f0 R11: 0000000000000246 R12: 000000000000002a
R13: 0000564450d3ef90 R14: 00007fff66dd8c18 R15: 0000564450d2da30
 </TASK>

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-selinux-root 2022/10/13 19:35 upstream 55be6084c8e0 adf90437 .config strace log report syz C [disk image] [vmlinux] WARNING in bpf_bprintf_prepare
ci-upstream-linux-next-kasan-gce-root 2022/08/31 21:14 linux-next 7fd22855300e 51e54e30 .config strace log report syz C WARNING in bpf_bprintf_prepare
* Struck through repros no longer work on HEAD.