==================================================================
BUG: KASAN: use-after-free in receive_mergeable drivers/net/virtio_net.c:1179 [inline]
BUG: KASAN: use-after-free in receive_buf+0x3bc1/0x53c0 drivers/net/virtio_net.c:1479
Read of size 2 at addr ffff888078e7f80a by task syz-executor.5/5026
CPU: 1 PID: 5026 Comm: syz-executor.5 Not tainted 6.3.0-syzkaller-12570-g7df047b3f0aa #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:351 [inline]
print_report+0x163/0x540 mm/kasan/report.c:462
kasan_report+0x176/0x1b0 mm/kasan/report.c:572
receive_mergeable drivers/net/virtio_net.c:1179 [inline]
receive_buf+0x3bc1/0x53c0 drivers/net/virtio_net.c:1479
virtnet_receive drivers/net/virtio_net.c:1777 [inline]
virtnet_poll+0x6d7/0x1470 drivers/net/virtio_net.c:1849
__napi_poll+0xc7/0x470 net/core/dev.c:6496
napi_poll net/core/dev.c:6563 [inline]
net_rx_action+0x78b/0x1010 net/core/dev.c:6696
__do_softirq+0x2ab/0x908 kernel/softirq.c:571
invoke_softirq kernel/softirq.c:445 [inline]
__irq_exit_rcu+0x159/0x240 kernel/softirq.c:650
irq_exit_rcu+0x9/0x20 kernel/softirq.c:662
common_interrupt+0xa8/0xc0 arch/x86/kernel/irq.c:240
</IRQ>
<TASK>
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:636
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xd8/0x140 kernel/locking/spinlock.c:194
Code: 9c 8f 44 24 20 42 80 3c 23 00 74 08 4c 89 f7 e8 ce 9f 2a f7 f6 44 24 21 02 75 4e 41 f7 c7 00 02 00 00 74 01 fb bf 01 00 00 00 <e8> 03 57 a6 f6 65 8b 05 e4 fc 4a 75 85 c0 74 3f 48 c7 04 24 0e 36
RSP: 0018:ffffc90003c3fba0 EFLAGS: 00000206
RAX: 19dc682d1134ec00 RBX: 1ffff92000787f78 RCX: ffffffff91b21103
RDX: dffffc0000000000 RSI: ffffffff8aea8ea0 RDI: 0000000000000001
RBP: ffffc90003c3fc30 R08: dffffc0000000000 R09: fffffbfff1cab886
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: 1ffff92000787f74 R14: ffffc90003c3fbc0 R15: 0000000000000246
hrtimer_start_expires include/linux/hrtimer.h:432 [inline]
hrtimer_sleeper_start_expires kernel/time/hrtimer.c:1965 [inline]
do_nanosleep+0x14c/0x610 kernel/time/hrtimer.c:2041
hrtimer_nanosleep+0x226/0x460 kernel/time/hrtimer.c:2097
__do_sys_clock_nanosleep kernel/time/posix-timers.c:1281 [inline]
__se_sys_clock_nanosleep+0x327/0x3b0 kernel/time/posix-timers.c:1258
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f95772b0e91
Code: 24 0c 89 3c 24 48 89 4c 24 18 e8 aa e7 ff ff 4c 8b 54 24 18 48 8b 54 24 10 41 89 c0 8b 74 24 0c 8b 3c 24 b8 e6 00 00 00 0f 05 <44> 89 c7 48 89 04 24 e8 e3 e7 ff ff 48 8b 04 24 eb 97 66 2e 0f 1f
RSP: 002b:00007ffc89876e40 EFLAGS: 00000293 ORIG_RAX: 00000000000000e6
RAX: ffffffffffffffda RBX: 0000000000000949 RCX: 00007f95772b0e91
RDX: 00007ffc89876e80 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007ffc89876f0c R08: 0000000000000000 R09: 0000000000000010
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000032
R13: 0000000000188bab R14: 0000000000000000 R15: 00007ffc89876f70
</TASK>
The buggy address belongs to the physical page:
page:ffffea0001e39fc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x78e7f
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 32016, tgid 32015 (syz-executor.4), ts 1418479499659, free_ts 1609310758961
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1722
prep_new_page mm/page_alloc.c:1729 [inline]
get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3493
__alloc_pages+0x255/0x670 mm/page_alloc.c:4759
skb_page_frag_refill+0x158/0x2f0 net/core/sock.c:2854
add_recvbuf_mergeable drivers/net/virtio_net.c:1631 [inline]
try_fill_recv+0x550/0x1880 drivers/net/virtio_net.c:1675
virtnet_receive drivers/net/virtio_net.c:1789 [inline]
virtnet_poll+0x8fb/0x1470 drivers/net/virtio_net.c:1849
__napi_poll+0xc7/0x470 net/core/dev.c:6496
napi_poll net/core/dev.c:6563 [inline]
net_rx_action+0x78b/0x1010 net/core/dev.c:6696
__do_softirq+0x2ab/0x908 kernel/softirq.c:571
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1302 [inline]
free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2555
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2650
page_to_skb+0x3dc/0x9a0 drivers/net/virtio_net.c:545
receive_mergeable drivers/net/virtio_net.c:1344 [inline]
receive_buf+0x465/0x53c0 drivers/net/virtio_net.c:1479
virtnet_receive drivers/net/virtio_net.c:1777 [inline]
virtnet_poll+0x6d7/0x1470 drivers/net/virtio_net.c:1849
__napi_poll+0xc7/0x470 net/core/dev.c:6496
napi_poll net/core/dev.c:6563 [inline]
net_rx_action+0x78b/0x1010 net/core/dev.c:6696
__do_softirq+0x2ab/0x908 kernel/softirq.c:571
Memory state around the buggy address:
ffff888078e7f700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888078e7f780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff888078e7f800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff888078e7f880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff888078e7f900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================
----------------
Code disassembly (best guess):
0: 9c pushfq
1: 8f 44 24 20 popq 0x20(%rsp)
5: 42 80 3c 23 00 cmpb $0x0,(%rbx,%r12,1)
a: 74 08 je 0x14
c: 4c 89 f7 mov %r14,%rdi
f: e8 ce 9f 2a f7 callq 0xf72a9fe2
14: f6 44 24 21 02 testb $0x2,0x21(%rsp)
19: 75 4e jne 0x69
1b: 41 f7 c7 00 02 00 00 test $0x200,%r15d
22: 74 01 je 0x25
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 03 57 a6 f6 callq 0xf6a65732 <-- trapping instruction
2f: 65 8b 05 e4 fc 4a 75 mov %gs:0x754afce4(%rip),%eax # 0x754afd1a
36: 85 c0 test %eax,%eax
38: 74 3f je 0x79
3a: 48 rex.W
3b: c7 .byte 0xc7
3c: 04 24 add $0x24,%al
3e: 0e (bad)
3f: 36 ss