syzbot


KASAN: use-after-free Read in ip_defrag

Status: auto-closed as invalid on 2019/02/22 10:34
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+e6a2cea7e8fc44b2bf7c@syzkaller.appspotmail.com
First crash: 2795d, last: 2795d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in ip_defrag 0 (1) 2018/01/04 12:43

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in ip_frag_queue net/ipv4/ip_fragment.c:413 [inline]
BUG: KASAN: use-after-free in ip_defrag+0x3d64/0x4140 net/ipv4/ip_fragment.c:682
Read of size 4 at addr ffff8801d4131100 by task syz-executor2/13372

CPU: 1 PID: 13372 Comm: syz-executor2 Not tainted 4.15.0-rc5+ #170
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
 ip_frag_queue net/ipv4/ip_fragment.c:413 [inline]
 ip_defrag+0x3d64/0x4140 net/ipv4/ip_fragment.c:682
 ip_local_deliver+0x174/0x6e0 net/ipv4/ip_input.c:253
 dst_input include/net/dst.h:449 [inline]
 ip_rcv_finish+0x881/0x19a0 net/ipv4/ip_input.c:397
 NF_HOOK include/linux/netfilter.h:250 [inline]
 ip_rcv+0xc3f/0x1820 net/ipv4/ip_input.c:493
 __netif_receive_skb_core+0x1a3e/0x3450 net/core/dev.c:4499
 __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4564
 netif_receive_skb_internal+0x10b/0x670 net/core/dev.c:4638
 napi_frags_finish net/core/dev.c:5079 [inline]
 napi_gro_frags+0x57b/0xad0 net/core/dev.c:5152
 tun_get_user+0x271f/0x3900 drivers/net/tun.c:1791
 tun_chr_write_iter+0xb9/0x160 drivers/net/tun.c:1836
 call_write_iter include/linux/fs.h:1772 [inline]
 do_iter_readv_writev+0x525/0x7f0 fs/read_write.c:653
 do_iter_write+0x154/0x540 fs/read_write.c:932
 vfs_writev+0x18a/0x340 fs/read_write.c:977
 do_writev+0xfc/0x2a0 fs/read_write.c:1012
 SYSC_writev fs/read_write.c:1085 [inline]
 SyS_writev+0x27/0x30 fs/read_write.c:1082
 entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x4529a1
RSP: 002b:00007fc69300cb80 EFLAGS: 00000293 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 0000000020b92000 RCX: 00000000004529a1
RDX: 0000000000000001 RSI: 00007fc69300cbd0 RDI: 0000000000000012
RBP: 0000000000000042 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000003f R11: 0000000000000293 R12: 00000000006f68a8
R13: 00000000ffffffff R14: 00007fc69300d6d4 R15: 0000000000000000

Allocated by task 3190:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3544
 skb_clone+0x1ae/0x480 net/core/skbuff.c:1279
 dev_queue_xmit_nit+0x40e/0xc40 net/core/dev.c:1948
 xmit_one net/core/dev.c:3004 [inline]
 dev_hard_start_xmit+0x16b/0xac0 net/core/dev.c:3024
 sch_direct_xmit+0x42b/0xe80 net/sched/sch_generic.c:314
 qdisc_restart net/sched/sch_generic.c:380 [inline]
 __qdisc_run+0x571/0x19b0 net/sched/sch_generic.c:388
 __dev_xmit_skb net/core/dev.c:3188 [inline]
 __dev_queue_xmit+0xb1f/0x2590 net/core/dev.c:3489
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3554
 neigh_hh_output include/net/neighbour.h:472 [inline]
 neigh_output include/net/neighbour.h:480 [inline]
 ip_finish_output2+0xeed/0x14f0 net/ipv4/ip_output.c:229
 ip_finish_output+0x85e/0xd10 net/ipv4/ip_output.c:317
 NF_HOOK_COND include/linux/netfilter.h:239 [inline]
 ip_output+0x1cc/0x860 net/ipv4/ip_output.c:405
 dst_output include/net/dst.h:443 [inline]
 ip_local_out+0x95/0x160 net/ipv4/ip_output.c:124
 ip_queue_xmit+0x8c0/0x18e0 net/ipv4/ip_output.c:504
 tcp_transmit_skb+0x1b12/0x38b0 net/ipv4/tcp_output.c:1176
 tcp_write_xmit+0x680/0x5190 net/ipv4/tcp_output.c:2367
 __tcp_push_pending_frames+0xa0/0x250 net/ipv4/tcp_output.c:2540
 tcp_push+0x538/0x770 net/ipv4/tcp.c:728
 tcp_sendmsg_locked+0x2870/0x3c40 net/ipv4/tcp.c:1428
 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1465
 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:764
 sock_sendmsg_nosec net/socket.c:628 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:638
 sock_write_iter+0x31a/0x5d0 net/socket.c:907
 call_write_iter include/linux/fs.h:1772 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x684/0x970 fs/read_write.c:482
 vfs_write+0x189/0x510 fs/read_write.c:544
 SYSC_write fs/read_write.c:589 [inline]
 SyS_write+0xef/0x220 fs/read_write.c:581
 entry_SYSCALL_64_fastpath+0x1f/0x96

Freed by task 3190:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3488 [inline]
 kmem_cache_free+0x83/0x2a0 mm/slab.c:3746
 kfree_skbmem+0x1a1/0x1d0 net/core/skbuff.c:582
 __kfree_skb net/core/skbuff.c:642 [inline]
 kfree_skb+0x165/0x4c0 net/core/skbuff.c:659
 packet_rcv_spkt+0x117/0x5b0 net/packet/af_packet.c:1872
 dev_queue_xmit_nit+0x866/0xc40 net/core/dev.c:1980
 xmit_one net/core/dev.c:3004 [inline]
 dev_hard_start_xmit+0x16b/0xac0 net/core/dev.c:3024
 sch_direct_xmit+0x42b/0xe80 net/sched/sch_generic.c:314
 qdisc_restart net/sched/sch_generic.c:380 [inline]
 __qdisc_run+0x571/0x19b0 net/sched/sch_generic.c:388
 __dev_xmit_skb net/core/dev.c:3188 [inline]
 __dev_queue_xmit+0xb1f/0x2590 net/core/dev.c:3489
 dev_queue_xmit+0x17/0x20 net/core/dev.c:3554
 neigh_hh_output include/net/neighbour.h:472 [inline]
 neigh_output include/net/neighbour.h:480 [inline]
 ip_finish_output2+0xeed/0x14f0 net/ipv4/ip_output.c:229
 ip_finish_output+0x85e/0xd10 net/ipv4/ip_output.c:317
 NF_HOOK_COND include/linux/netfilter.h:239 [inline]
 ip_output+0x1cc/0x860 net/ipv4/ip_output.c:405
 dst_output include/net/dst.h:443 [inline]
 ip_local_out+0x95/0x160 net/ipv4/ip_output.c:124
 ip_queue_xmit+0x8c0/0x18e0 net/ipv4/ip_output.c:504
 tcp_transmit_skb+0x1b12/0x38b0 net/ipv4/tcp_output.c:1176
 tcp_write_xmit+0x680/0x5190 net/ipv4/tcp_output.c:2367
 __tcp_push_pending_frames+0xa0/0x250 net/ipv4/tcp_output.c:2540
 tcp_push+0x538/0x770 net/ipv4/tcp.c:728
 tcp_sendmsg_locked+0x2870/0x3c40 net/ipv4/tcp.c:1428
 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1465
 inet_sendmsg+0x11f/0x5e0 net/ipv4/af_inet.c:764
 sock_sendmsg_nosec net/socket.c:628 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:638
 sock_write_iter+0x31a/0x5d0 net/socket.c:907
 call_write_iter include/linux/fs.h:1772 [inline]
 new_sync_write fs/read_write.c:469 [inline]
 __vfs_write+0x684/0x970 fs/read_write.c:482
 vfs_write+0x189/0x510 fs/read_write.c:544
 SYSC_write fs/read_write.c:589 [inline]
 SyS_write+0xef/0x220 fs/read_write.c:581
 entry_SYSCALL_64_fastpath+0x1f/0x96

The buggy address belongs to the object at ffff8801d41310c0
 which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 64 bytes inside of
 224-byte region [ffff8801d41310c0, ffff8801d41311a0)
The buggy address belongs to the page:
page:00000000f21301b4 count:1 mapcount:0 mapping:00000000324eb6c2 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801d41310c0 0000000000000000 000000010000000c
raw: ffffea00073f69e0 ffffea000744efa0 ffff8801d986bcc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d4131000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801d4131080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8801d4131100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8801d4131180: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801d4131200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/12/31 05:58 net-next-old 6bb8824732f6 bb6384b8 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.