syzbot


KASAN: use-after-free Read in packet_rcv_spkt

Status: closed as invalid on 2017/11/07 17:19
Subsystems: net
[Documentation on labels]
First crash: 2862d, last: 2862d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in skb_dst_drop include/net/dst.h:297 [inline]
BUG: KASAN: use-after-free in packet_rcv_spkt+0x4c3/0x5b0 net/packet/af_packet.c:1858
Read of size 8 at addr ffff8801ccbe7698 by task syz-executor2/3265

CPU: 1 PID: 3265 Comm: syz-executor2 Not tainted 4.14.0-rc5-mm1+ #19
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 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_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 skb_dst_drop include/net/dst.h:297 [inline]
 packet_rcv_spkt+0x4c3/0x5b0 net/packet/af_packet.c:1858
 deliver_skb net/core/dev.c:1887 [inline]
 deliver_ptype_list_skb net/core/dev.c:1902 [inline]
 __netif_receive_skb_core+0xc42/0x34b0 net/core/dev.c:4460
 __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4515
 netif_receive_skb_internal+0x10b/0x670 net/core/dev.c:4588
 napi_skb_finish net/core/dev.c:4950 [inline]
 napi_gro_receive+0x3d0/0x500 net/core/dev.c:4981
 receive_buf+0xc40/0x4e20 drivers/net/virtio_net.c:883
 virtnet_receive drivers/net/virtio_net.c:1128 [inline]
 virtnet_poll+0x359/0xbc0 drivers/net/virtio_net.c:1210
 napi_poll net/core/dev.c:5592 [inline]
 net_rx_action+0x792/0x1910 net/core/dev.c:5658
 __do_softirq+0x2d7/0xb85 kernel/softirq.c:284
 invoke_softirq kernel/softirq.c:364 [inline]
 irq_exit+0x1cc/0x200 kernel/softirq.c:405
 exiting_irq arch/x86/include/asm/apic.h:540 [inline]
 do_IRQ+0xeb/0x190 arch/x86/kernel/irq.c:253
 common_interrupt+0x9d/0x9d arch/x86/entry/entry_64.S:598
 </IRQ>
RIP: 0010:arch_local_irq_enable arch/x86/include/asm/paravirt.h:787 [inline]
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x56/0x70 kernel/locking/spinlock.c:197
RSP: 0018:ffff8801ca1877f8 EFLAGS: 00000286 ORIG_RAX: ffffffffffffffd9
RAX: dffffc0000000000 RBX: ffff8801db3256c0 RCX: 0000000000000000
RDX: 1ffffffff0b58f3b RSI: 0000000000000001 RDI: ffffffff85ac79d8
RBP: ffff8801ca187800 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801b794c040
R13: 1ffff10039430f08 R14: ffff8801ca088280 R15: ffff8801ca088280
 finish_lock_switch kernel/sched/sched.h:1349 [inline]
 finish_task_switch+0x1d3/0x740 kernel/sched/core.c:2665
 context_switch kernel/sched/core.c:2801 [inline]
 __schedule+0x8f3/0x2060 kernel/sched/core.c:3374
 schedule+0xf5/0x430 kernel/sched/core.c:3433
 freezable_schedule include/linux/freezer.h:171 [inline]
 do_nanosleep+0x224/0x6e0 kernel/time/hrtimer.c:1473
 hrtimer_nanosleep+0x2b2/0x860 kernel/time/hrtimer.c:1527
 SYSC_nanosleep kernel/time/hrtimer.c:1559 [inline]
 SyS_nanosleep+0x175/0x1f0 kernel/time/hrtimer.c:1546
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x47dd60
RSP: 002b:0000000000a6fa08 EFLAGS: 00000246 ORIG_RAX: 0000000000000023
RAX: ffffffffffffffda RBX: 000000000109e914 RCX: 000000000047dd60
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000a6fa10
RBP: 0000000000000082 R08: 0000000000000001 R09: 000000000109e940
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000b65
R13: 0000000000000015 R14: 0000000000031cd1 R15: 0000000000000010

Allocated by task 3265:
 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:3548
 skb_clone+0x1ae/0x480 net/core/skbuff.c:1274
 skb_share_check include/linux/skbuff.h:1505 [inline]
 packet_rcv_spkt+0x1da/0x5b0 net/packet/af_packet.c:1853
 deliver_skb net/core/dev.c:1887 [inline]
 deliver_ptype_list_skb net/core/dev.c:1902 [inline]
 __netif_receive_skb_core+0xc42/0x34b0 net/core/dev.c:4460
 __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4515
 netif_receive_skb_internal+0x10b/0x670 net/core/dev.c:4588
 napi_skb_finish net/core/dev.c:4950 [inline]
 napi_gro_receive+0x3d0/0x500 net/core/dev.c:4981
 receive_buf+0xc40/0x4e20 drivers/net/virtio_net.c:883
 virtnet_receive drivers/net/virtio_net.c:1128 [inline]
 virtnet_poll+0x359/0xbc0 drivers/net/virtio_net.c:1210
 napi_poll net/core/dev.c:5592 [inline]
 net_rx_action+0x792/0x1910 net/core/dev.c:5658
 __do_softirq+0x2d7/0xb85 kernel/softirq.c:284

Freed by task 3265:
 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:3492 [inline]
 kmem_cache_free+0x77/0x280 mm/slab.c:3750
 kfree_skbmem+0x1a1/0x1d0 net/core/skbuff.c:582
 __kfree_skb net/core/skbuff.c:642 [inline]
 consume_skb+0x15b/0x490 net/core/skbuff.c:701
 skb_share_check include/linux/skbuff.h:1508 [inline]
 packet_rcv_spkt+0x1f6/0x5b0 net/packet/af_packet.c:1853
 deliver_skb net/core/dev.c:1887 [inline]
 deliver_ptype_list_skb net/core/dev.c:1902 [inline]
 __netif_receive_skb_core+0xc42/0x34b0 net/core/dev.c:4460
 __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4515
 netif_receive_skb_internal+0x10b/0x670 net/core/dev.c:4588
 napi_skb_finish net/core/dev.c:4950 [inline]
 napi_gro_receive+0x3d0/0x500 net/core/dev.c:4981
 receive_buf+0xc40/0x4e20 drivers/net/virtio_net.c:883
 virtnet_receive drivers/net/virtio_net.c:1128 [inline]
 virtnet_poll+0x359/0xbc0 drivers/net/virtio_net.c:1210
 napi_poll net/core/dev.c:5592 [inline]
 net_rx_action+0x792/0x1910 net/core/dev.c:5658
 __do_softirq+0x2d7/0xb85 kernel/softirq.c:284

The buggy address belongs to the object at ffff8801ccbe7640
 which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 88 bytes inside of
 224-byte region [ffff8801ccbe7640, ffff8801ccbe7720)
The buggy address belongs to the page:
page:ffffea000732f9c0 count:1 mapcount:0 mapping:ffff8801ccbe7000 index:0x0
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801ccbe7000 0000000000000000 000000010000000c
raw: ffffea00073a3920 ffffea000721fba0 ffff8801d9897e40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ccbe7580: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8801ccbe7600: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8801ccbe7680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff8801ccbe7700: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801ccbe7780: 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/10/20 01:37 mmots 65302eba00ae 4d9c0713 .config console log report ci-upstream-mmots-kasan-gce
* Struck through repros no longer work on HEAD.