syzbot


net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb

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

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/fortify-string.h:191 [inline]
BUG: KASAN: slab-out-of-bounds in page_to_skb+0x5cf/0xb70 drivers/net/virtio_net.c:480
Read of size 12 at addr ffff8880271df800 by task systemd/1

CPU: 0 PID: 1 Comm: systemd Not tainted 5.12.0-rc7-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:232
 __kasan_report mm/kasan/report.c:399 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:416
 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+0x2b82/0x6220 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/0x9f6 kernel/softirq.c:345
 invoke_softirq kernel/softirq.c:221 [inline]
 __irq_exit_rcu kernel/softirq.c:422 [inline]
 irq_exit_rcu+0x134/0x200 kernel/softirq.c:434
 common_interrupt+0x51/0xd0 arch/x86/kernel/irq.c:240
 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:623
RIP: 0033:0x7fa93df50e70
Code: 01 0b 00 f7 82 b8 00 00 00 02 00 00 00 75 07 48 8d 05 e4 aa 0a 00 c3 0f 1f 00 48 39 d1 0f 82 f7 36 07 00 0f 1f 80 00 00 00 00 <48> 89 f8 48 01 d0 eb 1b 0f 1f 84 00 00 00 00 00 48 39 d1 0f 82 d7
RSP: 002b:00007ffc3da4c8c8 EFLAGS: 00000212
RAX: 000055b933a0db8c RBX: 000055b933a0eb80 RCX: 000055b933a0db80
RDX: 0000000000000007 RSI: 000055b9339f5a55 RDI: 000055b933a0db85
RBP: 00007ffc3da4c9c0 R08: 0000000000000003 R09: 0000000000001010
R10: 000055b9339cea40 R11: 0000000000000246 R12: 000055b933a0db80
R13: 000055b933a0db84 R14: 000055b9339f5a55 R15: 000055b9339f5a5c

Allocated by task 6380:
 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:427 [inline]
 __kasan_slab_alloc+0x75/0x90 mm/kasan/common.c:460
 kasan_slab_alloc include/linux/kasan.h:223 [inline]
 slab_post_alloc_hook mm/slab.h:516 [inline]
 slab_alloc_node mm/slub.c:2907 [inline]
 slab_alloc mm/slub.c:2915 [inline]
 kmem_cache_alloc+0x155/0x370 mm/slub.c:2920
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
 getname_flags fs/namei.c:2735 [inline]
 user_path_at_empty+0xa1/0x100 fs/namei.c:2735
 user_path_at include/linux/namei.h:60 [inline]
 vfs_statx+0x142/0x390 fs/stat.c:195
 vfs_fstatat fs/stat.c:217 [inline]
 vfs_lstat include/linux/fs.h:3240 [inline]
 __do_sys_newlstat+0x91/0x110 fs/stat.c:372
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 6380:
 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+0xf5/0x130 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1562 [inline]
 slab_free_freelist_hook+0x92/0x210 mm/slub.c:1600
 slab_free mm/slub.c:3161 [inline]
 kmem_cache_free+0x8a/0x740 mm/slub.c:3177
 putname+0xe1/0x120 fs/namei.c:259
 filename_lookup+0x3c3/0x570 fs/namei.c:2465
 user_path_at include/linux/namei.h:60 [inline]
 vfs_statx+0x142/0x390 fs/stat.c:195
 vfs_fstatat fs/stat.c:217 [inline]
 vfs_lstat include/linux/fs.h:3240 [inline]
 __do_sys_newlstat+0x91/0x110 fs/stat.c:372
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae

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

Memory state around the buggy address:
 ffff8880271df700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880271df780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880271df800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff8880271df880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880271df900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (15):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/04/21 00:09 net-next-old 08322284c162 c0ced557 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/20 23:40 net-next-old ff254dad0e5b c0ced557 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/20 10:29 net-next-old e9377a911d77 c0ced557 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/20 10:29 net-next-old e9377a911d77 c0ced557 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/20 00:57 net-next-old e9377a911d77 4285c989 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/20 00:03 net-next-old c1d9e34e1128 4285c989 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/19 22:17 net-next-old 11ac4e668a44 4285c989 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/19 21:43 net-next-old 11ac4e668a44 50f523d7 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/19 09:52 net-next-old 8203c7ce4ef2 50f523d7 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/19 09:52 net-next-old 8203c7ce4ef2 50f523d7 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/19 09:52 net-next-old 8203c7ce4ef2 50f523d7 .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/17 18:34 net-next-old 8203c7ce4ef2 7e2b734b .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/17 18:34 net-next-old 8203c7ce4ef2 7e2b734b .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/17 11:01 net-next-old 474f45936039 7e2b734b .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
2021/04/17 11:01 net-next-old 474f45936039 7e2b734b .config console log report ci-upstream-net-kasan-gce net-next boot error: KASAN: slab-out-of-bounds Read in page_to_skb
* Struck through repros no longer work on HEAD.