syzbot


KASAN: use-after-free Read in tcp_retransmit_timer

Status: closed as invalid on 2019/03/10 18:51
Subsystems: net
[Documentation on labels]
First crash: 2020d, last: 1907d
Similar bugs (12)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (3) 1 541d 541d 0/1 auto-obsoleted due to no activity on 2023/02/27 17:38
linux-4.14 KASAN: slab-out-of-bounds Read in tcp_retransmit_timer 5 1080d 1155d 0/1 auto-closed as invalid on 2021/09/06 04:07
linux-6.1 KASAN: use-after-free Read in tcp_retransmit_timer 14 24d 42d 0/3 upstream: reported on 2024/03/12 12:56
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer (2) 12 34d 183d 0/3 upstream: reported on 2023/10/23 18:56
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer 2 1579d 1580d 0/1 auto-closed as invalid on 2020/04/25 09:53
upstream KASAN: use-after-free Read in tcp_retransmit_timer (2) net 1 1864d 1864d 0/26 closed as invalid on 2019/04/19 21:45
upstream KASAN: use-after-free Read in tcp_retransmit_timer (5) net C unreliable 16000 508d 1520d 22/26 fixed on 2023/02/24 13:50
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (2) 6 1009d 1176d 0/1 auto-closed as invalid on 2021/11/16 03:14
upstream KASAN: use-after-free Read in tcp_retransmit_timer (3) net 5 1776d 1795d 0/26 closed as invalid on 2019/07/01 18:06
linux-4.19 KASAN: slab-out-of-bounds Read in tcp_retransmit_timer 9 687d 866d 0/1 auto-obsoleted due to no activity on 2022/10/04 11:51
upstream KASAN: use-after-free Read in tcp_retransmit_timer (4) net 2 1720d 1721d 0/26 closed as invalid on 2019/10/03 04:18
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer 76 292d 400d 0/3 auto-obsoleted due to no activity on 2023/09/14 02:10

Sample crash report:
binder: 7833:7866 ioctl c0306201 0 returned -14
IPVS: ftp: loaded support on port[0] = 21
==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x2ae4/0x2f40 net/ipv4/tcp_timer.c:487
Read of size 8 at addr ffff88805bef4670 by task syz-executor1/7864

CPU: 1 PID: 7864 Comm: syz-executor1 Not tainted 5.0.0-rc4+ #56
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135
 tcp_retransmit_timer+0x2ae4/0x2f40 net/ipv4/tcp_timer.c:487
 tcp_write_timer_handler+0x4c9/0x8e0 net/ipv4/tcp_timer.c:600
 tcp_write_timer+0x10e/0x1d0 net/ipv4/tcp_timer.c:620
 call_timer_fn+0x190/0x720 kernel/time/timer.c:1325
 expire_timers kernel/time/timer.c:1362 [inline]
 __run_timers kernel/time/timer.c:1681 [inline]
 __run_timers kernel/time/timer.c:1649 [inline]
 run_timer_softirq+0x652/0x1700 kernel/time/timer.c:1694
 __do_softirq+0x266/0x95a kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:373 [inline]
 irq_exit+0x180/0x1d0 kernel/softirq.c:413
 exiting_irq arch/x86/include/asm/apic.h:536 [inline]
 smp_apic_timer_interrupt+0x14a/0x570 arch/x86/kernel/apic/apic.c:1062
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:807
 </IRQ>
RIP: 0010:kernfs_active+0x31/0x100 fs/kernfs/dir.c:30
Code: 48 89 fb e8 81 df 9d ff 48 c7 c0 78 a5 5c 89 48 ba 00 00 00 00 00 fc ff df 48 89 c1 83 e0 07 48 c1 e9 03 83 c0 03 0f b6 14 11 <38> d0 7c 08 84 d2 0f 85 9d 00 00 00 44 8b 25 04 ac 8a 07 31 ff 44
RSP: 0018:ffff88809eea77d0 EFLAGS: 00000206 ORIG_RAX: ffffffffffffff13
RAX: 0000000000000003 RBX: ffff8880a8d5c8c0 RCX: 1ffffffff12b94af
RDX: 0000000000000000 RSI: ffffffff81d1f93f RDI: ffff8880a8d5c8c0
RBP: ffff88809eea77e0 R08: ffff888085df2440 R09: ffffed10151ab919
R10: ffffed10151ab918 R11: ffff8880a8d5c8c3 R12: 0000000000000001
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff8880a8d5c8c0
 kernfs_drain fs/kernfs/dir.c:463 [inline]
 __kernfs_remove fs/kernfs/dir.c:1318 [inline]
 __kernfs_remove+0x364/0x950 fs/kernfs/dir.c:1277
 kernfs_remove_by_name_ns+0x56/0xb0 fs/kernfs/dir.c:1512
 kernfs_remove_by_name include/linux/kernfs.h:539 [inline]
 remove_files.isra.0+0x7b/0x190 fs/sysfs/group.c:27
 sysfs_remove_group+0xb6/0x1b0 fs/sysfs/group.c:264
 netdev_queue_update_kobjects+0x24f/0x3d0 net/core/net-sysfs.c:1511
 netif_set_real_num_tx_queues+0x1c2/0x720 net/core/dev.c:2660
 tun_set_real_num_queues drivers/net/tun.c:637 [inline]
 tun_attach+0x4c8/0x1480 drivers/net/tun.c:869
 tun_set_iff drivers/net/tun.c:2731 [inline]
 __tun_chr_ioctl+0x1e69/0x3e50 drivers/net/tun.c:3070
 tun_chr_ioctl+0x2b/0x40 drivers/net/tun.c:3342
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:509 [inline]
 do_vfs_ioctl+0xd6e/0x1390 fs/ioctl.c:696
 ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
 __do_sys_ioctl fs/ioctl.c:720 [inline]
 __se_sys_ioctl fs/ioctl.c:718 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457e39
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ff88dab8c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457e39
RDX: 0000000020000000 RSI: 00000000400454ca RDI: 000000000000000c
RBP: 000000000073bfa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff88dab96d4
R13: 00000000004c22e8 R14: 00000000004d4b80 R15: 00000000ffffffff

Allocated by task 15711:
 save_stack+0x45/0xd0 mm/kasan/common.c:73
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc mm/kasan/common.c:496 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:469
 kasan_kmalloc mm/kasan/common.c:504 [inline]
 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:411
 kmem_cache_alloc+0x12d/0x710 mm/slab.c:3543
 kmem_cache_zalloc include/linux/slab.h:730 [inline]
 net_alloc net/core/net_namespace.c:384 [inline]
 copy_net_ns+0xed/0x340 net/core/net_namespace.c:424
 create_new_namespaces+0x400/0x7b0 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xc2/0x200 kernel/nsproxy.c:206
 ksys_unshare+0x440/0x980 kernel/fork.c:2550
 __do_sys_unshare kernel/fork.c:2618 [inline]
 __se_sys_unshare kernel/fork.c:2616 [inline]
 __x64_sys_unshare+0x31/0x40 kernel/fork.c:2616
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8785:
 save_stack+0x45/0xd0 mm/kasan/common.c:73
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:458
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:466
 __cache_free mm/slab.c:3487 [inline]
 kmem_cache_free+0x86/0x260 mm/slab.c:3749
 net_free net/core/net_namespace.c:400 [inline]
 net_drop_ns.part.0+0x70/0x90 net/core/net_namespace.c:407
 net_drop_ns net/core/net_namespace.c:406 [inline]
 cleanup_net+0x538/0x960 net/core/net_namespace.c:569
 process_one_work+0x98e/0x1760 kernel/workqueue.c:2153
 worker_thread+0x98/0xe40 kernel/workqueue.c:2296
 kthread+0x357/0x430 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff88805bef4440
 which belongs to the cache net_namespace of size 8576
The buggy address is located 560 bytes inside of
 8576-byte region [ffff88805bef4440, ffff88805bef65c0)
The buggy address belongs to the page:
page:ffffea00016fbd00 count:1 mapcount:0 mapping:ffff88821b6fb0c0 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea000262d008 ffffea0001381b08 ffff88821b6fb0c0
raw: 0000000000000000 ffff88805bef4440 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88805bef4500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805bef4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805bef4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88805bef4680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805bef4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/02/02 15:43 upstream cd984a5be215 c198d5dd .config console log report ci-upstream-kasan-gce
2018/12/17 00:22 upstream 7566ec393f41 def91db3 .config console log report ci-upstream-kasan-gce
2018/12/08 09:16 upstream 5f179793f0a7 65ed2472 .config console log report ci-upstream-kasan-gce
2018/10/12 04:06 upstream 9dcd936c5312 ba6ddb43 .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.