syzbot


KASAN: use-after-free Read in tcp_retransmit_timer (3)

Status: upstream: reported on 2025/01/28 00:08
Reported-by: syzbot+9e453fcdf5cd848f194e@syzkaller.appspotmail.com
First crash: 59d, last: 2d05h
Similar bugs (16)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in tcp_retransmit_timer (3) 1 115d 115d 0/3 auto-obsoleted due to no activity on 2025/03/13 12:53
linux-6.1 KASAN: use-after-free Read in tcp_retransmit_timer (4) 1 10h45m 10h45m 0/3 upstream: reported on 2025/03/28 06:41
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (3) 1 879d 879d 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 1419d 1494d 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 362d 381d 0/3 auto-obsoleted due to no activity on 2024/06/08 21:34
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer (2) 13 336d 521d 0/3 auto-obsoleted due to no activity on 2024/08/04 05:25
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer 2 1918d 1919d 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 2203d 2203d 0/28 closed as invalid on 2019/04/19 21:45
linux-6.1 KASAN: use-after-free Read in tcp_retransmit_timer (2) 1 272d 272d 0/3 auto-obsoleted due to no activity on 2024/10/06 20:00
upstream KASAN: use-after-free Read in tcp_retransmit_timer (5) net C unreliable 16000 847d 1859d 22/28 fixed on 2023/02/24 13:50
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (2) 6 1348d 1515d 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 2115d 2134d 0/28 closed as invalid on 2019/07/01 18:06
upstream KASAN: use-after-free Read in tcp_retransmit_timer net 4 2246d 2359d 0/28 closed as invalid on 2019/03/10 18:51
linux-4.19 KASAN: slab-out-of-bounds Read in tcp_retransmit_timer 9 1026d 1205d 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 2059d 2059d 0/28 closed as invalid on 2019/10/03 04:18
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer 76 631d 739d 0/3 auto-obsoleted due to no activity on 2023/09/14 02:10

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in tcp_retransmit_timer+0x68d/0x2680 net/ipv4/tcp_timer.c:542
Read of size 8 at addr ffff88802ad1b758 by task kworker/u4:3/373

CPU: 0 PID: 373 Comm: kworker/u4:3 Not tainted 5.15.177-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Workqueue: bat_events batadv_nc_worker
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 tcp_retransmit_timer+0x68d/0x2680 net/ipv4/tcp_timer.c:542
 tcp_write_timer_handler+0x1f7/0x970 net/ipv4/tcp_timer.c:655
 tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:675
 call_timer_fn+0x16d/0x560 kernel/time/timer.c:1451
 expire_timers kernel/time/timer.c:1496 [inline]
 __run_timers+0x67c/0x890 kernel/time/timer.c:1767
 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1780
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 __do_softirq kernel/softirq.c:592 [inline]
 invoke_softirq kernel/softirq.c:432 [inline]
 __irq_exit_rcu+0x157/0x240 kernel/softirq.c:641
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
 sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676
RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x60 kernel/kcov.c:202
Code: 1f 84 00 00 00 00 00 0f 1f 00 53 48 89 fb e8 17 00 00 00 48 8b 3d 98 03 8a 0c 48 89 de 5b e9 47 11 49 00 cc cc cc cc cc cc cc <48> 8b 04 24 65 48 8b 0d 24 ea 81 7e 65 8b 15 25 ea 81 7e 81 e2 00
RSP: 0018:ffffc90002f1fbe8 EFLAGS: 00000287
RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffff88801e771dc0
RDX: 0000000000000000 RSI: ffffffff8af9f2a0 RDI: ffffffff8af9f260
RBP: 0000000000000001 R08: ffffffff8a1c2105 R09: fffffbfff2131821
R10: 0000000000000000 R11: dffffc0000000001 R12: 00000000000001b1
R13: dffffc0000000000 R14: ffff888079380c80 R15: ffff888060f1ce80
 rcu_lock_release+0x5/0x20 include/linux/rcupdate.h:316
 rcu_read_unlock include/linux/rcupdate.h:772 [inline]
 batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:416 [inline]
 batadv_nc_worker+0x239/0x5b0 net/batman-adv/network-coding.c:723
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 4170:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 net_alloc net/core/net_namespace.c:418 [inline]
 copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:473
 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x531/0xa40 kernel/fork.c:3099
 __do_sys_unshare kernel/fork.c:3173 [inline]
 __se_sys_unshare kernel/fork.c:3171 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3171
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 154:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 net_free net/core/net_namespace.c:447 [inline]
 cleanup_net+0xbd8/0xc90 net/core/net_namespace.c:639
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff88802ad1b500
 which belongs to the cache net_namespace of size 6528
The buggy address is located 600 bytes inside of
 6528-byte region [ffff88802ad1b500, ffff88802ad1ce80)
The buggy address belongs to the page:
page:ffffea0000ab4600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2ad18
head:ffffea0000ab4600 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888028431d01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000100000001 ffff8880175ea3c0
raw: 0000000000000000 0000000000040004 00000001ffffffff ffff888028431d01
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4171, ts 59916535178, free_ts 59865675561
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5465
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 net_alloc net/core/net_namespace.c:418 [inline]
 copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:473
 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x531/0xa40 kernel/fork.c:3099
 __do_sys_unshare kernel/fork.c:3173 [inline]
 __se_sys_unshare kernel/fork.c:3171 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3171
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_slab mm/slub.c:2015 [inline]
 discard_slab mm/slub.c:2021 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
 put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
 do_slab_free mm/slub.c:3487 [inline]
 ___cache_free+0xe3/0x100 mm/slub.c:3506
 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233
 getname_flags+0xb8/0x4e0 fs/namei.c:138
 do_sys_openat2+0xd2/0x4f0 fs/open.c:1247
 do_sys_open fs/open.c:1269 [inline]
 __do_sys_openat fs/open.c:1285 [inline]
 __se_sys_openat fs/open.c:1280 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1280
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff88802ad1b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802ad1b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802ad1b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                    ^
 ffff88802ad1b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802ad1b800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	84 00                	test   %al,(%rax)
   2:	00 00                	add    %al,(%rax)
   4:	00 00                	add    %al,(%rax)
   6:	0f 1f 00             	nopl   (%rax)
   9:	53                   	push   %rbx
   a:	48 89 fb             	mov    %rdi,%rbx
   d:	e8 17 00 00 00       	call   0x29
  12:	48 8b 3d 98 03 8a 0c 	mov    0xc8a0398(%rip),%rdi        # 0xc8a03b1
  19:	48 89 de             	mov    %rbx,%rsi
  1c:	5b                   	pop    %rbx
  1d:	e9 47 11 49 00       	jmp    0x491169
  22:	cc                   	int3
  23:	cc                   	int3
  24:	cc                   	int3
  25:	cc                   	int3
  26:	cc                   	int3
  27:	cc                   	int3
  28:	cc                   	int3
* 29:	48 8b 04 24          	mov    (%rsp),%rax <-- trapping instruction
  2d:	65 48 8b 0d 24 ea 81 	mov    %gs:0x7e81ea24(%rip),%rcx        # 0x7e81ea59
  34:	7e
  35:	65 8b 15 25 ea 81 7e 	mov    %gs:0x7e81ea25(%rip),%edx        # 0x7e81ea61
  3c:	81                   	.byte 0x81
  3d:	e2 00                	loop   0x3f

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/28 00:08 linux-5.15.y 003148680b79 18070896 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-perf KASAN: use-after-free Read in tcp_retransmit_timer
2025/03/26 12:01 linux-5.15.y 0c935c049b5c 89d30d73 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
* Struck through repros no longer work on HEAD.