syzbot


KASAN: use-after-free Read in ip6_tnl_start_xmit

Status: fixed on 2018/09/06 10:53
Subsystems: net
[Documentation on labels]
Fix commit: b84bbaf7a6c8 packet: in packet_snd start writing at link layer allocation
First crash: 2179d, last: 2179d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: use-after-free Read in ip6_tnl_start_xmit C 39 1608d 1833d 0/3 public: reported C repro on 2019/04/13 00:00

Sample crash report:
netlink: 16 bytes leftover after parsing attributes in process `syz-executor4'.
netlink: 84 bytes leftover after parsing attributes in process `syz-executor6'.
netlink: 16 bytes leftover after parsing attributes in process `syz-executor4'.
protocol 86dd is buggy, dev ip6tnl0
==================================================================
BUG: KASAN: use-after-free in ipv6_addr_equal include/net/ipv6.h:507 [inline]
BUG: KASAN: use-after-free in ip6_tnl_addr_conflict net/ipv6/ip6_tunnel.c:975 [inline]
BUG: KASAN: use-after-free in ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1315 [inline]
BUG: KASAN: use-after-free in ip6_tnl_start_xmit+0x1f59/0x2290 net/ipv6/ip6_tunnel.c:1397
Read of size 8 at addr ffff8801b0abdbe0 by task syz-executor6/18539

CPU: 1 PID: 18539 Comm: syz-executor6 Not tainted 4.17.0-rc3+ #26
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 ipv6_addr_equal include/net/ipv6.h:507 [inline]
 ip6_tnl_addr_conflict net/ipv6/ip6_tunnel.c:975 [inline]
 ip6ip6_tnl_xmit net/ipv6/ip6_tunnel.c:1315 [inline]
 ip6_tnl_start_xmit+0x1f59/0x2290 net/ipv6/ip6_tunnel.c:1397
 __netdev_start_xmit include/linux/netdevice.h:4087 [inline]
 netdev_start_xmit include/linux/netdevice.h:4096 [inline]
 xmit_one net/core/dev.c:3053 [inline]
 dev_hard_start_xmit+0x264/0xc10 net/core/dev.c:3069
 __dev_queue_xmit+0x2724/0x34c0 net/core/dev.c:3584
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3617
 packet_snd net/packet/af_packet.c:2951 [inline]
 packet_sendmsg+0x40f8/0x6070 net/packet/af_packet.c:2976
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:639
 ___sys_sendmsg+0x525/0x940 net/socket.c:2117
 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2212
 __do_sys_sendmmsg net/socket.c:2241 [inline]
 __se_sys_sendmmsg net/socket.c:2238 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2238
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455979
RSP: 002b:00007f606b1d7c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f606b1d86d4 RCX: 0000000000455979
RDX: 0000000000000002 RSI: 0000000020000100 RDI: 0000000000000013
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000515 R14: 00000000006fba98 R15: 0000000000000000

Allocated by task 18539:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 __do_kmalloc_node mm/slab.c:3682 [inline]
 __kmalloc_node_track_caller+0x47/0x70 mm/slab.c:3696
 __kmalloc_reserve.isra.38+0x3a/0xe0 net/core/skbuff.c:137
 __alloc_skb+0x14d/0x780 net/core/skbuff.c:205
 alloc_skb include/linux/skbuff.h:987 [inline]
 alloc_skb_with_frags+0x137/0x760 net/core/skbuff.c:5249
 sock_alloc_send_pskb+0x87a/0xae0 net/core/sock.c:2088
 packet_alloc_skb net/packet/af_packet.c:2810 [inline]
 packet_snd net/packet/af_packet.c:2901 [inline]
 packet_sendmsg+0x1b98/0x6070 net/packet/af_packet.c:2976
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:639
 ___sys_sendmsg+0x525/0x940 net/socket.c:2117
 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2212
 __do_sys_sendmmsg net/socket.c:2241 [inline]
 __se_sys_sendmmsg net/socket.c:2238 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2238
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 18539:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 skb_free_head+0x99/0xc0 net/core/skbuff.c:550
 skb_release_data+0x690/0x860 net/core/skbuff.c:570
 skb_release_all+0x4a/0x60 net/core/skbuff.c:627
 __kfree_skb net/core/skbuff.c:641 [inline]
 consume_skb+0x18b/0x550 net/core/skbuff.c:701
 packet_rcv+0x16a/0x1810 net/packet/af_packet.c:2169
 dev_queue_xmit_nit+0x891/0xb90 net/core/dev.c:2018
 xmit_one net/core/dev.c:3049 [inline]
 dev_hard_start_xmit+0x16b/0xc10 net/core/dev.c:3069
 __dev_queue_xmit+0x2724/0x34c0 net/core/dev.c:3584
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3617
 packet_snd net/packet/af_packet.c:2951 [inline]
 packet_sendmsg+0x40f8/0x6070 net/packet/af_packet.c:2976
 sock_sendmsg_nosec net/socket.c:629 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:639
 ___sys_sendmsg+0x525/0x940 net/socket.c:2117
 __sys_sendmmsg+0x240/0x6f0 net/socket.c:2212
 __do_sys_sendmmsg net/socket.c:2241 [inline]
 __se_sys_sendmmsg net/socket.c:2238 [inline]
 __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2238
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801b0abdac0
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 288 bytes inside of
 512-byte region [ffff8801b0abdac0, ffff8801b0abdcc0)
The buggy address belongs to the page:
page:ffffea0006c2af40 count:1 mapcount:0 mapping:ffff8801b0abd0c0 index:0xffff8801b0abd340
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801b0abd0c0 ffff8801b0abd340 0000000100000005
raw: ffffea00070d94a0 ffffea0007593660 ffff8801da800940 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b0abda80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8801b0abdb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801b0abdb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8801b0abdc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b0abdc80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/05/01 11:21 upstream 8188fc8bef8c d5b114b4 .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.