KASAN: use-after-free Read in tcp_write_timer_handler

27 views
Skip to first unread message

syzbot

unread,
Dec 19, 2019, 4:22:09 PM12/19/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: bfb9e5c0 Linux 4.14.159
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16ece0c1e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=8b2dd838381e2c80
dashboard link: https://syzkaller.appspot.com/bug?extid=beea39cd3bcda87d29dc
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+beea39...@syzkaller.appspotmail.com

R13: 00000000004c7d30 R14: 00000000004dec28 R15: 0000000000000005
protocol 88fb is buggy, dev hsr_slave_0
==================================================================
protocol 88fb is buggy, dev hsr_slave_1
BUG: KASAN: use-after-free in tcp_orphan_retries net/ipv4/tcp_timer.c:112
[inline]
BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:354
[inline]
BUG: KASAN: use-after-free in tcp_write_timer_handler+0x784/0x7e0
net/ipv4/tcp_timer.c:587
Read of size 4 at addr ffff88805e0e8764 by task blkid/23429

CPU: 1 PID: 23429 Comm: blkid Not tainted 4.14.159-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+0x142/0x197 lib/dump_stack.c:58
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_load4_noabort+0x14/0x20 mm/kasan/report.c:429
tcp_orphan_retries net/ipv4/tcp_timer.c:112 [inline]
tcp_probe_timer net/ipv4/tcp_timer.c:354 [inline]
tcp_write_timer_handler+0x784/0x7e0 net/ipv4/tcp_timer.c:587
tcp_write_timer+0xd6/0x180 net/ipv4/tcp_timer.c:601
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:__unwind_start+0x264/0x3d0 arch/x86/kernel/unwind_frame.c:432
RSP: 0018:ffff8880804bf7f0 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff10
RAX: 1ffff11010097f12 RBX: ffff8880804bf8c0 RCX: ffff8880804c0000
RDX: dffffc0000000000 RSI: ffff8880804bf8c8 RDI: ffff8880804bf890
RBP: ffff8880804bf830 R08: 0000000000000001 R09: ffff8880804bf898
R10: ffff8880804bf868 R11: ffff8880804bf878 R12: ffffed1010097f0a
R13: ffffed1010097f09 R14: dffffc0000000000 R15: ffff8880804bf840
unwind_start arch/x86/include/asm/unwind.h:60 [inline]
__save_stack_trace+0x4a/0xd0 arch/x86/kernel/stacktrace.c:43
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
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
slab_post_alloc_hook mm/slab.h:442 [inline]
slab_alloc mm/slab.c:3390 [inline]
kmem_cache_alloc+0x11b/0x780 mm/slab.c:3550
anon_vma_chain_alloc mm/rmap.c:129 [inline]
anon_vma_clone+0xde/0x470 mm/rmap.c:269
__split_vma+0x28a/0x6d0 mm/mmap.c:2605
split_vma+0x8d/0xc0 mm/mmap.c:2648
mprotect_fixup+0x6fd/0x920 mm/mprotect.c:403
do_mprotect_pkey+0x470/0x830 mm/mprotect.c:541
SYSC_mprotect mm/mprotect.c:566 [inline]
SyS_mprotect+0x2b/0x40 mm/mprotect.c:563
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x7efe95012447
RSP: 002b:00007fffaa83cb68 EFLAGS: 00000206 ORIG_RAX: 000000000000000a
RAX: ffffffffffffffda RBX: 00007efe9521a4c8 RCX: 00007efe95012447
RDX: 0000000000000001 RSI: 0000000000003000 RDI: 00007efe94ff8000
RBP: 00007fffaa83cc60 R08: 0000000000000001 R09: 0000000000000039
R10: 00007efe94ddb4c0 R11: 0000000000000206 R12: 00007efe94dd5000
R13: 00007efe94ffb4b0 R14: 00007efe94ddb4c0 R15: 00007efe94ffafd0

Allocated by task 7022:
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
kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
kmem_cache_zalloc include/linux/slab.h:651 [inline]
net_alloc net/core/net_namespace.c:362 [inline]
copy_net_ns+0xfa/0x440 net/core/net_namespace.c:402
create_new_namespaces+0x37b/0x720 kernel/nsproxy.c:107
unshare_nsproxy_namespaces+0xab/0x1e0 kernel/nsproxy.c:206
SYSC_unshare kernel/fork.c:2391 [inline]
SyS_unshare+0x2f3/0x7e0 kernel/fork.c:2341
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 2309:
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]
kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
net_free net/core/net_namespace.c:378 [inline]
net_drop_ns+0x6e/0x80 net/core/net_namespace.c:385
cleanup_net+0x4e9/0x870 net/core/net_namespace.c:502
process_one_work+0x863/0x1600 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x319/0x430 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff88805e0e8080
which belongs to the cache net_namespace of size 8832
The buggy address is located 1764 bytes inside of
8832-byte region [ffff88805e0e8080, ffff88805e0ea300)
The buggy address belongs to the page:
page:ffffea0001783a00 count:1 mapcount:0 mapping:ffff88805e0e8080 index:0x0
compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff88805e0e8080 0000000000000000 0000000100000001
raw: ffffea000200a120 ffffea000170ff20 ffff8880aa9e93c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88805e0e8600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805e0e8680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ffff88805e0e8700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88805e0e8780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805e0e8800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Apr 17, 2020, 5:22:09 PM4/17/20
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages