syzbot


WARNING in bpf_skb_load_helper_16_no_cache

Status: internal: reported C repro on 2022/07/03 01:31
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: 0326195f523a bpf: Make sure mac_header was set before using it
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: 218d, last: 189d

Cause bisection: introduced by (bisect log) :
commit f9aefd6b2aa38b9787d2705f0f1161dfd23cdb8f
Author: Eric Dumazet <edumazet@google.com>
Date: Mon Jun 20 09:30:17 2022 +0000

  net: warn if mac header was not set

Crash: WARNING in bpf_skb_load_helper_16_no_cache (log)
Repro: C syz .config

Sample crash report:
netlink: 'syz-executor295': attribute type 21 has an invalid length.
netlink: 168 bytes leftover after parsing attributes in process `syz-executor295'.
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3607 at include/linux/skbuff.h:2785 skb_mac_header include/linux/skbuff.h:2785 [inline]
WARNING: CPU: 0 PID: 3607 at include/linux/skbuff.h:2785 bpf_internal_load_pointer_neg_helper+0x1b1/0x1c0 kernel/bpf/core.c:74
Modules linked in:
CPU: 0 PID: 3607 Comm: syz-executor295 Not tainted 5.19.0-rc4-syzkaller-00754-g04740c53cac4 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022
RIP: 0010:skb_mac_header include/linux/skbuff.h:2785 [inline]
RIP: 0010:bpf_internal_load_pointer_neg_helper+0x1b1/0x1c0 kernel/bpf/core.c:74
Code: ff ff 45 31 f6 e9 5a ff ff ff e8 aa 27 40 00 e9 3b ff ff ff e8 90 27 40 00 e9 df fe ff ff e8 86 27 40 00 eb 9e e8 2f 2c f3 ff <0f> 0b eb b1 e8 96 27 40 00 e9 79 fe ff ff 90 41 57 41 56 41 55 41
RSP: 0018:ffffc9000317f4f8 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffffffffffe10002 RCX: 0000000000000000
RDX: ffff888078393b00 RSI: ffffffff81873f21 RDI: 0000000000000003
RBP: ffff88801cd55280 R08: 0000000000000003 R09: 000000000000ffff
R10: 000000000000ffff R11: 0000000000000001 R12: 0000000000000002
R13: ffff888025f28000 R14: 000000000000ffff R15: 0000000000000000
FS:  00005555567cd300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f5d6198f300 CR3: 000000007d56f000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 ____bpf_skb_load_helper_16 net/core/filter.c:249 [inline]
 ____bpf_skb_load_helper_16_no_cache net/core/filter.c:260 [inline]
 bpf_skb_load_helper_16_no_cache+0x205/0x2b0 net/core/filter.c:257
 bpf_prog_e4a2190aaec26884+0x41/0x4c
 bpf_dispatcher_nop_func include/linux/bpf.h:885 [inline]
 __bpf_prog_run include/linux/filter.h:594 [inline]
 bpf_prog_run include/linux/filter.h:601 [inline]
 __bpf_prog_run_save_cb include/linux/filter.h:724 [inline]
 bpf_prog_run_save_cb include/linux/filter.h:738 [inline]
 sk_filter_trim_cap+0x27c/0x9a0 net/core/filter.c:151
 sk_filter include/linux/filter.h:864 [inline]
 netlink_unicast+0x1bf/0x7f0 net/netlink/af_netlink.c:1347
 nlmsg_unicast include/net/netlink.h:1050 [inline]
 netlink_ack+0x5cd/0xa80 net/netlink/af_netlink.c:2471
 netlink_rcv_skb+0x33d/0x420 net/netlink/af_netlink.c:2507
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x543/0x7f0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x917/0xe10 net/netlink/af_netlink.c:1921
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:734
 ____sys_sendmsg+0x6eb/0x810 net/socket.c:2485
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2539
 __sys_sendmsg net/socket.c:2568 [inline]
 __do_sys_sendmsg net/socket.c:2577 [inline]
 __se_sys_sendmsg net/socket.c:2575 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2575
 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+0x46/0xb0
RIP: 0033:0x7f693cc61e09
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdb4b45d48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f693cc61e09
RDX: 0000000000000000 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 00007f693cc25fb0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000004 R11: 0000000000000246 R12: 00007f693cc26040
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
 </TASK>

Crashes (6):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-net-kasan-gce 2022/07/03 02:14 net-next 04740c53cac4 1434eec0 .config strace log report syz C WARNING in bpf_skb_load_helper_16_no_cache
ci-upstream-net-kasan-gce 2022/07/03 01:57 net-next 04740c53cac4 1434eec0 .config strace log report syz C WARNING in bpf_skb_load_helper_16_no_cache
ci-upstream-linux-next-kasan-gce-root 2022/07/03 01:48 linux-next cb71b93c2dc3 1434eec0 .config strace log report syz C WARNING in bpf_skb_load_helper_16_no_cache
ci-upstream-net-kasan-gce 2022/07/03 01:38 net-next 04740c53cac4 1434eec0 .config console log report info WARNING in bpf_skb_load_helper_16_no_cache
ci-upstream-linux-next-kasan-gce-root 2022/08/01 21:39 linux-next cb71b93c2dc3 fef302b1 .config console log report info WARNING in bpf_skb_load_helper_16_no_cache
ci-upstream-linux-next-kasan-gce-root 2022/07/03 01:30 linux-next cb71b93c2dc3 1434eec0 .config console log report info WARNING in bpf_skb_load_helper_16_no_cache
* Struck through repros no longer work on HEAD.