syzbot


KASAN: use-after-free Read in tcp_retransmit_timer

Status: auto-obsoleted due to no activity on 2024/06/08 21:34
Reported-by: syzbot+c388232d8ae8a3cf79a8@syzkaller.appspotmail.com
First crash: 95d, last: 76d
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 594d 594d 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 1133d 1208d 0/1 auto-closed as invalid on 2021/09/06 04:07
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer (2) 13 50d 235d 0/3 upstream: reported on 2023/10/23 18:56
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer 2 1632d 1633d 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 1917d 1917d 0/27 closed as invalid on 2019/04/19 21:45
upstream KASAN: use-after-free Read in tcp_retransmit_timer (5) net C unreliable 16000 561d 1573d 22/27 fixed on 2023/02/24 13:50
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (2) 6 1062d 1229d 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 1829d 1848d 0/27 closed as invalid on 2019/07/01 18:06
upstream KASAN: use-after-free Read in tcp_retransmit_timer net 4 1960d 2073d 0/27 closed as invalid on 2019/03/10 18:51
linux-4.19 KASAN: slab-out-of-bounds Read in tcp_retransmit_timer 9 740d 919d 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 1773d 1773d 0/27 closed as invalid on 2019/10/03 04:18
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer 76 345d 453d 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+0x7a7/0x2ab0 net/ipv4/tcp_timer.c:535
Read of size 8 at addr ffff88805ca882c0 by task syz-executor.1/8516

CPU: 1 PID: 8516 Comm: syz-executor.1 Not tainted 6.1.83-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
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:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 tcp_retransmit_timer+0x7a7/0x2ab0 net/ipv4/tcp_timer.c:535
 tcp_write_timer+0x12e/0x280 net/ipv4/tcp_timer.c:665
 call_timer_fn+0x1ad/0x6b0 kernel/time/timer.c:1474
 expire_timers kernel/time/timer.c:1519 [inline]
 __run_timers+0x67c/0x890 kernel/time/timer.c:1790
 run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803
 __do_softirq+0x2e9/0xa4c kernel/softirq.c:571
 invoke_softirq kernel/softirq.c:445 [inline]
 __irq_exit_rcu+0x155/0x240 kernel/softirq.c:650
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1106
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:653
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:202
Code: 01 bd f5 ff 90 53 48 89 fb 48 83 c7 18 48 8b 74 24 08 e8 4e 4c d6 f6 48 89 df e8 b6 89 d7 f6 e8 51 1a fd f6 fb bf 01 00 00 00 <e8> a6 18 ca f6 65 8b 05 47 44 6e 75 85 c0 74 02 5b c3 e8 84 62 6c
RSP: 0018:ffffc900037aef98 EFLAGS: 00000282
RAX: d2f0403f45bf3e00 RBX: ffff88801f5848c0 RCX: ffffffff816abeda
RDX: dffffc0000000000 RSI: ffffffff8aebee40 RDI: 0000000000000001
RBP: ffff88814b82f360 R08: dffffc0000000000 R09: fffffbfff2092e70
R10: 0000000000000000 R11: dffffc0000000001 R12: dffffc0000000000
R13: ffff88801f682960 R14: ffff88814b82f360 R15: ffff88814b82f368
 spin_unlock_irq include/linux/spinlock.h:401 [inline]
 loop_queue_work drivers/block/loop.c:896 [inline]
 loop_queue_rq+0xa02/0xaf0 drivers/block/loop.c:1876
 __blk_mq_issue_directly block/blk-mq.c:2613 [inline]
 __blk_mq_try_issue_directly+0x4fe/0x820 block/blk-mq.c:2666
 blk_mq_try_issue_directly+0x28/0x1f0 block/blk-mq.c:2690
 blk_mq_submit_bio+0x162c/0x2590 block/blk-mq.c:3036
 __submit_bio+0x261/0x2f0 block/blk-core.c:590
 __submit_bio_noacct_mq block/blk-core.c:667 [inline]
 submit_bio_noacct_nocheck+0x976/0xd10 block/blk-core.c:696
 submit_bio_wait+0x102/0x200 block/bio.c:1322
 xfs_rw_bdev+0x2d0/0x2f0 fs/xfs/xfs_bio_io.c:53
 xlog_do_io+0x167/0x330 fs/xfs/xfs_log_recover.c:140
 xlog_write_log_records+0x2d4/0x3c0 fs/xfs/xfs_log_recover.c:1578
 xlog_clear_stale_blocks+0x216/0x430 fs/xfs/xfs_log_recover.c:1695
 xlog_find_tail+0xb2b/0xf80 fs/xfs/xfs_log_recover.c:1365
 xlog_recover+0xd9/0x560 fs/xfs/xfs_log_recover.c:3361
 xfs_log_mount+0x415/0x770 fs/xfs/xfs_log.c:739
 xfs_mountfs+0xcbb/0x1f00 fs/xfs/xfs_mount.c:805
 xfs_fs_fill_super+0x1145/0x13a0 fs/xfs/xfs_super.c:1681
 get_tree_bdev+0x3fe/0x620 fs/super.c:1355
 vfs_get_tree+0x88/0x270 fs/super.c:1562
 do_new_mount+0x2ba/0xb40 fs/namespace.c:3051
 do_mount fs/namespace.c:3394 [inline]
 __do_sys_mount fs/namespace.c:3602 [inline]
 __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3579
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f923d07f4aa
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f923de1fef8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f923de1ff80 RCX: 00007f923d07f4aa
RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 00007f923de1ff40
RBP: 00000000200000c0 R08: 00007f923de1ff80 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000040
R13: 00007f923de1ff40 R14: 000000000000989d R15: 0000000020000080
 </TASK>

Allocated by task 3560:
 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:682 [inline]
 net_alloc net/core/net_namespace.c:410 [inline]
 copy_net_ns+0x143/0x5d0 net/core/net_namespace.c:465
 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x580/0xb20 kernel/fork.c:3203
 __do_sys_unshare kernel/fork.c:3274 [inline]
 __se_sys_unshare kernel/fork.c:3272 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3272
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

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:1474
 expire_timers kernel/time/timer.c:1514 [inline]
 __run_timers+0x6a8/0x890 kernel/time/timer.c:1790
 __do_softirq+0x2e9/0xa4c kernel/softirq.c:571

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

The buggy address belongs to the physical page:
page:ffffea000172a200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5ca88
head:ffffea000172a200 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff888059b87a01
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888140009500
raw: 0000000000000000 0000000080040004 00000001ffffffff ffff888059b87a01
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 3560, tgid 3560 (syz-executor.0), ts 54983948127, free_ts 12496522900
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
 prep_new_page mm/page_alloc.c:2520 [inline]
 get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5545
 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:682 [inline]
 net_alloc net/core/net_namespace.c:410 [inline]
 copy_net_ns+0x143/0x5d0 net/core/net_namespace.c:465
 create_new_namespaces+0x425/0x7a0 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x11e/0x170 kernel/nsproxy.c:226
 ksys_unshare+0x580/0xb20 kernel/fork.c:3203
 __do_sys_unshare kernel/fork.c:3274 [inline]
 __se_sys_unshare kernel/fork.c:3272 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3272
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1440 [inline]
 free_pcp_prepare mm/page_alloc.c:1490 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3453
 free_contig_range+0x9a/0x150 mm/page_alloc.c:9505
 destroy_args+0xfe/0x997 mm/debug_vm_pgtable.c:1031
 debug_vm_pgtable+0x416/0x46b mm/debug_vm_pgtable.c:1354
 do_one_initcall+0x265/0x8f0 init/main.c:1297
 do_initcall_level+0x157/0x207 init/main.c:1370
 do_initcalls+0x49/0x86 init/main.c:1386
 kernel_init_freeable+0x45c/0x60f init/main.c:1625
 kernel_init+0x19/0x290 init/main.c:1513
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:307

Memory state around the buggy address:
 ffff88805ca88180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805ca88200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805ca88280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff88805ca88300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805ca88380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	01 bd f5 ff 90 53    	add    %edi,0x5390fff5(%rbp)
   6:	48 89 fb             	mov    %rdi,%rbx
   9:	48 83 c7 18          	add    $0x18,%rdi
   d:	48 8b 74 24 08       	mov    0x8(%rsp),%rsi
  12:	e8 4e 4c d6 f6       	call   0xf6d64c65
  17:	48 89 df             	mov    %rbx,%rdi
  1a:	e8 b6 89 d7 f6       	call   0xf6d789d5
  1f:	e8 51 1a fd f6       	call   0xf6fd1a75
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 a6 18 ca f6       	call   0xf6ca18d5 <-- trapping instruction
  2f:	65 8b 05 47 44 6e 75 	mov    %gs:0x756e4447(%rip),%eax        # 0x756e447d
  36:	85 c0                	test   %eax,%eax
  38:	74 02                	je     0x3c
  3a:	5b                   	pop    %rbx
  3b:	c3                   	ret
  3c:	e8                   	.byte 0xe8
  3d:	84 62 6c             	test   %ah,0x6c(%rdx)

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/03/30 04:00 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/27 04:34 linux-6.1.y e5cd595e23c1 454571b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/26 07:03 linux-6.1.y d7543167affd bcd9b39f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/24 03:18 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/21 14:14 linux-6.1.y d7543167affd 6753db5c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/15 21:41 linux-6.1.y d7543167affd d615901c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/30 21:33 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/30 04:41 linux-6.1.y e5cd595e23c1 6baf5069 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/27 02:34 linux-6.1.y e5cd595e23c1 454571b6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/24 03:44 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/22 14:02 linux-6.1.y d7543167affd 4b6cdce6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/20 22:39 linux-6.1.y d7543167affd 5b7d42ae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/17 00:36 linux-6.1.y d7543167affd d615901c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
2024/03/12 12:55 linux-6.1.y 61adba85cc40 c35c26ec .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in tcp_retransmit_timer
* Struck through repros no longer work on HEAD.