syzbot


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

Status: upstream: reported on 2025/03/28 06:41
Reported-by: syzbot+724b6182cd2c88e9450e@syzkaller.appspotmail.com
First crash: 29d, last: 8d06h
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 143d 143d 0/3 auto-obsoleted due to no activity on 2025/03/13 12:53
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (3) 1 908d 908d 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 1448d 1523d 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 391d 409d 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 365d 550d 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 1946d 1948d 0/1 auto-closed as invalid on 2020/04/25 09:53
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer (3) 4 10d 88d 0/3 upstream: reported on 2025/01/28 00:08
upstream KASAN: use-after-free Read in tcp_retransmit_timer (2) net 1 2231d 2231d 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 301d 301d 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 875d 1888d 22/28 fixed on 2023/02/24 13:50
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (2) 6 1377d 1544d 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 2143d 2163d 0/28 closed as invalid on 2019/07/01 18:06
upstream KASAN: use-after-free Read in tcp_retransmit_timer net 4 2274d 2388d 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 1054d 1233d 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 2088d 2088d 0/28 closed as invalid on 2019/10/03 04:18
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer 76 660d 767d 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+0x751/0x2830 net/ipv4/tcp_timer.c:546
Read of size 8 at addr ffff88802fbd1f08 by task syz.6.1370/11157

CPU: 0 PID: 11157 Comm: syz.6.1370 Not tainted 6.1.134-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:427
 kasan_report+0x136/0x160 mm/kasan/report.c:531
 tcp_retransmit_timer+0x751/0x2830 net/ipv4/tcp_timer.c:546
 tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:676
 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1504
 expire_timers kernel/time/timer.c:1549 [inline]
 __run_timers+0x67c/0x890 kernel/time/timer.c:1820
 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1833
 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:578
 __do_softirq kernel/softirq.c:612 [inline]
 invoke_softirq kernel/softirq.c:452 [inline]
 __irq_exit_rcu+0x157/0x240 kernel/softirq.c:661
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:673
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline]
 sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1118
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:691
RIP: 0010:__preempt_count_add kernel/rcu/tree.c:717 [inline]
RIP: 0010:rcu_is_watching+0x2/0xb0 kernel/rcu/tree.c:720
Code: 44 24 21 02 0f 84 02 ff ff ff e9 6c ff ff ff 48 c7 c7 e0 50 33 8d 4c 89 f6 e8 fa 2d fb 02 e9 2b ff ff ff e8 80 8b 3d 09 41 57 <41> 56 53 65 ff 05 8c 27 8f 7e e8 bf a3 3d 09 89 c3 83 f8 08 73 76
RSP: 0018:ffffc90004cf75c8 EFLAGS: 00000257
RAX: 0000000000000001 RBX: 0000000000000000 RCX: ffffffff81699ea2
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffffffff8ea0bd28
RBP: ffffc90004cf7750 R08: dffffc0000000000 R09: fffffbfff1d417a6
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff888054908528 R14: 0000000000000000 R15: 0000000000000000
 trace_contention_begin+0x61/0x170 include/trace/events/lock.h:95
 __mutex_lock_common kernel/locking/mutex.c:605 [inline]
 __mutex_lock+0x143/0xd80 kernel/locking/mutex.c:747
 __unix_dgram_recvmsg+0x24e/0x12c0 net/unix/af_unix.c:2424
 ____sys_recvmsg+0x285/0x530 net/socket.c:-1
 ___sys_recvmsg net/socket.c:2780 [inline]
 do_recvmmsg+0x46d/0xad0 net/socket.c:2874
 __sys_recvmmsg net/socket.c:2953 [inline]
 __do_sys_recvmmsg net/socket.c:2976 [inline]
 __se_sys_recvmmsg net/socket.c:2969 [inline]
 __x64_sys_recvmmsg+0x195/0x240 net/socket.c:2969
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f3d5378e169
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f3d54592038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007f3d539b6080 RCX: 00007f3d5378e169
RDX: 0000000000010106 RSI: 00002000000000c0 RDI: 0000000000000003
RBP: 00007f3d53810a68 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f3d539b6080 R15: 00007ffdd2a32d68
 </TASK>

Allocated by task 4764:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x65/0x70 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x10c/0x2d0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 net_alloc net/core/net_namespace.c:423 [inline]
 copy_net_ns+0x13c/0x590 net/core/net_namespace.c:495
 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:3201
 __do_sys_unshare kernel/fork.c:3272 [inline]
 __se_sys_unshare kernel/fork.c:3270 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3270
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4422:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 kmem_cache_free+0x292/0x510 mm/slub.c:3683
 net_complete_free net/core/net_namespace.c:459 [inline]
 cleanup_net+0x99a/0xd20 net/core/net_namespace.c:653
 process_one_work+0x917/0x1260 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
 insert_work+0x54/0x3d0 kernel/workqueue.c:1361
 __queue_work+0xb4b/0xf90 kernel/workqueue.c:1520
 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1504
 expire_timers kernel/time/timer.c:1544 [inline]
 __run_timers+0x6a8/0x890 kernel/time/timer.c:1820
 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:578
 __do_softirq kernel/softirq.c:612 [inline]
 invoke_softirq kernel/softirq.c:452 [inline]
 __irq_exit_rcu+0x157/0x240 kernel/softirq.c:661
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:673
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1118 [inline]
 sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1118
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:691

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
 insert_work+0x54/0x3d0 kernel/workqueue.c:1361
 __queue_work+0xb4b/0xf90 kernel/workqueue.c:1520
 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1504
 expire_timers kernel/time/timer.c:1544 [inline]
 __run_timers+0x6a8/0x890 kernel/time/timer.c:1820
 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:578
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:945
 smpboot_thread_fn+0x52c/0xa30 kernel/smpboot.c:164
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff88802fbd1c40
 which belongs to the cache net_namespace of size 6976
The buggy address is located 712 bytes inside of
 6976-byte region [ffff88802fbd1c40, ffff88802fbd3780)

The buggy address belongs to the physical page:
page:ffffea0000bef400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2fbd0
head:ffffea0000bef400 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888056b41981
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0000a64e00 dead000000000002 ffff888017e38500
raw: 0000000000000000 0000000080040004 00000001ffffffff ffff888056b41981
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 4253, tgid 4253 (syz-executor), ts 68878512574, free_ts 68875136158
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5606
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 slab_alloc mm/slub.c:3406 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3413 [inline]
 kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422
 kmem_cache_zalloc include/linux/slab.h:689 [inline]
 net_alloc net/core/net_namespace.c:423 [inline]
 copy_net_ns+0x13c/0x590 net/core/net_namespace.c:495
 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:3201
 __do_sys_unshare kernel/fork.c:3272 [inline]
 __se_sys_unshare kernel/fork.c:3270 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3270
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3479
 free_slab mm/slub.c:2031 [inline]
 discard_slab mm/slub.c:2037 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2586
 put_cpu_partial+0x17b/0x250 mm/slub.c:2662
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x156/0x170 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x52/0x3a0 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 __kmem_cache_alloc_node+0x137/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc+0xa1/0x230 mm/slab_common.c:949
 kmalloc include/linux/slab.h:568 [inline]
 tomoyo_add_entry security/tomoyo/common.c:2022 [inline]
 tomoyo_supervisor+0xeda/0x12d0 security/tomoyo/common.c:2094
 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline]
 tomoyo_path_number_perm+0x58d/0x7f0 security/tomoyo/file.c:734
 security_file_ioctl+0x6d/0xa0 security/security.c:1568
 __do_sys_ioctl fs/ioctl.c:864 [inline]
 __se_sys_ioctl+0x47/0x160 fs/ioctl.c:856
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0x80 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff88802fbd1e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802fbd1e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802fbd1f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff88802fbd1f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802fbd2000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
vkms_vblank_simulate: vblank timer overrun
----------------
Code disassembly (best guess), 2 bytes skipped:
   0:	21 02                	and    %eax,(%rdx)
   2:	0f 84 02 ff ff ff    	je     0xffffff0a
   8:	e9 6c ff ff ff       	jmp    0xffffff79
   d:	48 c7 c7 e0 50 33 8d 	mov    $0xffffffff8d3350e0,%rdi
  14:	4c 89 f6             	mov    %r14,%rsi
  17:	e8 fa 2d fb 02       	call   0x2fb2e16
  1c:	e9 2b ff ff ff       	jmp    0xffffff4c
  21:	e8 80 8b 3d 09       	call   0x93d8ba6
  26:	41 57                	push   %r15
* 28:	41 56                	push   %r14 <-- trapping instruction
  2a:	53                   	push   %rbx
  2b:	65 ff 05 8c 27 8f 7e 	incl   %gs:0x7e8f278c(%rip)        # 0x7e8f27be
  32:	e8 bf a3 3d 09       	call   0x93da3f6
  37:	89 c3                	mov    %eax,%ebx
  39:	83 f8 08             	cmp    $0x8,%eax
  3c:	73 76                	jae    0xb4

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/18 02:58 linux-6.1.y 420102835862 2a20f901 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
2025/03/28 06:40 linux-6.1.y 344a09659766 6c09fb82 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
* Struck through repros no longer work on HEAD.