syzbot


KASAN: use-after-free Read in packet_rcv (2)

Status: auto-closed as invalid on 2021/04/05 18:49
Reported-by: syzbot+6a481d7b570b5d4dc0f6@syzkaller.appspotmail.com
First crash: 577d, last: 577d
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 908d 908d 0/1 auto-closed as invalid on 2020/05/09 17:47
android-414 KASAN: use-after-free Read in packet_rcv 1 1288d 1180d 0/1 auto-closed as invalid on 2019/06/25 08:50
linux-4.14 KASAN: use-after-free Read in packet_rcv 1 979d 979d 0/1 auto-closed as invalid on 2020/02/29 00:45
linux-4.19 KASAN: use-after-free Read in packet_rcv (2) 9 32d 214d 0/1 upstream: reported on 2021/12/04 22:14

Sample crash report:
netlink: 36 bytes leftover after parsing attributes in process `syz-executor.2'.
netlink: 16 bytes leftover after parsing attributes in process `syz-executor.5'.
==================================================================
BUG: KASAN: use-after-free in packet_rcv+0x11df/0x1290 net/packet/af_packet.c:2143
Read of size 1 at addr ffff8880a2158ffc by task syz-executor.3/17099

CPU: 0 PID: 17099 Comm: syz-executor.3 Not tainted 4.14.210-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:17 [inline]
 dump_stack+0x1b2/0x283 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load1_noabort+0x68/0x70 mm/kasan/report.c:427
 packet_rcv+0x11df/0x1290 net/packet/af_packet.c:2143
 deliver_skb net/core/dev.c:1877 [inline]
 dev_queue_xmit_nit+0x215/0x950 net/core/dev.c:1933
 xmit_one net/core/dev.c:3001 [inline]
 dev_hard_start_xmit+0xaa/0x890 net/core/dev.c:3021
 __dev_queue_xmit+0x1d7f/0x2480 net/core/dev.c:3521
 hsr_xmit net/hsr/hsr_forward.c:237 [inline]
 hsr_forward_do net/hsr/hsr_forward.c:295 [inline]
 hsr_forward_skb+0xbc7/0x19b1 net/hsr/hsr_forward.c:373
 send_hsr_supervision_frame+0x8e3/0xf00 net/hsr/hsr_device.c:321
 hsr_announce+0xf0/0x330 net/hsr/hsr_device.c:350
 call_timer_fn+0x14a/0x650 kernel/time/timer.c:1280
 expire_timers+0x232/0x4d0 kernel/time/timer.c:1319
 __run_timers kernel/time/timer.c:1637 [inline]
 run_timer_softirq+0x1d5/0x5a0 kernel/time/timer.c:1650
 __do_softirq+0x254/0xa1d kernel/softirq.c:288
 invoke_softirq kernel/softirq.c:368 [inline]
 irq_exit+0x193/0x240 kernel/softirq.c:409
 exiting_irq arch/x86/include/asm/apic.h:648 [inline]
 smp_apic_timer_interrupt+0x141/0x5e0 arch/x86/kernel/apic/apic.c:1102
 apic_timer_interrupt+0x93/0xa0 arch/x86/entry/entry_64.S:793
 </IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [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:192
RSP: 0018:ffff888059b77658 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff11e1251 RBX: 0000000000000286 RCX: 1ffff110154561dd
RDX: dffffc0000000000 RSI: ffff8880aa2b0ef0 RDI: 0000000000000286
RBP: ffffffff88f79f60 R08: ffff8880ba52ac30 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff8880b1dd9348 R14: ffff8880a42ce880 R15: 0000000000000000
 __rcu_read_unlock+0x158/0x160 kernel/rcu/update.c:260
 rcu_read_unlock include/linux/rcupdate.h:684 [inline]
 ext4_get_group_desc+0x193/0x430 fs/ext4/balloc.c:294
 __ext4_get_inode_loc+0x178/0xf30 fs/ext4/inode.c:4507
 ext4_get_inode_loc fs/ext4/inode.c:4633 [inline]
 ext4_reserve_inode_write+0xd9/0x230 fs/ext4/inode.c:5794
 ext4_mark_inode_dirty+0x12f/0x7a0 fs/ext4/inode.c:5961
 __ext4_new_inode+0x2619/0x4eb0 fs/ext4/ialloc.c:1189
 ext4_tmpfile+0x1bf/0x3e0 fs/ext4/namei.c:2558
 vfs_tmpfile+0x1ef/0x330 fs/namei.c:3468
 ovl_do_tmpfile fs/overlayfs/overlayfs.h:178 [inline]
 ovl_fill_super+0x1077/0x2610 fs/overlayfs/super.c:1012
 mount_nodev+0x4c/0xf0 fs/super.c:1180
 mount_fs+0x92/0x2a0 fs/super.c:1237
 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046
 vfs_kern_mount fs/namespace.c:1036 [inline]
 do_new_mount fs/namespace.c:2549 [inline]
 do_mount+0xe53/0x2a00 fs/namespace.c:2879
 SYSC_mount fs/namespace.c:3095 [inline]
 SyS_mount+0xa8/0x120 fs/namespace.c:3072
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45de79
RSP: 002b:00007fa29057bc68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 000000000045de79
RDX: 00000000200000c0 RSI: 0000000020000000 RDI: 000000000040000a
RBP: 000000000118bf70 R08: 0000000020000100 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118bf2c
R13: 00007ffda035d48f R14: 00007fa29057c9c0 R15: 000000000118bf2c

Allocated by task 17107:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
 __do_kmalloc mm/slab.c:3720 [inline]
 __kmalloc+0x15a/0x400 mm/slab.c:3729
 kmalloc include/linux/slab.h:493 [inline]
 sk_prot_alloc+0x1ba/0x290 net/core/sock.c:1467
 sk_alloc+0x36/0xcd0 net/core/sock.c:1521
 packet_create+0xf5/0x7f0 net/packet/af_packet.c:3295
 __sock_create+0x303/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd1/0x1b0 net/socket.c:1325
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 17105:
 save_stack mm/kasan/kasan.c:447 [inline]
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xc9/0x250 mm/slab.c:3815
 sk_prot_free net/core/sock.c:1504 [inline]
 __sk_destruct+0x5e3/0x760 net/core/sock.c:1582
 sk_destruct net/core/sock.c:1597 [inline]
 __sk_free+0xd9/0x2d0 net/core/sock.c:1605
 sk_free+0x2b/0x40 net/core/sock.c:1616
 sock_put include/net/sock.h:1662 [inline]
 packet_release+0x837/0xa80 net/packet/af_packet.c:3124
 __sock_release+0xcd/0x2b0 net/socket.c:602
 sock_close+0x15/0x20 net/socket.c:1139
 __fput+0x25f/0x7a0 fs/file_table.c:210
 task_work_run+0x11f/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1ad/0x200 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+0x4a3/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880a2158900
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 1788 bytes inside of
 2048-byte region [ffff8880a2158900, ffff8880a2159100)
The buggy address belongs to the page:
page:ffffea0002885600 count:1 mapcount:0 mapping:ffff8880a2158080 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffff8880a2158080 0000000000000000 0000000100000003
raw: ffffea000268d620 ffffea0002776d20 ffff88813fe80c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a2158e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a2158f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a2158f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff8880a2159000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a2159080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/12/06 18:48 linux-4.14.y c196b3a9c83a f12ba0c5 .config log report info