syzbot


KASAN: use-after-free Read in tcp_write_timer_handler

Status: auto-closed as invalid on 2020/04/17 21:22
Reported-by: syzbot+beea39cd3bcda87d29dc@syzkaller.appspotmail.com
First crash: 1588d, last: 1588d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in tcp_write_timer_handler net 6 1866d 1930d 0/26 closed as invalid on 2019/04/19 22:15
linux-4.19 KASAN: use-after-free Read in tcp_write_timer_handler 1 1281d 1281d 0/1 auto-closed as invalid on 2021/02/18 23:19
upstream KASAN: use-after-free Read in tcp_write_timer_handler (2) net 5 1828d 1830d 0/26 closed as invalid on 2019/05/15 23:07
upstream KASAN: use-after-free Read in tcp_write_timer_handler (3) net 82 1680d 1742d 0/26 auto-closed as invalid on 2019/12/04 07:54
linux-5.15 KASAN: use-after-free Read in tcp_write_timer_handler origin:upstream C 230 8d22h 412d 0/3 upstream: reported C repro on 2023/03/09 08:35
linux-6.1 KASAN: use-after-free Read in tcp_write_timer_handler 138 16d 413d 0/3 upstream: reported on 2023/03/08 06:26
linux-4.19 KASAN: use-after-free Read in tcp_write_timer_handler (2) 12 575d 1090d 0/1 auto-obsoleted due to no activity on 2023/01/25 19:39
upstream KASAN: use-after-free Read in tcp_write_timer_handler (4) net 529 498d 1524d 0/26 closed as invalid on 2023/03/21 22:54

Sample crash report:
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
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/12/19 21:21 linux-4.14.y bfb9e5c03076 36650b4b .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.