syzbot


linux-next boot error: KASAN: use-after-free Read in page_to_skb

Status: fixed on 2021/11/10 00:50
Subsystems: net virt
[Documentation on labels]
Fix commit: af39c8f72301 virtio-net: fix use-after-free in page_to_skb()
First crash: 1335d, last: 1333d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/fortify-string.h:191 [inline]
BUG: KASAN: use-after-free in page_to_skb+0x5cf/0xb70 drivers/net/virtio_net.c:480
Read of size 12 at addr ffff88802ed67800 by task ksoftirqd/1/19

CPU: 1 PID: 19 Comm: ksoftirqd/1 Not tainted 5.12.0-rc8-next-20210420-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
 check_region_inline mm/kasan/generic.c:180 [inline]
 kasan_check_range+0x13d/0x180 mm/kasan/generic.c:186
 memcpy+0x20/0x60 mm/kasan/shadow.c:65
 memcpy include/linux/fortify-string.h:191 [inline]
 page_to_skb+0x5cf/0xb70 drivers/net/virtio_net.c:480
 receive_mergeable drivers/net/virtio_net.c:1009 [inline]
 receive_buf+0x2bc0/0x6250 drivers/net/virtio_net.c:1119
 virtnet_receive drivers/net/virtio_net.c:1411 [inline]
 virtnet_poll+0x568/0x10b0 drivers/net/virtio_net.c:1516
 __napi_poll+0xaf/0x440 net/core/dev.c:6962
 napi_poll net/core/dev.c:7029 [inline]
 net_rx_action+0x801/0xb40 net/core/dev.c:7116
 __do_softirq+0x29b/0x9fe kernel/softirq.c:559
 run_ksoftirqd kernel/softirq.c:921 [inline]
 run_ksoftirqd+0x2d/0x60 kernel/softirq.c:913
 smpboot_thread_fn+0x655/0x9e0 kernel/smpboot.c:165
 kthread+0x3b1/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

Allocated by task 6462:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:428 [inline]
 __kasan_slab_alloc+0x84/0xa0 mm/kasan/common.c:461
 kasan_slab_alloc include/linux/kasan.h:236 [inline]
 slab_post_alloc_hook mm/slab.h:527 [inline]
 slab_alloc_node mm/slub.c:2924 [inline]
 slab_alloc mm/slub.c:2932 [inline]
 kmem_cache_alloc+0x219/0x3a0 mm/slub.c:2937
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
 getname_flags fs/namei.c:2734 [inline]
 user_path_at_empty+0xa1/0x100 fs/namei.c:2734
 user_path_at include/linux/namei.h:60 [inline]
 do_faccessat+0x127/0x850 fs/open.c:425
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 6462:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
 ____kasan_slab_free mm/kasan/common.c:360 [inline]
 ____kasan_slab_free mm/kasan/common.c:325 [inline]
 __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368
 kasan_slab_free include/linux/kasan.h:212 [inline]
 slab_free_hook mm/slub.c:1593 [inline]
 slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1618
 slab_free mm/slub.c:3178 [inline]
 kmem_cache_free+0x97/0x750 mm/slub.c:3194
 putname+0xe1/0x120 fs/namei.c:259
 filename_lookup+0x3c3/0x570 fs/namei.c:2464
 user_path_at include/linux/namei.h:60 [inline]
 do_faccessat+0x127/0x850 fs/open.c:425
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff88802ed66600
 which belongs to the cache names_cache of size 4096
The buggy address is located 512 bytes to the right of
 4096-byte region [ffff88802ed66600, ffff88802ed67600)
The buggy address belongs to the page:
page:ffffea0000bb5800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2ed60
head:ffffea0000bb5800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff8880111bd280
raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88802ed67700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802ed67780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88802ed67800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff88802ed67880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802ed67900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/04/21 08:15 linux-next 593ef1658ecf 95777977 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next boot error: KASAN: use-after-free Read in page_to_skb
2021/04/21 08:15 linux-next 593ef1658ecf 95777977 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next boot error: KASAN: use-after-free Read in page_to_skb
2021/04/20 10:57 linux-next 593ef1658ecf c0ced557 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next boot error: KASAN: use-after-free Read in page_to_skb
2021/04/20 10:08 linux-next 593ef1658ecf 4285c989 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next boot error: KASAN: use-after-free Read in page_to_skb
2021/04/19 22:36 linux-next 50b8b1d699ac 4285c989 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next boot error: KASAN: use-after-free Read in page_to_skb
2021/04/19 11:04 linux-next 50b8b1d699ac 50f523d7 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next boot error: KASAN: use-after-free Read in page_to_skb
2021/04/19 11:04 linux-next 50b8b1d699ac 50f523d7 .config console log report ci-upstream-linux-next-kasan-gce-root linux-next boot error: KASAN: use-after-free Read in page_to_skb
* Struck through repros no longer work on HEAD.