[Android 5.15] UBSAN: array-index-out-of-bounds in bpf_bprintf_prepare

3 views
Skip to first unread message

syzbot

unread,
Feb 18, 2024, 3:08:21 AMFeb 18
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 993bed180178 Merge "Merge branch 'android13-5.15' into bra..
git tree: android13-5.15-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=127856c2180000
kernel config: https://syzkaller.appspot.com/x/.config?x=49ce29477ba81e8f
dashboard link: https://syzkaller.appspot.com/bug?extid=d9e380f0aae640b893ae
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=134cdb0c180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=146325d0180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/4098d24d4c8b/disk-993bed18.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/94fbc07ac02d/vmlinux-993bed18.xz
kernel image: https://storage.googleapis.com/syzbot-assets/eed14de06c19/bzImage-993bed18.xz

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

================================================================================
UBSAN: array-index-out-of-bounds in kernel/bpf/helpers.c:736:13
index -1 is out of range for type 'char[3][512]'
CPU: 1 PID: 2822 Comm: syz-executor386 Not tainted 5.15.148-syzkaller-00718-g993bed180178 #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+0x151/0x1b7 lib/dump_stack.c:106
dump_stack+0x15/0x17 lib/dump_stack.c:113
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0x118/0x140 lib/ubsan.c:282
try_get_fmt_tmp_buf kernel/bpf/helpers.c:736 [inline]
bpf_bprintf_prepare+0x132e/0x1360 kernel/bpf/helpers.c:778
____bpf_trace_printk kernel/trace/bpf_trace.c:377 [inline]
bpf_trace_printk+0x14a/0x300 kernel/trace/bpf_trace.c:368
bpf_prog_cfddb232a7dfb698+0x2f/0x854
bpf_dispatcher_nop_func include/linux/bpf.h:785 [inline]
__bpf_prog_run include/linux/filter.h:625 [inline]
bpf_prog_run include/linux/filter.h:632 [inline]
__bpf_trace_run kernel/trace/bpf_trace.c:1883 [inline]
bpf_trace_run3+0x11e/0x250 kernel/trace/bpf_trace.c:1921
__bpf_trace_kmem_cache_free+0x99/0xc0 include/trace/events/kmem.h:138
__traceiter_kmem_cache_free+0x32/0x50 include/trace/events/kmem.h:138
trace_kmem_cache_free include/trace/events/kmem.h:138 [inline]
kmem_cache_free+0x2c3/0x2e0 mm/slub.c:3536
adjust_va_to_fit_type mm/vmalloc.c:1347 [inline]
__alloc_vmap_area mm/vmalloc.c:1463 [inline]
alloc_vmap_area+0x1748/0x1a80 mm/vmalloc.c:1554
__get_vm_area_node+0x158/0x360 mm/vmalloc.c:2439
__vmalloc_node_range+0xe2/0x8d0 mm/vmalloc.c:3051
__vmalloc_node mm/vmalloc.c:3151 [inline]
vmalloc+0x78/0x90 mm/vmalloc.c:3184
bpf_prog_calc_tag+0xd7/0x8f0 kernel/bpf/core.c:281
resolve_pseudo_ldimm64+0xe2/0x1240 kernel/bpf/verifier.c:11740
bpf_check+0x3174/0x12bf0 kernel/bpf/verifier.c:14027
bpf_prog_load+0x12ac/0x1b50 kernel/bpf/syscall.c:2327
__sys_bpf+0x4bc/0x760 kernel/bpf/syscall.c:4627
__do_sys_bpf kernel/bpf/syscall.c:4731 [inline]
__se_sys_bpf kernel/bpf/syscall.c:4729 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:4729
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:0x7faee7b89ee9
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:00007ffecbf786f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007faee7b89ee9
RDX: 0000000000000049 RSI: 0000000020000980 RDI: 0000000000000005
RBP: 00000000000f4240 R08: 0000000000000000 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000001bbae
R13: 00007ffecbf7870c R14: 00007ffecbf78720 R15: 00007ffecbf78710
</TASK>
================================================================================
BUG: scheduling while atomic: syz-executor386/2822/0x00000002
Modules linked in:
Preemption disabled at:
[<ffffffff81ab934d>] spin_lock include/linux/spinlock.h:363 [inline]
[<ffffffff81ab934d>] preload_this_cpu_lock mm/vmalloc.c:1511 [inline]
[<ffffffff81ab934d>] alloc_vmap_area+0x22d/0x1a80 mm/vmalloc.c:1553
CPU: 1 PID: 2822 Comm: syz-executor386 Not tainted 5.15.148-syzkaller-00718-g993bed180178 #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+0x151/0x1b7 lib/dump_stack.c:106
dump_stack+0x15/0x17 lib/dump_stack.c:113
__schedule_bug+0x195/0x260 kernel/sched/core.c:5707
schedule_debug kernel/sched/core.c:5734 [inline]
__schedule+0xd19/0x1590 kernel/sched/core.c:6402
schedule+0x11f/0x1e0 kernel/sched/core.c:6595
exit_to_user_mode_loop+0x4d/0xe0 kernel/entry/common.c:163
exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:208
__syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:301
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7faee7b89ee9
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:00007ffecbf786f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: 0000000000000003 RBX: 0000000000000000 RCX: 00007faee7b89ee9
RDX: 0000000000000049 RSI: 0000000020000980 RDI: 0000000000000005
RBP: 00000000000f4240 R08: 0000000000000000 R09: 00000000000000a0
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000001bbae
R13: 00007ffecbf7870c R14: 00007ffecbf78720 R15: 00007ffecbf78710
</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.

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,
Feb 23, 2024, 3:51:23 AMFeb 23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d6b58cc171f4 ANDROID: PCI: dwc: Wait for the link only if ..
git tree: android14-6.1
console output: https://syzkaller.appspot.com/x/log.txt?x=100f41c2180000
kernel config: https://syzkaller.appspot.com/x/.config?x=54c503ca94c7e582
dashboard link: https://syzkaller.appspot.com/bug?extid=e26f359a082bbc0c3949
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=11d56672180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14d55ce2180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/edff6a1babd6/disk-d6b58cc1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ac14e159c51a/vmlinux-d6b58cc1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/77d67f0b11ab/bzImage-d6b58cc1.xz

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

softirq: huh, entered softirq 3 NET_RX ffffffff840a38e0 with preempt_count 00000103, exited with 00000102?
================================================================================
UBSAN: array-index-out-of-bounds in kernel/bpf/helpers.c:776:13
index -1 is out of range for type 'char[3][512]'
CPU: 1 PID: 23 Comm: ksoftirqd/1 Not tainted 6.1.68-syzkaller-00027-gd6b58cc171f4 #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+0x151/0x1b7 lib/dump_stack.c:106
dump_stack+0x15/0x1b lib/dump_stack.c:113
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0x13a/0x160 lib/ubsan.c:282
try_get_fmt_tmp_buf kernel/bpf/helpers.c:776 [inline]
bpf_bprintf_prepare+0x132e/0x1360 kernel/bpf/helpers.c:818
____bpf_trace_printk kernel/trace/bpf_trace.c:385 [inline]
bpf_trace_printk+0x14a/0x300 kernel/trace/bpf_trace.c:376
bpf_prog_cfddb232a7dfb698+0x2f/0x33
bpf_dispatcher_nop_func include/linux/bpf.h:982 [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:2275 [inline]
bpf_trace_run3+0x177/0x2e0 kernel/trace/bpf_trace.c:2315
__bpf_trace_kmem_cache_free+0x99/0xc0 include/trace/events/kmem.h:114
__traceiter_kmem_cache_free+0x32/0x50 include/trace/events/kmem.h:114
trace_kmem_cache_free include/trace/events/kmem.h:114 [inline]
kmem_cache_free+0x4e7/0x510 mm/slub.c:3705
put_pid kernel/pid.c:114 [inline]
delayed_put_pid+0xb6/0x120 kernel/pid.c:123
rcu_do_batch+0x518/0xb70 kernel/rcu/tree.c:2264
rcu_core+0x4ee/0xf10 kernel/rcu/tree.c:2524
rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2541
__do_softirq+0x1d8/0x661 kernel/softirq.c:617
run_ksoftirqd+0x23/0x30 kernel/softirq.c:989
smpboot_thread_fn+0x466/0x8d0 kernel/smpboot.c:164
kthread+0x26d/0x300 kernel/kthread.c:376
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
</TASK>
================================================================================
softirq: huh, entered softirq 9 RCU ffffffff8160c1b0 with preempt_count 00000100, exited with 00000101?
Reply all
Reply to author
Forward
0 new messages