[syzbot] [bpf?] WARNING in bpf_bprintf_prepare (3)

0 views
Skip to first unread message

syzbot

unread,
Oct 20, 2025, 5:08:26 PMĀ (16 hours ago)Ā Oct 20
to and...@kernel.org, a...@kernel.org, b...@vger.kernel.org, chandn...@gmail.com, dan...@iogearbox.net, edd...@gmail.com, hao...@google.com, john.fa...@gmail.com, jo...@kernel.org, kps...@kernel.org, linux-...@vger.kernel.org, lis...@listout.xyz, marti...@linux.dev, net...@vger.kernel.org, s...@fomichev.me, so...@kernel.org, syzkall...@googlegroups.com, yongho...@linux.dev
Hello,

syzbot found the following issue on:

HEAD commit: a1e83d4c0361 selftests/bpf: Fix redefinition of 'off' as d..
git tree: bpf
console output: https://syzkaller.appspot.com/x/log.txt?x=12d21de2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=9ad7b090a18654a7
dashboard link: https://syzkaller.appspot.com/bug?extid=b0cff308140f79a9c4cb
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=160cf542580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=128d5c58580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/2f6a7a0cd1b7/disk-a1e83d4c.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/873984cfc71e/vmlinux-a1e83d4c.xz
kernel image: https://storage.googleapis.com/syzbot-assets/16711d84070c/bzImage-a1e83d4c.xz

The issue was bisected to:

commit 7c33e97a6ef5d84e98b892c3e00c6d1678d20395
Author: Sahil Chandna <chandn...@gmail.com>
Date: Tue Oct 14 18:56:35 2025 +0000

bpf: Do not disable preemption in bpf_test_run().

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=172fe492580000
final oops: https://syzkaller.appspot.com/x/report.txt?x=14afe492580000
console output: https://syzkaller.appspot.com/x/log.txt?x=10afe492580000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+b0cff3...@syzkaller.appspotmail.com
Fixes: 7c33e97a6ef5 ("bpf: Do not disable preemption in bpf_test_run().")

------------[ cut here ]------------
WARNING: CPU: 1 PID: 6145 at kernel/bpf/helpers.c:781 bpf_try_get_buffers kernel/bpf/helpers.c:781 [inline]
WARNING: CPU: 1 PID: 6145 at kernel/bpf/helpers.c:781 bpf_bprintf_prepare+0x12cf/0x13a0 kernel/bpf/helpers.c:834
Modules linked in:
CPU: 1 UID: 0 PID: 6145 Comm: syz.4.53 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
RIP: 0010:bpf_try_get_buffers kernel/bpf/helpers.c:781 [inline]
RIP: 0010:bpf_bprintf_prepare+0x12cf/0x13a0 kernel/bpf/helpers.c:834
Code: ff e9 ce fe ff ff e8 10 ec e0 ff e9 be fe ff ff e8 06 ec e0 ff e9 b4 fe ff ff e8 fc eb e0 ff e9 aa fe ff ff e8 f2 eb e0 ff 90 <0f> 0b 90 65 ff 0d 27 fd b2 10 b8 f0 ff ff ff e9 17 ff ff ff e8 d8
RSP: 0018:ffffc90003797840 EFLAGS: 00010293
RAX: ffffffff81df57fe RBX: ffffc90003797a10 RCX: ffff888026493c80
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000003
RBP: ffffc90003797970 R08: 0000000000585870 R09: 0000000000000005
R10: dffffc0000000000 R11: fffff520006f2f20 R12: dffffc0000000000
R13: 0000000000000004 R14: 0000000000000003 R15: 1ffff920006f2f42
FS: 00005555805f5500(0000) GS:ffff888125e0c000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000007c04e000 CR4: 00000000003526f0
Call Trace:
<TASK>
____bpf_trace_printk kernel/trace/bpf_trace.c:372 [inline]
bpf_trace_printk+0xdb/0x190 kernel/trace/bpf_trace.c:362
bpf_prog_bfbd7bf4bf171090+0x41/0x5a
bpf_dispatcher_nop_func include/linux/bpf.h:1350 [inline]
__bpf_prog_run include/linux/filter.h:721 [inline]
bpf_prog_run include/linux/filter.h:728 [inline]
bpf_prog_run_pin_on_cpu include/linux/filter.h:745 [inline]
bpf_flow_dissect+0x225/0x720 net/core/flow_dissector.c:1024
bpf_prog_test_run_flow_dissector+0x37c/0x5c0 net/bpf/test_run.c:1414
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4688
__sys_bpf+0x562/0x860 kernel/bpf/syscall.c:6167
__do_sys_bpf kernel/bpf/syscall.c:6259 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6257 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6257
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f25b0f8efc9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe036cd5e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f25b11e5fa0 RCX: 00007f25b0f8efc9
RDX: 0000000000000050 RSI: 0000200000000180 RDI: 000000000000000a
RBP: 00007f25b1011f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f25b11e5fa0 R14: 00007f25b11e5fa0 R15: 0000000000000003
</TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
2:49 AMĀ (6 hours ago)Ā 2:49 AM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Re: [syzbot] [bpf?] WARNING in bpf_bprintf_prepare (3)
Author: chandn...@gmail.com

#syz test
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -1021,7 +1021,9 @@ u32 bpf_flow_dissect(struct bpf_prog *prog, struct bpf_flow_dissector *ctx,
(int)FLOW_DISSECTOR_F_STOP_AT_ENCAP);
flow_keys->flags = flags;

+ preempt_disable();
result = bpf_prog_run_pin_on_cpu(prog, ctx);
+ preempt_enable();

flow_keys->nhoff = clamp_t(u16, flow_keys->nhoff, nhoff, hlen);
flow_keys->thoff = clamp_t(u16, flow_keys->thoff,
--
2.50.1

syzbot

unread,
3:03 AMĀ (6 hours ago)Ā 3:03 AM
to chandn...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot tried to test the proposed patch but the build/boot failed:

failed to apply patch:
checking file net/core/flow_dissector.c
patch: **** unexpected end of file in patch



Tested on:

commit: 1c64efcb Merge tag 'rust-rustfmt' of git://git.kernel...
git tree: bpf
patch: https://syzkaller.appspot.com/x/patch.diff?x=147743cd980000

syzbot

unread,
5:53 AMĀ (3 hours ago)Ā 5:53 AM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Re: [syzbot] [bpf?] WARNING in bpf_bprintf_prepare (3)
Author: lis...@listout.xyz
#syz test

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 8b7d0b90fea7..1d0047073eda 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -36,7 +36,7 @@ struct bpf_test_timer {
static void bpf_test_timer_enter(struct bpf_test_timer *t)
__acquires(rcu)
{
- rcu_read_lock_dont_migrate();
+ migrate_disable();
t->time_start = ktime_get_ns();
}

@@ -44,7 +44,8 @@ static void bpf_test_timer_leave(struct bpf_test_timer *t)
__releases(rcu)
{
t->time_start = 0;
- rcu_read_unlock_migrate();
+ migrate_enable();
+ rcu_read_unlock();
}

static bool bpf_test_timer_continue(struct bpf_test_timer *t, int iterations,

--
Regards,
listout

syzbot

unread,
5:56 AMĀ (3 hours ago)Ā 5:56 AM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: Re: [syzbot] [bpf?] WARNING in bpf_bprintf_prepare (3)
Author: lis...@listout.xyz

On 20.10.2025 14:08, syzbot wrote:
#syz test

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 8b7d0b90fea7..cc4288f408f2 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -36,7 +36,8 @@ struct bpf_test_timer {
static void bpf_test_timer_enter(struct bpf_test_timer *t)
__acquires(rcu)
{
- rcu_read_lock_dont_migrate();
+ rcu_read_lock();
+ migrate_disable();
t->time_start = ktime_get_ns();
}

@@ -44,7 +45,8 @@ static void bpf_test_timer_leave(struct bpf_test_timer *t)

syzbot

unread,
7:45 AMĀ (1 hour ago)Ā 7:45 AM
to linux-...@vger.kernel.org, lis...@listout.xyz, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING: bad unlock balance in bpf_test_timer_leave

=====================================
WARNING: bad unlock balance detected!
syzkaller #0 Not tainted
-------------------------------------
syz.2.19/6466 is trying to release lock (rcu_read_lock) at:
[<ffffffff896fd470>] rcu_lock_release include/linux/rcupdate.h:341 [inline]
[<ffffffff896fd470>] rcu_read_unlock include/linux/rcupdate.h:897 [inline]
[<ffffffff896fd470>] bpf_test_timer_leave+0x1d0/0x290 net/bpf/test_run.c:48
but there are no more locks to release!

other info that might help us debug this:
no locks held by syz.2.19/6466.

stack backtrace:
CPU: 1 UID: 0 PID: 6466 Comm: syz.2.19 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
print_unlock_imbalance_bug+0xdc/0xf0 kernel/locking/lockdep.c:5298
__lock_release kernel/locking/lockdep.c:5527 [inline]
lock_release+0x212/0x3e0 kernel/locking/lockdep.c:5889
rcu_lock_release include/linux/rcupdate.h:341 [inline]
rcu_read_unlock include/linux/rcupdate.h:897 [inline]
bpf_test_timer_leave+0x1dc/0x290 net/bpf/test_run.c:48
bpf_test_timer_continue+0x244/0x320 net/bpf/test_run.c:74
bpf_prog_test_run_flow_dissector+0x39c/0x5c0 net/bpf/test_run.c:1417
bpf_prog_test_run+0x2c7/0x340 kernel/bpf/syscall.c:4688
__sys_bpf+0x562/0x860 kernel/bpf/syscall.c:6167
__do_sys_bpf kernel/bpf/syscall.c:6259 [inline]
__se_sys_bpf kernel/bpf/syscall.c:6257 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:6257
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa2f6f8efc9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fa2f7e1c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007fa2f71e5fa0 RCX: 00007fa2f6f8efc9
RDX: 0000000000000050 RSI: 0000200000000180 RDI: 000000000000000a
RBP: 00007fa2f7011f91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa2f71e6038 R14: 00007fa2f71e5fa0 R15: 00007ffee539e9b8
</TASK>
------------[ cut here ]------------
WARNING: CPU: 1 PID: 6466 at kernel/rcu/tree_plugin.h:443 __rcu_read_unlock+0x7a/0xe0 kernel/rcu/tree_plugin.h:443


Tested on:

commit: 1c64efcb Merge tag 'rust-rustfmt' of git://git.kernel...
git tree: bpf
console output: https://syzkaller.appspot.com/x/log.txt?x=144e83e2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=9ad7b090a18654a7
dashboard link: https://syzkaller.appspot.com/bug?extid=b0cff308140f79a9c4cb
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch: https://syzkaller.appspot.com/x/patch.diff?x=177bbc58580000

Reply all
Reply to author
Forward
0 new messages