syzbot


KASAN: use-after-free Read in __netif_receive_skb_core

Status: upstream: reported syz repro on 2020/10/08 04:31
Reported-by: syzbot+9c0e01d331d59bafac92@syzkaller.appspotmail.com
First crash: 791d, last: 250d

Fix bisection: failed (bisect log)
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __netif_receive_skb_core C 239 1900d 1863d 0/24 closed as invalid on 2017/11/01 19:36
linux-4.14 KASAN: use-after-free Read in __netif_receive_skb_core syz error 19 518d 936d 0/1 upstream: reported syz repro on 2020/05/16 19:24
upstream KMSAN: uninit-value in __netif_receive_skb_core C 343 172d 1701d 0/24 upstream: reported C repro on 2018/04/12 08:01

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:261 [inline]
BUG: KASAN: use-after-free in deliver_ptype_list_skb net/core/dev.c:1967 [inline]
BUG: KASAN: use-after-free in __netif_receive_skb_core+0x2b84/0x3270 net/core/dev.c:4910
Read of size 8 at addr ffff8880aaeccb70 by task syz-executor.1/17335

CPU: 0 PID: 17335 Comm: syz-executor.1 Not tainted 4.19.190-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:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 __read_once_size include/linux/compiler.h:261 [inline]
 deliver_ptype_list_skb net/core/dev.c:1967 [inline]
 __netif_receive_skb_core+0x2b84/0x3270 net/core/dev.c:4910
 __netif_receive_skb_one_core+0xae/0x180 net/core/dev.c:4952
 __netif_receive_skb+0x27/0x1c0 net/core/dev.c:5066
 process_backlog+0x241/0x700 net/core/dev.c:5848
 napi_poll net/core/dev.c:6272 [inline]
 net_rx_action+0x4ac/0xfb0 net/core/dev.c:6338
 __do_softirq+0x265/0x980 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:372 [inline]
 irq_exit+0x215/0x260 kernel/softirq.c:412
 exiting_irq arch/x86/include/asm/apic.h:535 [inline]
 smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
 </IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline]
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:184
Code: 48 c7 c0 48 82 f1 89 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 2f 48 83 3d 0c 88 d9 01 00 74 15 48 89 df 57 9d <0f> 1f 44 00 00 eb b2 e8 cb 42 e8 f8 eb c0 0f 0b 0f 0b 48 c7 c7 48
RSP: 0018:ffff8880b36e75a0 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13
RAX: 1ffffffff13e3049 RBX: 0000000000000282 RCX: 1ffff1101270918d
RDX: dffffc0000000000 RSI: ffff888093848c70 RDI: 0000000000000282
RBP: ffffffff89f88818 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88809ac70ec0 R14: 0000000000000040 R15: 0000000000000001
 __rcu_read_unlock+0x158/0x160 kernel/rcu/tree_plugin.h:428
 rcu_read_unlock include/linux/rcupdate.h:680 [inline]
 __ip_queue_xmit+0x887/0x1b50 net/ipv4/ip_output.c:507
 __tcp_transmit_skb+0x1bb2/0x33f0 net/ipv4/tcp_output.c:1148
 __tcp_send_ack.part.0+0x3d9/0x5c0 net/ipv4/tcp_output.c:3643
 __tcp_send_ack net/ipv4/tcp_output.c:3649 [inline]
 tcp_send_ack+0x7d/0xa0 net/ipv4/tcp_output.c:3649
 __tcp_ack_snd_check+0x152/0x890 net/ipv4/tcp_input.c:5209
 tcp_ack_snd_check net/ipv4/tcp_input.c:5255 [inline]
 tcp_rcv_established+0x96d/0x1ea0 net/ipv4/tcp_input.c:5678
 tcp_v4_do_rcv+0x5d6/0x870 net/ipv4/tcp_ipv4.c:1547
 sk_backlog_rcv include/net/sock.h:950 [inline]
 __release_sock+0x134/0x3a0 net/core/sock.c:2344
 release_sock+0x54/0x1b0 net/core/sock.c:2881
 sk_stream_wait_memory+0x536/0xd60 net/core/stream.c:145
 tcp_sendmsg_locked+0xd54/0x2f60 net/ipv4/tcp.c:1422
 tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1462
 inet_sendmsg+0x132/0x5a0 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:632
 __sys_sendto+0x21a/0x320 net/socket.c:1787
 __do_sys_sendto net/socket.c:1799 [inline]
 __se_sys_sendto net/socket.c:1795 [inline]
 __x64_sys_sendto+0xdd/0x1b0 net/socket.c:1795
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4665d9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff5931a5188 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 00000000004665d9
RDX: 000000000000fe6a RSI: 00000000200012c0 RDI: 0000000000000003
RBP: 00000000004bfcb9 R08: 0000000000000000 R09: 0000000000000027
R10: 000000000020c49a R11: 0000000000000246 R12: 000000000056bf60
R13: 00007ffd05178fff R14: 00007ff5931a5300 R15: 0000000000022000

Allocated by task 17337:
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15a/0x3c0 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 sk_prot_alloc+0x1e2/0x2d0 net/core/sock.c:1466
 sk_alloc+0x36/0xec0 net/core/sock.c:1520
 packet_create+0x117/0x850 net/packet/af_packet.c:3259
 __sock_create+0x3d8/0x740 net/socket.c:1276
 sock_create net/socket.c:1316 [inline]
 __sys_socket+0xef/0x200 net/socket.c:1346
 __do_sys_socket net/socket.c:1355 [inline]
 __se_sys_socket net/socket.c:1353 [inline]
 __x64_sys_socket+0x6f/0xb0 net/socket.c:1353
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 17304:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 sk_prot_free net/core/sock.c:1503 [inline]
 __sk_destruct+0x684/0x8a0 net/core/sock.c:1584
 sk_destruct net/core/sock.c:1599 [inline]
 __sk_free+0x165/0x3b0 net/core/sock.c:1610
 sk_free+0x3b/0x50 net/core/sock.c:1621
 sock_put include/net/sock.h:1711 [inline]
 packet_release+0x890/0xb70 net/packet/af_packet.c:3088
 __sock_release+0xcd/0x2a0 net/socket.c:579
 sock_close+0x15/0x20 net/socket.c:1140
 __fput+0x2ce/0x890 fs/file_table.c:278
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880aaecc380
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 2032 bytes inside of
 2048-byte region [ffff8880aaecc380, ffff8880aaeccb80)
The buggy address belongs to the page:
page:ffffea0002abb300 count:1 mapcount:0 mapping:ffff88813bff0c40 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002aaf088 ffffea0002aa3108 ffff88813bff0c40
raw: 0000000000000000 ffff8880aaecc380 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880aaecca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880aaecca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880aaeccb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff8880aaeccb80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880aaeccc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (20):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2021/05/19 05:13 linux-4.19.y 3c8c23092588 a343ba6b .config log report syz KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2020/10/08 04:30 linux-4.19.y a1b977b49b66 1880b4a9 .config log report syz
ci2-linux-4-19 2022/04/02 03:48 linux-4.19.y 3f8a27f9e27b 79a2a8fc .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2022/03/25 07:44 linux-4.19.y 3f8a27f9e27b 89bc8608 .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2022/01/16 14:30 linux-4.19.y 3f8a27f9e27b 723cfaf0 .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2022/01/13 01:08 linux-4.19.y 3f8a27f9e27b 44d1319a .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/11/14 06:23 linux-4.19.y 3f8a27f9e27b 75b04091 .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/11/02 06:51 linux-4.19.y 3f8a27f9e27b 098b5d53 .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/10/25 00:01 linux-4.19.y 3f8a27f9e27b 4f0000ee .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/10/13 15:08 linux-4.19.y 3f8a27f9e27b 9d56e7dd .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/10/03 19:32 linux-4.19.y c2276d585654 db0f5787 .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/09/28 04:00 linux-4.19.y c2276d585654 78494d16 .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/09/22 21:20 linux-4.19.y 2950c9c5e0df 8cac236e .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/08/10 02:12 linux-4.19.y 5c66974a6304 6972b106 .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/04/16 17:43 linux-4.19.y 2965db2e004c 7e2b734b .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/03/23 23:15 linux-4.19.y 125222814e7b e613994b .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/03/20 01:52 linux-4.19.y ac3af4beac43 3d01c4de .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/02/25 00:38 linux-4.19.y 2d19be4653f5 fcc6d71b .config log report info KASAN: use-after-free Read in __netif_receive_skb_core
ci2-linux-4-19 2021/01/05 12:25 linux-4.19.y 3207316b3bee a0234d98 .config log report info
ci2-linux-4-19 2020/11/30 06:15 linux-4.19.y 0c88e405c97e a0092f9d .config log report info
* Struck through repros no longer work on HEAD.