syzbot


KASAN: use-after-free Read in packet_rcv

Status: auto-closed as invalid on 2019/06/25 08:50
Reported-by: syzbot+ad116a201b65496c843d@syzkaller.appspotmail.com
First crash: 2156d, last: 2156d
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 1776d 1776d 0/1 auto-closed as invalid on 2020/05/09 17:47
linux-4.14 KASAN: use-after-free Read in packet_rcv (2) 1 1445d 1445d 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:
ip6_tunnel: ip6tnl3 xmit: Local address not yet configured!
ip6_tunnel: ip6tnl1 xmit: Local address not yet configured!
ip6_tunnel: ip6tnl1 xmit: Local address not yet configured!
ip6_tunnel: ip6tnl3 xmit: Local address not yet configured!
==================================================================
BUG: KASAN: use-after-free in packet_rcv+0x108e/0x11f0 net/packet/af_packet.c:2134
Read of size 1 at addr ffff8881ce9e647c by task syz-executor2/20846

CPU: 1 PID: 20846 Comm: syz-executor2 Not tainted 4.14.90+ #29
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0xb9/0x11b lib/dump_stack.c:53
ip6_tunnel: ip6tnl3 xmit: Local address not yet configured!
 print_address_description+0x60/0x22b mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report.cold.6+0x11b/0x2dd mm/kasan/report.c:409
 packet_rcv+0x108e/0x11f0 net/packet/af_packet.c:2134
 deliver_skb net/core/dev.c:1881 [inline]
 dev_queue_xmit_nit+0x220/0x960 net/core/dev.c:1937
 xmit_one net/core/dev.c:3005 [inline]
 dev_hard_start_xmit+0xa2/0x890 net/core/dev.c:3025
 __dev_queue_xmit+0x13d9/0x1f40 net/core/dev.c:3525
ip6_tunnel: ip6tnl2 xmit: Local address not yet configured!
 neigh_output include/net/neighbour.h:500 [inline]
 ip6_finish_output2+0xc75/0x1f90 net/ipv6/ip6_output.c:120
ip6_tunnel: 6tnl0 xmit: Local address not yet configured!
 ip6_finish_output+0x62e/0xb10 net/ipv6/ip6_output.c:154
 NF_HOOK_COND include/linux/netfilter.h:239 [inline]
 ip6_output+0x1dd/0x680 net/ipv6/ip6_output.c:171
 dst_output include/net/dst.h:459 [inline]
 NF_HOOK include/linux/netfilter.h:250 [inline]
 mld_sendpack+0xaad/0xfa0 net/ipv6/mcast.c:1659
 mld_send_cr net/ipv6/mcast.c:1955 [inline]
 mld_ifc_timer_expire+0x3b6/0x7c0 net/ipv6/mcast.c:2454
 call_timer_fn+0x163/0x6d0 kernel/time/timer.c:1279
 expire_timers+0x1f3/0x4a0 kernel/time/timer.c:1318
 __run_timers kernel/time/timer.c:1634 [inline]
 run_timer_softirq+0x1da/0x560 kernel/time/timer.c:1647
 __do_softirq+0x20d/0x9bd kernel/softirq.c:288
 invoke_softirq kernel/softirq.c:368 [inline]
 irq_exit+0x117/0x150 kernel/softirq.c:409
 exiting_irq arch/x86/include/asm/apic.h:648 [inline]
 smp_apic_timer_interrupt+0x18c/0x600 arch/x86/kernel/apic/apic.c:1064
 apic_timer_interrupt+0x84/0x90 arch/x86/entry/entry_64.S:787
 </IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:778 [inline]
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0x59/0x70 kernel/locking/spinlock.c:192
RSP: 0018:ffff88819f45f8c8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff10
RAX: 0000000000000007 RBX: 0000000000000246 RCX: 1ffff1103a837cca
RDX: 0000000000000000 RSI: ffff8881d41be658 RDI: 0000000000000246
RBP: ffffffffb4ed5740 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffb4ed5740
R13: ffff8881d41be1a0 R14: 0000000000000000 R15: ffffffffb4ed57e8
 rcu_read_unlock_special+0x7e7/0xac0 kernel/rcu/tree_plugin.h:526
 __rcu_read_unlock+0x15a/0x160 kernel/rcu/update.c:260
 rcu_read_unlock include/linux/rcupdate.h:686 [inline]
 count_memcg_event_mm include/linux/memcontrol.h:661 [inline]
 handle_mm_fault+0x1cd/0x6eb mm/memory.c:4101
 __do_page_fault+0x45d/0xb60 arch/x86/mm/fault.c:1425
 page_fault+0x22/0x50 arch/x86/entry/entry_64.S:1104
RIP: 0010:__clear_user+0x3a/0x60 arch/x86/lib/usercopy_64.c:23
RSP: 0018:ffff88819f45fb18 EFLAGS: 00010202
RAX: 0000000000000000 RBX: 0000000000000200 RCX: 00000000000000c8
RDX: 0000000000000000 RSI: 0000000000000008 RDI: 000000002016b000
RBP: 000000002016a640 R08: 0000000000000001 R09: 0000000000000000
R10: ffff8881d41be630 R11: 0000000000000001 R12: 00007ffffffff000
R13: 000000002016b640 R14: ffff88819f45fd98 R15: 000000007fe97000
 clear_user+0x76/0xa0 arch/x86/lib/usercopy_64.c:53
 iov_iter_zero+0x1eb/0xbd0 lib/iov_iter.c:763
 read_iter_zero+0xac/0x170 drivers/char/mem.c:689
 call_read_iter include/linux/fs.h:1778 [inline]
 new_sync_read fs/read_write.c:401 [inline]
 __vfs_read+0x414/0x5b0 fs/read_write.c:413
 vfs_read+0x11e/0x330 fs/read_write.c:447
 SYSC_pread64 fs/read_write.c:615 [inline]
 SyS_pread64+0x136/0x160 fs/read_write.c:602
 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4579b9
RSP: 002b:00007f27b06d1c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000011
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00000000004579b9
RDX: 00000000fffffede RSI: 0000000020002640 RDI: 0000000000000008
RBP: 000000000073c040 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f27b06d26d4
R13: 00000000004c42aa R14: 00000000004d7470 R15: 00000000ffffffff

Allocated by task 20779:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc.part.1+0x4f/0xd0 mm/kasan/kasan.c:551
 __kmalloc+0x153/0x340 mm/slub.c:3760
 kmalloc include/linux/slab.h:493 [inline]
 sk_prot_alloc+0x1bd/0x270 net/core/sock.c:1469
 sk_alloc+0x34/0x5f0 net/core/sock.c:1523
 packet_create+0xf0/0x8d0 net/packet/af_packet.c:3236
 __sock_create+0x2f7/0x600 net/socket.c:1274
 sock_create net/socket.c:1314 [inline]
 SYSC_socket net/socket.c:1344 [inline]
 SyS_socket+0xdf/0x1d0 net/socket.c:1324
 do_syscall_64+0x19b/0x4b0 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 20766:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xac/0x190 mm/kasan/kasan.c:524
 slab_free_hook mm/slub.c:1389 [inline]
 slab_free_freelist_hook mm/slub.c:1410 [inline]
 slab_free mm/slub.c:2966 [inline]
 kfree+0xf5/0x310 mm/slub.c:3897
 sk_prot_free net/core/sock.c:1506 [inline]
 __sk_destruct+0x4a5/0x5a0 net/core/sock.c:1585
 sk_destruct+0x5d/0x70 net/core/sock.c:1593
 __sk_free+0x4a/0x220 net/core/sock.c:1601
 sk_free+0x2c/0x40 net/core/sock.c:1612
 sock_put include/net/sock.h:1643 [inline]
 packet_release+0x8b7/0xb60 net/packet/af_packet.c:3065
 __sock_release+0xce/0x250 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1138
 __fput+0x25e/0x6f0 fs/file_table.c:210
 task_work_run+0x116/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x12e/0x150 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:267 [inline]
 do_syscall_64+0x35d/0x4b0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8881ce9e5d80
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1788 bytes inside of
 2048-byte region [ffff8881ce9e5d80, ffff8881ce9e6580)
The buggy address belongs to the page:
page:ffffea00073a7800 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x4000000000008100(slab|head)
raw: 4000000000008100 0000000000000000 0000000000000000 00000001000f000f
raw: 0000000000000000 0000000100000001 ffff8881da802800 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881ce9e6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881ce9e6380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881ce9e6400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff8881ce9e6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881ce9e6500: 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
2018/12/27 08:49 android-4.14 815e34f802d8 e747ec98 .config console log report ci-android-414-kasan-gce-root
* Struck through repros no longer work on HEAD.