syzbot


net-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: 1096d, last: 1093d

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 ffff88802b027800 by task systemd-sysctl/8298

CPU: 0 PID: 8298 Comm: systemd-sysctl Not tainted 5.12.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __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
 </IRQ>
 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:623
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:199
Code: 0f 1f 44 00 00 55 48 8b 74 24 08 48 89 fd 48 83 c7 18 e8 be ce 4d f8 48 89 ef e8 f6 84 4e f8 e8 71 0e 6e f8 fb bf 01 00 00 00 <e8> e6 52 42 f8 65 8b 05 af 18 f6 76 85 c0 74 02 5d c3 e8 0b 6e f4
RSP: 0018:ffffc90000eef558 EFLAGS: 00000202
RAX: 000000000000296b RBX: 0000000000000001 RCX: 1ffffffff1f5b25a
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000001
RBP: ffff8880b9c35280 R08: 0000000000000001 R09: ffffffff8fad48af
R10: 0000000000000001 R11: 0000000000000001 R12: ffff8880b9c35280
R13: ffff88801c3dd4c0 R14: 0000000000000000 R15: ffff88801a99b880
 finish_lock_switch kernel/sched/core.c:4074 [inline]
 finish_task_switch.isra.0+0x15d/0x810 kernel/sched/core.c:4191
 context_switch kernel/sched/core.c:4325 [inline]
 __schedule+0x919/0x21b0 kernel/sched/core.c:5073
 preempt_schedule_irq+0x4e/0x90 kernel/sched/core.c:5530
 irqentry_exit_cond_resched kernel/entry/common.c:392 [inline]
 irqentry_exit_cond_resched kernel/entry/common.c:384 [inline]
 irqentry_exit+0x7a/0xa0 kernel/entry/common.c:428
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:632
RIP: 0010:__sanitizer_cov_trace_const_cmp1+0x77/0x80 kernel/kcov.c:272
Code: f0 72 27 41 0f b6 fb 41 0f b6 c9 48 83 c2 01 48 c7 44 30 e0 01 00 00 00 48 89 7c 30 e8 48 89 4c 30 f0 4c 89 54 d8 20 48 89 10 <5b> c3 0f 1f 80 00 00 00 00 53 41 89 fb 41 89 f1 bf 03 00 00 00 65
RSP: 0018:ffffc90000eef760 EFLAGS: 00000246
RAX: 0000000000000000 RBX: ffff888011e944ac RCX: ffff88801a99b880
RDX: 0000000000000000 RSI: ffff88801a99b880 RDI: 0000000000000003
RBP: ffff888011e94498 R08: 0000000000000001 R09: 000000000000003a
R10: ffffffff8393434d R11: 000000000000005c R12: 0000000000000004
R13: ffff888011e944a8 R14: 000000000000000c R15: 000000000000003a
 tomoyo_const_part_length security/tomoyo/util.c:643 [inline]
 tomoyo_fill_path_info+0xad/0x410 security/tomoyo/util.c:682
 tomoyo_get_name+0x2cd/0x480 security/tomoyo/memory.c:178
 tomoyo_parse_name_union+0xbc/0x160 security/tomoyo/util.c:260
 tomoyo_update_path_number_acl security/tomoyo/file.c:687 [inline]
 tomoyo_write_file+0x629/0x7f0 security/tomoyo/file.c:1034
 tomoyo_write_domain2+0x116/0x1d0 security/tomoyo/common.c:1152
 tomoyo_add_entry security/tomoyo/common.c:2042 [inline]
 tomoyo_supervisor+0xbc9/0xf00 security/tomoyo/common.c:2103
 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
 tomoyo_path_number_perm+0x419/0x590 security/tomoyo/file.c:734
 security_file_ioctl+0x50/0xb0 security/security.c:1495
 __do_sys_ioctl fs/ioctl.c:747 [inline]
 __se_sys_ioctl fs/ioctl.c:739 [inline]
 __x64_sys_ioctl+0xb3/0x200 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f272cc2a80a
Code: ff e9 62 fe ff ff 66 2e 0f 1f 84 00 00 00 00 00 53 49 89 f0 48 63 ff be 01 54 00 00 b8 10 00 00 00 48 83 ec 30 48 89 e2 0f 05 <48> 3d 00 f0 ff ff 77 6e 85 c0 89 c3 75 5c 8b 04 24 8b 54 24 0c 4c
RSP: 002b:00007ffcbdc04830 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000007 RCX: 00007f272cc2a80a
RDX: 00007ffcbdc04830 RSI: 0000000000005401 RDI: 0000000000000002
RBP: 0000000000000007 R08: 00007ffcbdc04870 R09: 0000000000000009
R10: fffffffffffff709 R11: 0000000000000206 R12: 0000000000000005
R13: 00007ffcbdc04a38 R14: 0000000000000000 R15: 0000000000000000

general protection fault, probably for non-canonical address 0xdead000000000400: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 8298 Comm: systemd-sysctl Not tainted 5.12.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:nearest_obj include/linux/slub_def.h:169 [inline]
RIP: 0010:print_address_description.constprop.0.cold+0xbf/0x2f8 mm/kasan/report.c:237
Code: 00 48 8b 00 f6 c4 02 0f 84 71 ff ff ff 48 8b 5d 18 b9 0b 00 00 00 b8 11 ff ff 01 48 c1 e1 29 48 c1 e0 27 48 01 e9 48 c1 f9 06 <8b> 73 18 48 c1 e1 0c 48 01 c1 4c 89 e0 48 29 c8 48 99 48 f7 fe 0f
RSP: 0018:ffffc90000007978 EFLAGS: 00010006
RAX: ffff888000000000 RBX: dead000000000400 RCX: 000000000002b027
RDX: ffffea0000ac0801 RSI: ffffffff815c5205 RDI: fffff52000000f21
RBP: ffffea0000ac09c0 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff815bdf9e R11: 0000000000000000 R12: ffff88802b027800
R13: ffffffff84bb928f R14: ffffffff84bb928f R15: ffff88801b70ec00
FS:  00007f272d53a8c0(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1aab340000 CR3: 0000000018f27000 CR4: 00000000001506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 __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
 </IRQ>
 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:623
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:199
Code: 0f 1f 44 00 00 55 48 8b 74 24 08 48 89 fd 48 83 c7 18 e8 be ce 4d f8 48 89 ef e8 f6 84 4e f8 e8 71 0e 6e f8 fb bf 01 00 00 00 <e8> e6 52 42 f8 65 8b 05 af 18 f6 76 85 c0 74 02 5d c3 e8 0b 6e f4
RSP: 0018:ffffc90000eef558 EFLAGS: 00000202
RAX: 000000000000296b RBX: 0000000000000001 RCX: 1ffffffff1f5b25a
RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000001
RBP: ffff8880b9c35280 R08: 0000000000000001 R09: ffffffff8fad48af
R10: 0000000000000001 R11: 0000000000000001 R12: ffff8880b9c35280
R13: ffff88801c3dd4c0 R14: 0000000000000000 R15: ffff88801a99b880
 finish_lock_switch kernel/sched/core.c:4074 [inline]
 finish_task_switch.isra.0+0x15d/0x810 kernel/sched/core.c:4191
 context_switch kernel/sched/core.c:4325 [inline]
 __schedule+0x919/0x21b0 kernel/sched/core.c:5073
 preempt_schedule_irq+0x4e/0x90 kernel/sched/core.c:5530
 irqentry_exit_cond_resched kernel/entry/common.c:392 [inline]
 irqentry_exit_cond_resched kernel/entry/common.c:384 [inline]
 irqentry_exit+0x7a/0xa0 kernel/entry/common.c:428
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:632
RIP: 0010:__sanitizer_cov_trace_const_cmp1+0x77/0x80 kernel/kcov.c:272
Code: f0 72 27 41 0f b6 fb 41 0f b6 c9 48 83 c2 01 48 c7 44 30 e0 01 00 00 00 48 89 7c 30 e8 48 89 4c 30 f0 4c 89 54 d8 20 48 89 10 <5b> c3 0f 1f 80 00 00 00 00 53 41 89 fb 41 89 f1 bf 03 00 00 00 65
RSP: 0018:ffffc90000eef760 EFLAGS: 00000246
RAX: 0000000000000000 RBX: ffff888011e944ac RCX: ffff88801a99b880
RDX: 0000000000000000 RSI: ffff88801a99b880 RDI: 0000000000000003
RBP: ffff888011e94498 R08: 0000000000000001 R09: 000000000000003a
R10: ffffffff8393434d R11: 000000000000005c R12: 0000000000000004
 tomoyo_const_part_length security/tomoyo/util.c:643 [inline]
 tomoyo_fill_path_info+0xad/0x410 security/tomoyo/util.c:682
 tomoyo_get_name+0x2cd/0x480 security/tomoyo/memory.c:178
 tomoyo_parse_name_union+0xbc/0x160 security/tomoyo/util.c:260
 tomoyo_update_path_number_acl security/tomoyo/file.c:687 [inline]
 tomoyo_write_file+0x629/0x7f0 security/tomoyo/file.c:1034
 tomoyo_write_domain2+0x116/0x1d0 security/tomoyo/common.c:1152
 tomoyo_add_entry security/tomoyo/common.c:2042 [inline]
 tomoyo_supervisor+0xbc9/0xf00 security/tomoyo/common.c:2103
 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
 tomoyo_path_number_perm+0x419/0x590 security/tomoyo/file.c:734
 security_file_ioctl+0x50/0xb0 security/security.c:1495
 __do_sys_ioctl fs/ioctl.c:747 [inline]
 __se_sys_ioctl fs/ioctl.c:739 [inline]
 __x64_sys_ioctl+0xb3/0x200 fs/ioctl.c:739
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f272cc2a80a
Code: ff e9 62 fe ff ff 66 2e 0f 1f 84 00 00 00 00 00 53 49 89 f0 48 63 ff be 01 54 00 00 b8 10 00 00 00 48 83 ec 30 48 89 e2 0f 05 <48> 3d 00 f0 ff ff 77 6e 85 c0 89 c3 75 5c 8b 04 24 8b 54 24 0c 4c
RSP: 002b:00007ffcbdc04830 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000007 RCX: 00007f272cc2a80a
RDX: 00007ffcbdc04830 RSI: 0000000000005401 RDI: 0000000000000002
RBP: 0000000000000007 R08: 00007ffcbdc04870 R09: 0000000000000009
R10: fffffffffffff709 R11: 0000000000000206 R12: 0000000000000005
R13: 00007ffcbdc04a38 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace 1abcd38192e37b64 ]---
RIP: 0010:nearest_obj include/linux/slub_def.h:169 [inline]
RIP: 0010:print_address_description.constprop.0.cold+0xbf/0x2f8 mm/kasan/report.c:237
Code: 00 48 8b 00 f6 c4 02 0f 84 71 ff ff ff 48 8b 5d 18 b9 0b 00 00 00 b8 11 ff ff 01 48 c1 e1 29 48 c1 e0 27 48 01 e9 48 c1 f9 06 <8b> 73 18 48 c1 e1 0c 48 01 c1 4c 89 e0 48 29 c8 48 99 48 f7 fe 0f
RSP: 0018:ffffc90000007978 EFLAGS: 00010006
RAX: ffff888000000000 RBX: dead000000000400 RCX: 000000000002b027
RDX: ffffea0000ac0801 RSI: ffffffff815c5205 RDI: fffff52000000f21
RBP: ffffea0000ac09c0 R08: 0000000000000000 R09: 0000000000000000
R10: ffffffff815bdf9e R11: 0000000000000000 R12: ffff88802b027800
R13: ffffffff84bb928f R14: ffffffff84bb928f R15: ffff88801b70ec00
FS:  00007f272d53a8c0(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1aab340000 CR3: 0000000018f27000 CR4: 00000000001506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400

Crashes (11):
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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free 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: use-after-free Read in page_to_skb
* Struck through repros no longer work on HEAD.