[v6.1] BUG: sleeping function called from invalid context in bpf_test_timer_continue

3 views
Skip to first unread message

syzbot

unread,
Jan 9, 2024, 1:30:29 PMJan 9
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 38fb82ecd144 Linux 6.1.71
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1549b7f6e80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f8d4b3f2bd71350c
dashboard link: https://syzkaller.appspot.com/bug?extid=29384a0e217e29680d72
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8ee0872b703c/disk-38fb82ec.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b408ae2d4aa3/vmlinux-38fb82ec.xz
kernel image: https://storage.googleapis.com/syzbot-assets/6393d9c4fa0a/bzImage-38fb82ec.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+29384a...@syzkaller.appspotmail.com

BUG: sleeping function called from invalid context at net/bpf/test_run.c:81
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 5504, name: syz-executor.4
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
no locks held by syz-executor.4/5504.
Preemption disabled at:
[<ffffffff81a24764>] try_get_fmt_tmp_buf kernel/bpf/helpers.c:768 [inline]
[<ffffffff81a24764>] bpf_bprintf_prepare+0x114/0x1310 kernel/bpf/helpers.c:818
CPU: 1 PID: 5504 Comm: syz-executor.4 Not tainted 6.1.71-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
__might_resched+0x5cb/0x780 kernel/sched/core.c:9942
bpf_test_timer_continue+0x26f/0x350 net/bpf/test_run.c:81
bpf_test_run+0x44b/0x8b0 net/bpf/test_run.c:403
bpf_prog_test_run_skb+0xaf1/0x13a0 net/bpf/test_run.c:1180
bpf_prog_test_run+0x32f/0x3a0 kernel/bpf/syscall.c:3633
__sys_bpf+0x3eb/0x6c0 kernel/bpf/syscall.c:4986
__do_sys_bpf kernel/bpf/syscall.c:5072 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5070 [inline]
__x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5070
do_syscall_x64 arch/x86/entry/common.c:51 [inline]
do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f254667cd29
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:00007f25473fd0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f25467abf80 RCX: 00007f254667cd29
RDX: 000000000000004c RSI: 0000000020000640 RDI: 000000000000000a
RBP: 00007f25466c947a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f25467abf80 R15: 00007fff28cec518
</TASK>
BUG: scheduling while atomic: syz-executor.4/5504/0x00000002
no locks held by syz-executor.4/5504.
Modules linked in:
Preemption disabled at:
[<ffffffff81a24764>] try_get_fmt_tmp_buf kernel/bpf/helpers.c:768 [inline]
[<ffffffff81a24764>] bpf_bprintf_prepare+0x114/0x1310 kernel/bpf/helpers.c:818


---
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.

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

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,
Feb 6, 2024, 9:09:33 PMFeb 6
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: f1bb70486c9c Linux 6.1.77
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14fcc204180000
kernel config: https://syzkaller.appspot.com/x/.config?x=39447811cb133e7e
dashboard link: https://syzkaller.appspot.com/bug?extid=29384a0e217e29680d72
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10629540180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1450ad7be80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/b4e70e158586/disk-f1bb7048.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6fd889f445ac/vmlinux-f1bb7048.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3c8bf6d15492/bzImage-f1bb7048.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+29384a...@syzkaller.appspotmail.com

BUG: sleeping function called from invalid context at net/bpf/test_run.c:81
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3563, name: syz-executor367
preempt_count: 1, expected: 0
RCU nest depth: 0, expected: 0
no locks held by syz-executor367/3563.
Preemption disabled at:
[<ffffffff81a228d4>] try_get_fmt_tmp_buf kernel/bpf/helpers.c:771 [inline]
[<ffffffff81a228d4>] bpf_bprintf_prepare+0x114/0x1310 kernel/bpf/helpers.c:821
CPU: 1 PID: 3563 Comm: syz-executor367 Not tainted 6.1.77-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
__might_resched+0x5cb/0x780 kernel/sched/core.c:9942
bpf_test_timer_continue+0x26f/0x350 net/bpf/test_run.c:81
bpf_test_run+0x44b/0x8b0 net/bpf/test_run.c:403
bpf_prog_test_run_skb+0xaf1/0x13a0 net/bpf/test_run.c:1180
bpf_prog_test_run+0x32f/0x3a0 kernel/bpf/syscall.c:3670
__sys_bpf+0x3eb/0x6c0 kernel/bpf/syscall.c:5023
__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+0x3d/0xb0 arch/x86/entry/common.c:81
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f9193343229
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffee1ba4a98 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9193343229
RDX: 0000000000000050 RSI: 0000000020000640 RDI: 000000000000000a
RBP: 0000000000000000 R08: 00000000000000a0 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
BUG: scheduling while atomic: syz-executor367/3563/0x00000002
no locks held by syz-executor367/3563.
Modules linked in:
Preemption disabled at:
[<ffffffff81a228d4>] try_get_fmt_tmp_buf kernel/bpf/helpers.c:771 [inline]
[<ffffffff81a228d4>] bpf_bprintf_prepare+0x114/0x1310 kernel/bpf/helpers.c:821


---
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.

syzbot

unread,
Feb 25, 2024, 12:50:04 AMFeb 25
to syzkaller...@googlegroups.com
syzbot suspects this issue could be fixed by backporting the following commit:

commit f19a4050455aad847fb93f18dc1fe502eb60f989
git tree: upstream
Author: Jiri Olsa <jo...@kernel.org>
Date: Thu Dec 15 21:44:29 2022 +0000

bpf: Do cleanup in bpf_bprintf_cleanup only when needed

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=115d934a180000
Please keep in mind that other backports might be required as well.

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Feb 25, 2024, 11:10:08 PMFeb 25
to syzkaller...@googlegroups.com
The commit that was suspected to fix the issue was backported to the fuzzed
kernel trees.

commit 95b7476f6f68d725c474e3348e89436b0abde62a
Author: <jo...@kernel.org>
Date: Thu Dec 15 21:44:29 2022 +0000

bpf: Do cleanup in bpf_bprintf_cleanup only when needed

If you believe this is correct, please reply with
#syz fix: bpf: Do cleanup in bpf_bprintf_cleanup only when needed

The commit was initially detected here:
Reply all
Reply to author
Forward
0 new messages