syzbot


KASAN: use-after-free Read in iptunnel_handle_offloads

Status: public: reported C repro on 2019/04/13 00:00
Reported-by: syzbot+76502184b20240d31f1c@syzkaller.appspotmail.com
First crash: 2403d, last: 2373d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in iptunnel_handle_offloads net C 133 2373d 2418d 5/28 fixed on 2018/06/18 18:00

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): veth1: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
protocol 0800 is buggy, dev sit0
==================================================================
BUG: KASAN: use-after-free in skb_is_gso include/linux/skbuff.h:3766 [inline]
BUG: KASAN: use-after-free in iptunnel_handle_offloads+0x462/0x520 net/ipv4/ip_tunnel_core.c:168
Read of size 2 at addr ffff8801ced39742 by task syz-executor259/3809

CPU: 0 PID: 3809 Comm: syz-executor259 Not tainted 4.9.97-g1321d42 #13
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801d97d72e0 ffffffff81eb0b69 ffffea00073b4e00 ffff8801ced39742
 0000000000000000 ffff8801ced39742 ffff8801cbc2fac8 ffff8801d97d7318
 ffffffff8156540b ffff8801ced39742 0000000000000002 0000000000000000
Call Trace:
 [<ffffffff81eb0b69>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81eb0b69>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff8156540b>] print_address_description+0x6c/0x234 mm/kasan/report.c:256
 [<ffffffff81565815>] kasan_report_error mm/kasan/report.c:355 [inline]
 [<ffffffff81565815>] kasan_report.cold.6+0x242/0x2fe mm/kasan/report.c:412
 [<ffffffff81539454>] __asan_report_load2_noabort+0x14/0x20 mm/kasan/report.c:431
 [<ffffffff83467972>] skb_is_gso include/linux/skbuff.h:3766 [inline]
 [<ffffffff83467972>] iptunnel_handle_offloads+0x462/0x520 net/ipv4/ip_tunnel_core.c:168
 [<ffffffff8366e99b>] sit_tunnel_xmit__ net/ipv6/sit.c:997 [inline]
 [<ffffffff8366e99b>] sit_tunnel_xmit+0x15b/0x2590 net/ipv6/sit.c:1015
 [<ffffffff830858b7>] __netdev_start_xmit include/linux/netdevice.h:4062 [inline]
 [<ffffffff830858b7>] netdev_start_xmit include/linux/netdevice.h:4071 [inline]
 [<ffffffff830858b7>] xmit_one net/core/dev.c:2955 [inline]
 [<ffffffff830858b7>] dev_hard_start_xmit+0x197/0x8b0 net/core/dev.c:2971
 [<ffffffff83087c35>] __dev_queue_xmit+0x19a5/0x2080 net/core/dev.c:3451
 [<ffffffff83088327>] dev_queue_xmit+0x17/0x20 net/core/dev.c:3484
 [<ffffffff8368d85f>] packet_snd net/packet/af_packet.c:2960 [inline]
 [<ffffffff8368d85f>] packet_sendmsg+0x1eff/0x4470 net/packet/af_packet.c:2985
 [<ffffffff83012fcc>] sock_sendmsg_nosec net/socket.c:635 [inline]
 [<ffffffff83012fcc>] sock_sendmsg+0xcc/0x110 net/socket.c:645
 [<ffffffff830147ea>] ___sys_sendmsg+0x47a/0x840 net/socket.c:1969
 [<ffffffff83016d41>] __sys_sendmmsg+0x161/0x3d0 net/socket.c:2059
 [<ffffffff83016fe5>] SYSC_sendmmsg net/socket.c:2090 [inline]
 [<ffffffff83016fe5>] SyS_sendmmsg+0x35/0x60 net/socket.c:2085
 [<ffffffff81006316>] do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 [<ffffffff839f4653>] entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Allocated by task 3809:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:609
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:547
 slab_post_alloc_hook mm/slab.h:417 [inline]
 slab_alloc_node mm/slub.c:2715 [inline]
 slab_alloc mm/slub.c:2723 [inline]
 __kmalloc_track_caller+0xdc/0x2b0 mm/slub.c:4232
 __kmalloc_reserve.isra.37+0x33/0xc0 net/core/skbuff.c:138
 __alloc_skb+0x11a/0x600 net/core/skbuff.c:231
 alloc_skb include/linux/skbuff.h:919 [inline]
 alloc_skb_with_frags+0xaf/0x520 net/core/skbuff.c:4678
 sock_alloc_send_pskb+0x5a9/0x750 net/core/sock.c:1893
 packet_alloc_skb net/packet/af_packet.c:2817 [inline]
 packet_snd net/packet/af_packet.c:2908 [inline]
 packet_sendmsg+0x1581/0x4470 net/packet/af_packet.c:2985
 sock_sendmsg_nosec net/socket.c:635 [inline]
 sock_sendmsg+0xcc/0x110 net/socket.c:645
 ___sys_sendmsg+0x47a/0x840 net/socket.c:1969
 __sys_sendmmsg+0x161/0x3d0 net/socket.c:2059
 SYSC_sendmmsg net/socket.c:2090 [inline]
 SyS_sendmmsg+0x35/0x60 net/socket.c:2085
 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

Freed by task 3809:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kfree+0xfb/0x310 mm/slub.c:3878
 skb_free_head+0x8b/0xb0 net/core/skbuff.c:580
 skb_release_data+0x329/0x400 net/core/skbuff.c:611
 skb_release_all+0x4a/0x60 net/core/skbuff.c:670
 __kfree_skb net/core/skbuff.c:684 [inline]
 consume_skb+0xc6/0x340 net/core/skbuff.c:757
 packet_rcv+0xe2/0x11e0 net/packet/af_packet.c:2140
 dev_queue_xmit_nit+0x5d7/0x820 net/core/dev.c:1928
 xmit_one net/core/dev.c:2951 [inline]
 dev_hard_start_xmit+0xa6/0x8b0 net/core/dev.c:2971
 __dev_queue_xmit+0x19a5/0x2080 net/core/dev.c:3451
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3484
 packet_snd net/packet/af_packet.c:2960 [inline]
 packet_sendmsg+0x1eff/0x4470 net/packet/af_packet.c:2985
 sock_sendmsg_nosec net/socket.c:635 [inline]
 sock_sendmsg+0xcc/0x110 net/socket.c:645
 ___sys_sendmsg+0x47a/0x840 net/socket.c:1969
 __sys_sendmmsg+0x161/0x3d0 net/socket.c:2059
 SYSC_sendmmsg net/socket.c:2090 [inline]
 SyS_sendmmsg+0x35/0x60 net/socket.c:2085
 do_syscall_64+0x1a6/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x5d/0xdb

The buggy address belongs to the object at ffff8801ced39680
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 194 bytes inside of
 512-byte region [ffff8801ced39680, ffff8801ced39880)
The buggy address belongs to the page:
page:ffffea00073b4e00 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x8000000000004080(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ced39600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801ced39680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801ced39700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff8801ced39780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801ced39800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/05/02 09:07 https://android.googlesource.com/kernel/common android-4.9 1321d4226176 d5b114b4 .config console log report syz C ci-android-49-kasan-gce-root
2018/05/23 23:08 https://android.googlesource.com/kernel/common android-4.9 d054505522c4 f48c20b8 .config console log report ci-android-49-kasan-gce-root
2018/05/21 04:44 https://android.googlesource.com/kernel/common android-4.9 aef17a58e8ca f48c20b8 .config console log report ci-android-49-kasan-gce-root
2018/05/20 07:59 https://android.googlesource.com/kernel/common android-4.9 aef17a58e8ca f48c20b8 .config console log report ci-android-49-kasan-gce-root
2018/05/19 17:00 https://android.googlesource.com/kernel/common android-4.9 e14d1a35ebd9 849705db .config console log report ci-android-49-kasan-gce-root
2018/05/16 20:35 https://android.googlesource.com/kernel/common android-4.9 39c856663dcc 75b2448a .config console log report ci-android-49-kasan-gce-root
2018/05/12 16:37 https://android.googlesource.com/kernel/common android-4.9 c2f9bce9fee8 e726f42b .config console log report ci-android-49-kasan-gce-root
2018/05/11 14:32 https://android.googlesource.com/kernel/common android-4.9 c462abbf779b 12c7428a .config console log report ci-android-49-kasan-gce-root
2018/05/06 01:24 https://android.googlesource.com/kernel/common android-4.9 63a812bb84e4 78b251cb .config console log report ci-android-49-kasan-gce-root
2018/05/03 03:42 https://android.googlesource.com/kernel/common android-4.9 f679e4d9b77a d5b114b4 .config console log report ci-android-49-kasan-gce-root
2018/05/02 08:17 https://android.googlesource.com/kernel/common android-4.9 1321d4226176 d5b114b4 .config console log report ci-android-49-kasan-gce-root
2018/04/27 13:10 https://android.googlesource.com/kernel/common android-4.9 71fce1edd26d 73417389 .config console log report ci-android-49-kasan-gce-root
2018/04/26 22:24 https://android.googlesource.com/kernel/common android-4.9 71fce1edd26d 73417389 .config console log report ci-android-49-kasan-gce-root
2018/04/25 14:03 https://android.googlesource.com/kernel/common android-4.9 320d53a9d07c 73417389 .config console log report ci-android-49-kasan-gce-root
2018/04/24 05:52 https://android.googlesource.com/kernel/common android-4.9 142d4b530f5a e7e85d36 .config console log report ci-android-49-kasan-gce-root
* Struck through repros no longer work on HEAD.