syzbot


KASAN: use-after-free Read in packet_rcv

Status: auto-closed as invalid on 2020/02/29 00:45
Reported-by: syzbot+60e8f03dbaac0c154beb@syzkaller.appspotmail.com
First crash: 1847d, last: 1847d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in packet_rcv 1 1777d 1777d 0/1 auto-closed as invalid on 2020/05/09 17:47
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.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:
==================================================================
BUG: KASAN: use-after-free in packet_rcv+0x1158/0x12f0 net/packet/af_packet.c:2134
Read of size 1 at addr ffff888067a8b9bc by task syz-executor.3/11589

CPU: 0 PID: 11589 Comm: syz-executor.3 Not tainted 4.14.151 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427
 packet_rcv+0x1158/0x12f0 net/packet/af_packet.c:2134
 deliver_skb net/core/dev.c:1881 [inline]
 dev_queue_xmit_nit+0x1f6/0x940 net/core/dev.c:1937
 xmit_one net/core/dev.c:3005 [inline]
 dev_hard_start_xmit+0xa7/0x8b0 net/core/dev.c:3025
 __dev_queue_xmit+0x1d95/0x25e0 net/core/dev.c:3525
 dev_queue_xmit+0x18/0x20 net/core/dev.c:3558
 br_dev_queue_push_xmit+0x367/0x530 net/bridge/br_forward.c:55
 NF_HOOK include/linux/netfilter.h:250 [inline]
 NF_HOOK include/linux/netfilter.h:244 [inline]
 br_forward_finish+0xbc/0x320 net/bridge/br_forward.c:67
 NF_HOOK include/linux/netfilter.h:250 [inline]
 NF_HOOK include/linux/netfilter.h:244 [inline]
 __br_forward+0x560/0x9c0 net/bridge/br_forward.c:111
 deliver_clone+0x61/0xc0 net/bridge/br_forward.c:127
 maybe_deliver net/bridge/br_forward.c:168 [inline]
 maybe_deliver net/bridge/br_forward.c:156 [inline]
 br_flood+0x3c8/0x530 net/bridge/br_forward.c:210
 br_dev_xmit+0x9a4/0xd40 net/bridge/br_device.c:83
 __netdev_start_xmit include/linux/netdevice.h:4033 [inline]
 netdev_start_xmit include/linux/netdevice.h:4042 [inline]
 xmit_one net/core/dev.c:3009 [inline]
 dev_hard_start_xmit+0x18c/0x8b0 net/core/dev.c:3025
 __dev_queue_xmit+0x1d95/0x25e0 net/core/dev.c:3525
 dev_queue_xmit+0x18/0x20 net/core/dev.c:3558
 neigh_hh_output include/net/neighbour.h:490 [inline]
 neigh_output include/net/neighbour.h:498 [inline]
 ip6_finish_output2+0x10bd/0x21b0 net/ipv6/ip6_output.c:120
 ip6_finish_output+0x4f4/0xb50 net/ipv6/ip6_output.c:154
 NF_HOOK_COND include/linux/netfilter.h:239 [inline]
 ip6_output+0x20f/0x6d0 net/ipv6/ip6_output.c:171
 dst_output include/net/dst.h:462 [inline]
 NF_HOOK include/linux/netfilter.h:250 [inline]
 ndisc_send_skb+0xb56/0x11e0 net/ipv6/ndisc.c:483
 ndisc_send_rs+0x129/0x680 net/ipv6/ndisc.c:677
 addrconf_rs_timer+0x289/0x5a0 net/ipv6/addrconf.c:3757
 call_timer_fn+0x161/0x670 kernel/time/timer.c:1279
 expire_timers kernel/time/timer.c:1318 [inline]
 __run_timers kernel/time/timer.c:1636 [inline]
 __run_timers kernel/time/timer.c:1604 [inline]
 run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649
 __do_softirq+0x244/0x9a0 kernel/softirq.c:288
 invoke_softirq kernel/softirq.c:368 [inline]
 irq_exit+0x160/0x1b0 kernel/softirq.c:409
 exiting_irq arch/x86/include/asm/apic.h:648 [inline]
 smp_apic_timer_interrupt+0x146/0x5e0 arch/x86/kernel/apic/apic.c:1102
 apic_timer_interrupt+0x96/0xa0 arch/x86/entry/entry_64.S:792
 </IRQ>
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x54/0x90 kernel/locking/spinlock.c:200
RSP: 0018:ffff888060adfa38 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff0ee2a8b RBX: ffff888092050300 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: ffff888092050b80 RDI: ffff888092050b7c
RBP: ffff888060adfa40 R08: ffff888092050300 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880aee2b500
R13: ffff88808ae36680 R14: 0000000000000000 R15: ffff8880aee2be58
 finish_lock_switch kernel/sched/sched.h:1350 [inline]
 finish_task_switch+0x178/0x650 kernel/sched/core.c:2674
 context_switch kernel/sched/core.c:2810 [inline]
 __schedule+0x7c0/0x1cd0 kernel/sched/core.c:3383
 preempt_schedule_common+0x4f/0xe0 kernel/sched/core.c:3507
 preempt_schedule+0x4b/0x60 kernel/sched/core.c:3533
 ___preempt_schedule+0x16/0x18
 __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:161 [inline]
 _raw_spin_unlock_irqrestore+0xbd/0xe0 kernel/locking/spinlock.c:192
 swake_up+0x4d/0x60 kernel/sched/swait.c:39
 __rcu_report_exp_rnp+0x1d8/0x270 kernel/rcu/tree_exp.h:185
 rcu_report_exp_rnp kernel/rcu/tree_exp.h:210 [inline]
 rcu_read_unlock_special+0x660/0xd40 kernel/rcu/tree_plugin.h:540
 __rcu_read_unlock+0x161/0x170 kernel/rcu/update.c:260
 rcu_read_unlock include/linux/rcupdate.h:684 [inline]
 __rhashtable_insert_fast include/linux/rhashtable.h:806 [inline]
 rhashtable_lookup_insert_fast include/linux/rhashtable.h:922 [inline]
 tipc_sk_insert net/tipc/socket.c:2309 [inline]
 tipc_sk_create+0x9a2/0x1950 net/tipc/socket.c:442
 __sock_create+0x2f6/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd3/0x170 net/socket.c:1325
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x459f49
RSP: 002b:00007f213353ac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000029
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459f49
RDX: 0000000000000000 RSI: 0000000000000805 RDI: 000000000000001e
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f213353b6d4
R13: 00000000004c8fd9 R14: 00000000004e05e8 R15: 00000000ffffffff

Allocated by task 11594:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 __do_kmalloc mm/slab.c:3720 [inline]
 __kmalloc+0x15d/0x7a0 mm/slab.c:3729
 kmalloc include/linux/slab.h:493 [inline]
 sk_prot_alloc+0x171/0x2a0 net/core/sock.c:1467
 sk_alloc+0x39/0xd70 net/core/sock.c:1521
 packet_create+0xfa/0x820 net/packet/af_packet.c:3264
 __sock_create+0x2f6/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd3/0x170 net/socket.c:1325
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 11592:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcc/0x270 mm/slab.c:3815
 sk_prot_free net/core/sock.c:1504 [inline]
 __sk_destruct+0x450/0x580 net/core/sock.c:1581
 sk_destruct+0xa4/0xd0 net/core/sock.c:1596
 __sk_free+0x54/0x230 net/core/sock.c:1604
 sk_free+0x35/0x40 net/core/sock.c:1615
 sock_put include/net/sock.h:1653 [inline]
 packet_release+0x8ba/0xb50 net/packet/af_packet.c:3093
 __sock_release+0xce/0x2b0 net/socket.c:602
 sock_close+0x1b/0x30 net/socket.c:1139
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888067a8b2c0
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1788 bytes inside of
 2048-byte region [ffff888067a8b2c0, ffff888067a8bac0)
The buggy address belongs to the page:
page:ffffea00019ea280 count:1 mapcount:0 mapping:ffff888067a8a1c0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff888067a8a1c0 0000000000000000 0000000100000003
raw: ffffea00022fcda0 ffffea0001976820 ffff8880aa800c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888067a8b880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888067a8b900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888067a8b980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff888067a8ba00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888067a8ba80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/01 00:44 linux-4.14.y ddef1e8e3f6e a41ca8fa .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.