syzbot


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

Status: auto-obsoleted due to no activity on 2024/10/06 20:00
Reported-by: syzbot+d8ce8a141527caa8f9e9@syzkaller.appspotmail.com
First crash: 167d, last: 167d
Similar bugs (14)
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 9d21h 9d21h 0/3 upstream: reported on 2024/12/03 12:52
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (3) 1 774d 774d 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 1314d 1389d 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 257d 275d 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 231d 416d 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 1813d 1814d 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 2097d 2097d 0/28 closed as invalid on 2019/04/19 21:45
upstream KASAN: use-after-free Read in tcp_retransmit_timer (5) net C unreliable 16000 741d 1754d 22/28 fixed on 2023/02/24 13:50
linux-4.19 KASAN: use-after-free Read in tcp_retransmit_timer (2) 6 1243d 1410d 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 2009d 2029d 0/28 closed as invalid on 2019/07/01 18:06
upstream KASAN: use-after-free Read in tcp_retransmit_timer net 4 2140d 2254d 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 920d 1099d 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 1954d 1954d 0/28 closed as invalid on 2019/10/03 04:18
linux-5.15 KASAN: use-after-free Read in tcp_retransmit_timer 76 526d 633d 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/0x28e0 net/ipv4/tcp_timer.c:535
Read of size 8 at addr ffff888073723b40 by task syz-executor/7513

CPU: 1 PID: 7513 Comm: syz-executor Not tainted 6.1.96-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/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/0x28e0 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: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:571
 __do_softirq kernel/softirq.c:605 [inline]
 invoke_softirq kernel/softirq.c:445 [inline]
 __irq_exit_rcu+0x157/0x240 kernel/softirq.c:654
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:666
 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:find_entry fs/proc/proc_sysctl.c:135 [inline]
RIP: 0010:find_subdir fs/proc/proc_sysctl.c:955 [inline]
RIP: 0010:get_subdir fs/proc/proc_sysctl.c:1008 [inline]
RIP: 0010:__register_sysctl_table+0x8cb/0x11e0 fs/proc/proc_sysctl.c:1377
Code: 80 3c 28 00 74 08 48 89 df e8 31 89 ca ff 4c 8b 3b 4c 89 f8 48 c1 e8 03 42 80 3c 28 00 74 08 4c 89 ff e8 18 89 ca ff 49 8b 2f <49> 8d 5f 40 48 89 d8 48 c1 e8 03 42 80 3c 28 00 74 08 48 89 df e8
RSP: 0018:ffffc90004706a60 EFLAGS: 00000246
RAX: 1ffff1100faf9780 RBX: ffff88807d7cbc70 RCX: ffff888023a95940
RDX: 0000000000000000 RSI: 0000000000000005 RDI: 0000000000000000
RBP: ffff88807d7cbc78 R08: ffffffff82178c60 R09: 0000000000000003
R10: ffffffffffffffff R11: dffffc0000000001 R12: ffff88807d7cbc58
R13: dffffc0000000000 R14: ffff88805cb6e040 R15: ffff88807d7cbc00
 neigh_sysctl_register+0x3ec/0x4d0 net/core/neighbour.c:3847
 devinet_sysctl_register+0x9d/0x1a0 net/ipv4/devinet.c:2636
 inetdev_init+0x291/0x4c0 net/ipv4/devinet.c:279
 inetdev_event+0x29b/0x1490 net/ipv4/devinet.c:1534
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
 call_netdevice_notifiers_info net/core/dev.c:1970 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
 call_netdevice_notifiers+0x145/0x1b0 net/core/dev.c:2022
 register_netdevice+0x12f2/0x1720 net/core/dev.c:10132
 veth_newlink+0x5db/0xc70 drivers/net/veth.c:1744
 rtnl_newlink_create net/core/rtnetlink.c:3390 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3610 [inline]
 rtnl_newlink+0x14e3/0x2050 net/core/rtnetlink.c:3623
 rtnetlink_rcv_msg+0x818/0xff0 net/core/rtnetlink.c:6121
 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2508
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7d8/0x970 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1874
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 __sys_sendto+0x480/0x600 net/socket.c:2148
 __do_sys_sendto net/socket.c:2160 [inline]
 __se_sys_sendto net/socket.c:2156 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2156
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f5bba97792c
Code: 2a 5a 02 00 44 8b 4c 24 2c 4c 8b 44 24 20 89 c5 44 8b 54 24 28 48 8b 54 24 18 b8 2c 00 00 00 48 8b 74 24 10 8b 7c 24 08 0f 05 <48> 3d 00 f0 ff ff 77 34 89 ef 48 89 44 24 08 e8 70 5a 02 00 48 8b
RSP: 002b:00007ffe64e2ce60 EFLAGS: 00000293 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f5bbb634620 RCX: 00007f5bba97792c
RDX: 0000000000000068 RSI: 00007f5bbb634670 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00007ffe64e2ceb4 R09: 000000000000000c
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000003
R13: 0000000000000000 R14: 00007f5bbb634670 R15: 0000000000000000
 </TASK>

Allocated by task 3784:
 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:413 [inline]
 copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:468
 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+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 4011:
 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_free net/core/net_namespace.c:442 [inline]
 cleanup_net+0xab5/0xb60 net/core/net_namespace.c:625
 process_one_work+0x8a9/0x11d0 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:308

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:571
 __do_softirq kernel/softirq.c:605 [inline]
 invoke_softirq kernel/softirq.c:445 [inline]
 __irq_exit_rcu+0x157/0x240 kernel/softirq.c:654
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:666
 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1106
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:653

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

The buggy address belongs to the physical page:
page:ffffea0001cdc800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x73720
head:ffffea0001cdc800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888140009500
raw: 0000000000000000 0000000080040004 00000001ffffffff 0000000000000000
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 3548, tgid 3548 (syz-executor), ts 50849857401, free_ts 29070080341
 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:5547
 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:413 [inline]
 copy_net_ns+0x140/0x5d0 net/core/net_namespace.c:468
 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+0x3b/0xb0 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: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_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:954 [inline]
 __kmalloc_node+0xa2/0x230 mm/slab_common.c:962
 kmalloc_node include/linux/slab.h:582 [inline]
 kvmalloc_node+0x6e/0x180 mm/util.c:581
 kvmalloc include/linux/slab.h:709 [inline]
 seq_buf_alloc fs/seq_file.c:38 [inline]
 seq_read_iter+0x1fe/0xd10 fs/seq_file.c:210
 proc_reg_read_iter+0x1b7/0x280 fs/proc/inode.c:305
 call_read_iter include/linux/fs.h:2259 [inline]
 new_sync_read fs/read_write.c:389 [inline]
 vfs_read+0x7de/0xbe0 fs/read_write.c:470
 ksys_read+0x19c/0x2c0 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81

Memory state around the buggy address:
 ffff888073723a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888073723a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888073723b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff888073723b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888073723c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
   0:	80 3c 28 00          	cmpb   $0x0,(%rax,%rbp,1)
   4:	74 08                	je     0xe
   6:	48 89 df             	mov    %rbx,%rdi
   9:	e8 31 89 ca ff       	call   0xffca893f
   e:	4c 8b 3b             	mov    (%rbx),%r15
  11:	4c 89 f8             	mov    %r15,%rax
  14:	48 c1 e8 03          	shr    $0x3,%rax
  18:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1)
  1d:	74 08                	je     0x27
  1f:	4c 89 ff             	mov    %r15,%rdi
  22:	e8 18 89 ca ff       	call   0xffca893f
  27:	49 8b 2f             	mov    (%r15),%rbp
* 2a:	49 8d 5f 40          	lea    0x40(%r15),%rbx <-- trapping instruction
  2e:	48 89 d8             	mov    %rbx,%rax
  31:	48 c1 e8 03          	shr    $0x3,%rax
  35:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1)
  3a:	74 08                	je     0x44
  3c:	48 89 df             	mov    %rbx,%rdi
  3f:	e8                   	.byte 0xe8

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/28 20:00 linux-6.1.y 99e6a620de00 757f06b1 .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.