syzbot


KASAN: use-after-free Read in packet_rcv

Status: auto-closed as invalid on 2020/05/09 17:47
Reported-by: syzbot+03b7c5cff93d6d743468@syzkaller.appspotmail.com
First crash: 1777d, last: 1777d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-414 KASAN: use-after-free Read in packet_rcv 1 2156d 2048d 0/1 auto-closed as invalid on 2019/06/25 08:50
linux-4.14 KASAN: use-after-free Read in packet_rcv (2) 1 1446d 1446d 0/1 auto-closed as invalid on 2021/04/05 18:49
linux-4.14 KASAN: use-after-free Read in packet_rcv 1 1847d 1847d 0/1 auto-closed as invalid on 2020/02/29 00:45
linux-4.19 KASAN: use-after-free Read in packet_rcv (2) syz 16 628d 1082d 0/1 upstream: reported syz repro on 2021/12/04 22:14

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
==================================================================
BUG: KASAN: use-after-free in packet_rcv+0x59d/0x1520 net/packet/af_packet.c:2096
Read of size 1 at addr ffff88804c22d0f4 by task syz-executor.1/27679

CPU: 0 PID: 27679 Comm: syz-executor.1 Not tainted 4.19.94-syzkaller #0
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
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+0x197/0x210 lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:430
 packet_rcv+0x59d/0x1520 net/packet/af_packet.c:2096
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
 deliver_skb net/core/dev.c:1960 [inline]
 dev_queue_xmit_nit+0x224/0xa10 net/core/dev.c:2016
 xmit_one net/core/dev.c:3254 [inline]
 dev_hard_start_xmit+0xa7/0x970 net/core/dev.c:3274
 __dev_queue_xmit+0x2704/0x2fe0 net/core/dev.c:3844
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
 dev_queue_xmit+0x18/0x20 net/core/dev.c:3877
 neigh_hh_output include/net/neighbour.h:491 [inline]
 neigh_output include/net/neighbour.h:499 [inline]
 ip6_finish_output2+0x1309/0x2560 net/ipv6/ip6_output.c:120
 ip6_finish_output+0x574/0xbe0 net/ipv6/ip6_output.c:154
 NF_HOOK_COND include/linux/netfilter.h:278 [inline]
 ip6_output+0x235/0x7c0 net/ipv6/ip6_output.c:171
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
 dst_output include/net/dst.h:447 [inline]
 NF_HOOK include/linux/netfilter.h:289 [inline]
 NF_HOOK include/linux/netfilter.h:283 [inline]
 mld_sendpack+0x9d3/0xeb0 net/ipv6/mcast.c:1684
 mld_send_cr net/ipv6/mcast.c:1980 [inline]
 mld_ifc_timer_expire+0x449/0x8b0 net/ipv6/mcast.c:2479
 call_timer_fn+0x18d/0x720 kernel/time/timer.c:1326
 expire_timers kernel/time/timer.c:1363 [inline]
 __run_timers kernel/time/timer.c:1684 [inline]
 __run_timers kernel/time/timer.c:1652 [inline]
 run_timer_softirq+0x64f/0x16a0 kernel/time/timer.c:1697
 __do_softirq+0x25c/0x921 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:372 [inline]
 irq_exit+0x180/0x1d0 kernel/softirq.c:412
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1094
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:893
 </IRQ>
RIP: 0010:__rcu_read_unlock+0xee/0x170 kernel/rcu/tree_plugin.h:430
Code: 00 fc ff df 48 89 fa 48 c1 ea 03 0f b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 04 84 d2 75 64 8b 83 74 03 00 00 85 c0 75 6b <48> b8 00 00 00 00 00 fc ff df 4c 89 e2 48 c1 ea 03 0f b6 04 02 84
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
RSP: 0018:ffff888022f4f668 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: 0000000000000000 RBX: ffff888022f3c540 RCX: ffffffff81597fb1
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff888022f3c8b4
RBP: ffff888022f4f678 R08: 1ffff11015d04732 R09: ffffed1015d04733
R10: ffffed1015d04732 R11: ffff8880ae823993 R12: ffff888022f3c8b0
R13: ffffea00025887c8 R14: 0000000000000000 R15: dead000000000100
 rcu_read_unlock include/linux/rcupdate.h:680 [inline]
 __unlock_page_memcg+0x58/0x100 mm/memcontrol.c:1953
 unlock_page_memcg+0x2c/0x40 mm/memcontrol.c:1962
 page_remove_file_rmap mm/rmap.c:1249 [inline]
 page_remove_rmap+0x57b/0x12c0 mm/rmap.c:1300
 zap_pte_range mm/memory.c:1338 [inline]
 zap_pmd_range mm/memory.c:1440 [inline]
 zap_pud_range mm/memory.c:1469 [inline]
 zap_p4d_range mm/memory.c:1490 [inline]
 unmap_page_range+0xda2/0x1fb0 mm/memory.c:1511
 unmap_single_vma+0x19d/0x300 mm/memory.c:1556
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
 unmap_vmas+0xae/0x180 mm/memory.c:1586
 exit_mmap+0x2c2/0x530 mm/mmap.c:3091
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
 __mmput kernel/fork.c:1005 [inline]
 mmput+0x15f/0x4c0 kernel/fork.c:1026
 exit_mm kernel/exit.c:546 [inline]
 do_exit+0xb1e/0x30d0 kernel/exit.c:867
 do_group_exit+0x135/0x370 kernel/exit.c:983
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
 get_signal+0x3ec/0x1fc0 kernel/signal.c:2578
 do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
 exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
RIP: 0033:0x45af49
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 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 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f396a9f0c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000c8
RAX: 0000000000000000 RBX: 0000000000000002 RCX: 000000000045af49
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 00000000000009d3
RBP: 000000000075c070 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f396a9f16d4
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready
R13: 00000000004cc4c2 R14: 00000000004e73a0 R15: 00000000ffffffff

Allocated by task 27665:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 __do_kmalloc mm/slab.c:3727 [inline]
 __kmalloc+0x15d/0x750 mm/slab.c:3736
 kmalloc include/linux/slab.h:520 [inline]
 sk_prot_alloc+0x19c/0x2e0 net/core/sock.c:1466
 sk_alloc+0x39/0xf70 net/core/sock.c:1520
 packet_create+0x11e/0x860 net/packet/af_packet.c:3229
 __sock_create+0x3d8/0x730 net/socket.c:1276
 sock_create net/socket.c:1316 [inline]
 __sys_socket+0x103/0x220 net/socket.c:1346
 __do_sys_socket net/socket.c:1355 [inline]
 __se_sys_socket net/socket.c:1353 [inline]
 __x64_sys_socket+0x73/0xb0 net/socket.c:1353
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 27657:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcf/0x220 mm/slab.c:3822
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready
 sk_prot_free net/core/sock.c:1503 [inline]
 __sk_destruct+0x580/0x780 net/core/sock.c:1583
 sk_destruct+0xc8/0x100 net/core/sock.c:1598
 __sk_free+0xce/0x300 net/core/sock.c:1609
 sk_free+0x45/0x50 net/core/sock.c:1620
 sock_put include/net/sock.h:1707 [inline]
 packet_release+0x93f/0xc70 net/packet/af_packet.c:3058
 __sock_release+0xce/0x2a0 net/socket.c:579
 sock_close+0x1b/0x30 net/socket.c:1140
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan1: link becomes ready
 __fput+0x2dd/0x8b0 fs/file_table.c:278
 ____fput+0x16/0x20 fs/file_table.c:309
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x273/0x2c0 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+0x53d/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
IPv6: ADDRCONF(NETDEV_CHANGE): vcan0: link becomes ready

The buggy address belongs to the object at ffff88804c22ca00
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1780 bytes inside of
 2048-byte region [ffff88804c22ca00, ffff88804c22d200)
The buggy address belongs to the page:
page:ffffea0001308b00 count:1 mapcount:0 mapping:ffff88812c31cc40 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea000226ce08 ffffea0002185d08 ffff88812c31cc40
raw: 0000000000000000 ffff88804c22c180 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected
IPv6: ADDRCONF(NETDEV_CHANGE): vxcan0: link becomes ready

Memory state around the buggy address:
 ffff88804c22cf80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804c22d000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88804c22d080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88804c22d100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88804c22d180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/01/10 17:47 linux-4.19.y cb1f9a169a0e 532ec44e .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.