WARNING in ipvlan_queue_xmit

Status: internal: reported C repro on 2022/08/30 03:23
Fix commit: 81225b2ea161 ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header
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: 152d, last: 152d

Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: KASAN: use-after-free Read in ipvlan_queue_xmit (log)
Repro: C syz .config

Sample crash report:
------------[ cut here ]------------
WARNING: CPU: 1 PID: 3606 at include/linux/skbuff.h:2821 skb_mac_header include/linux/skbuff.h:2821 [inline]
WARNING: CPU: 1 PID: 3606 at include/linux/skbuff.h:2821 eth_hdr include/linux/if_ether.h:24 [inline]
WARNING: CPU: 1 PID: 3606 at include/linux/skbuff.h:2821 ipvlan_xmit_mode_l2 drivers/net/ipvlan/ipvlan_core.c:592 [inline]
WARNING: CPU: 1 PID: 3606 at include/linux/skbuff.h:2821 ipvlan_queue_xmit+0xcba/0x19d0 drivers/net/ipvlan/ipvlan_core.c:644
Modules linked in:
CPU: 1 PID: 3606 Comm: syz-executor247 Not tainted 6.0.0-rc3-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
RIP: 0010:skb_mac_header include/linux/skbuff.h:2821 [inline]
RIP: 0010:eth_hdr include/linux/if_ether.h:24 [inline]
RIP: 0010:ipvlan_xmit_mode_l2 drivers/net/ipvlan/ipvlan_core.c:592 [inline]
RIP: 0010:ipvlan_queue_xmit+0xcba/0x19d0 drivers/net/ipvlan/ipvlan_core.c:644
Code: 41 0f b7 d6 48 c7 c6 40 c7 75 8a 48 c7 c7 c0 c4 75 8a c6 05 7d 52 d9 08 01 e8 df 0d 4a 04 0f 0b e9 e5 f7 ff ff e8 66 cb 8b fc <0f> 0b e9 ac f8 ff ff e8 6a 35 d8 fc e9 ed f4 ff ff e8 70 35 d8 fc
RSP: 0018:ffffc9000386f808 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88802115c000 RCX: 0000000000000000
RDX: ffff88802452d880 RSI: ffffffff84f03eca RDI: 0000000000000003
RBP: ffffc9000386f9b8 R08: 0000000000000003 R09: 000000000000ffff
R10: 000000000000ffff R11: 0000000000000000 R12: ffff8880738a3c80
R13: 1ffff9200070df06 R14: 000000000000ffff R15: ffff88802115cca0
FS:  0000555556977300(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000080 CR3: 0000000020b38000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ipvlan_start_xmit+0x45/0x150 drivers/net/ipvlan/ipvlan_main.c:220
 __netdev_start_xmit include/linux/netdevice.h:4819 [inline]
 netdev_start_xmit include/linux/netdevice.h:4833 [inline]
 __dev_direct_xmit+0x500/0x720 net/core/dev.c:4312
 dev_direct_xmit include/linux/netdevice.h:3021 [inline]
 packet_direct_xmit+0x1b3/0x2c0 net/packet/af_packet.c:282
 packet_snd net/packet/af_packet.c:3073 [inline]
 packet_sendmsg+0x3354/0x5500 net/packet/af_packet.c:3104
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:734
 __sys_sendto+0x236/0x340 net/socket.c:2117
 __do_sys_sendto net/socket.c:2129 [inline]
 __se_sys_sendto net/socket.c:2125 [inline]
 __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2125
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
RIP: 0033:0x7fc8465ec669
Code: 28 c3 e8 4a 15 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:00007ffe2e0c0158 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007ffe2e0c0178 RCX: 00007fc8465ec669
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000003 R08: 00000000200000c0 R09: 0000000000000014
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe2e0c0180
R13: 00007ffe2e0c01a0 R14: 0000000000000000 R15: 0000000000000000

Crashes (4):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce 2022/08/30 03:54 upstream b90cb1053190 5b44472d .config strace log report syz C WARNING in ipvlan_queue_xmit
ci-upstream-net-this-kasan-gce 2022/08/30 08:16 net cb10b0f91c5f 5b44472d .config strace log report syz C WARNING in ipvlan_queue_xmit
ci-upstream-net-kasan-gce 2022/08/30 04:23 net-next f97e971dbdc7 5b44472d .config strace log report syz C WARNING in ipvlan_queue_xmit
ci-upstream-kasan-gce 2022/08/30 03:22 upstream b90cb1053190 5b44472d .config console log report info WARNING in ipvlan_queue_xmit
* Struck through repros no longer work on HEAD.