================================================================== 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 ffff88802818f800 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+0xa4/0xd0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:623 RIP: 0010:compound_head include/linux/page-flags.h:187 [inline] RIP: 0010:virt_to_head_page include/linux/mm.h:880 [inline] RIP: 0010:kfree+0x79/0x7f0 mm/slub.c:4202 Code: 0f 86 94 00 00 00 4c 89 ef e8 83 ec 7b ff 48 c1 e8 0c 48 89 c5 48 b8 00 00 00 00 00 ea ff ff 48 c1 e5 06 48 01 c5 48 8b 45 08 <48> 8d 50 ff a8 01 48 0f 45 ea 48 8b 55 08 48 8d 42 ff 83 e2 01 48 RSP: 0018:ffffc90000c679e0 EFLAGS: 00000282 RAX: ffffea00004d4201 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: ffff888011518000 RSI: ffffffff813371d4 RDI: 0000000000000003 RBP: ffffea00004d4380 R08: 0000000000000000 R09: 000000000000002e R10: ffffffff813371ca R11: 000000000000003f R12: ffff88801c0764c0 R13: ffff88801350e000 R14: ffff88801350eff9 R15: 0000000000001000 tomoyo_realpath_from_path+0x191/0x620 security/tomoyo/realpath.c:291 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1288 vfs_getattr fs/stat.c:131 [inline] vfs_statx+0x164/0x390 fs/stat.c:199 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 RIP: 0033:0x7f8693bec335 Code: 69 db 2b 00 64 c7 00 16 00 00 00 b8 ff ff ff ff c3 0f 1f 40 00 83 ff 01 48 89 f0 77 30 48 89 c7 48 89 d6 b8 06 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 03 f3 c3 90 48 8b 15 31 db 2b 00 f7 d8 64 89 RSP: 002b:00007fff43752d78 EFLAGS: 00000246 ORIG_RAX: 0000000000000006 RAX: ffffffffffffffda RBX: 00005559a3230170 RCX: 00007f8693bec335 RDX: 00007fff43752db0 RSI: 00007fff43752db0 RDI: 00005559a322f170 RBP: 00007fff43752e70 R08: 0000000000000003 R09: 0000000000001010 R10: 0000000000000030 R11: 0000000000000246 R12: 00005559a322f170 R13: 00005559a322f174 R14: 00005559a321a811 R15: 00005559a321a814 Allocated by task 6415: 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_kmalloc mm/kasan/common.c:506 [inline] ____kasan_kmalloc mm/kasan/common.c:465 [inline] __kasan_kmalloc+0x99/0xc0 mm/kasan/common.c:515 kmalloc_node include/linux/slab.h:577 [inline] kvmalloc_node+0x61/0xf0 mm/util.c:587 kvmalloc include/linux/mm.h:785 [inline] seq_buf_alloc fs/seq_file.c:35 [inline] seq_read_iter+0x79f/0x1220 fs/seq_file.c:207 proc_reg_read_iter+0x1fb/0x2d0 fs/proc/inode.c:310 call_read_iter include/linux/fs.h:1971 [inline] new_sync_read+0x41e/0x6e0 fs/read_write.c:415 vfs_read+0x35c/0x570 fs/read_write.c:496 ksys_read+0x12d/0x250 fs/read_write.c:634 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 6415: 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] kfree+0xe5/0x7f0 mm/slub.c:4213 kvfree+0x42/0x50 mm/util.c:616 seq_release fs/seq_file.c:352 [inline] single_release+0x75/0xb0 fs/seq_file.c:600 close_pdeo.part.0+0xdc/0x2e0 fs/proc/inode.c:244 close_pdeo fs/proc/inode.c:577 [inline] proc_reg_release+0x2e9/0x360 fs/proc/inode.c:576 __fput+0x288/0x920 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:140 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:174 [inline] exit_to_user_mode_prepare+0x249/0x250 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88802818e000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 2048 bytes to the right of 4096-byte region [ffff88802818e000, ffff88802818f000) The buggy address belongs to the page: page:ffffea0000a06200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x28188 head:ffffea0000a06200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010842140 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88802818f700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802818f780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802818f800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88802818f880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802818f900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================