syzbot


KASAN: use-after-free Read in tcp_write_timer_handler

Status: auto-closed as invalid on 2021/02/18 23:19
Reported-by: syzbot+b080be35ba8b89880be4@syzkaller.appspotmail.com
First crash: 1491d, last: 1491d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in tcp_write_timer_handler 1 1798d 1798d 0/1 auto-closed as invalid on 2020/04/17 21:22
upstream KASAN: use-after-free Read in tcp_write_timer_handler net 6 2077d 2140d 0/28 closed as invalid on 2019/04/19 22:15
upstream KASAN: use-after-free Read in tcp_write_timer_handler (2) net 5 2038d 2040d 0/28 closed as invalid on 2019/05/15 23:07
upstream KASAN: use-after-free Read in tcp_write_timer_handler (3) net 82 1890d 1952d 0/28 auto-closed as invalid on 2019/12/04 07:54
linux-5.15 KASAN: use-after-free Read in tcp_write_timer_handler origin:upstream C error 234 100d 623d 0/3 auto-obsoleted due to no activity on 2024/10/22 01:47
linux-6.1 KASAN: use-after-free Read in tcp_write_timer_handler 140 198d 624d 0/3 auto-obsoleted due to no activity on 2024/07/16 13:06
linux-4.19 KASAN: use-after-free Read in tcp_write_timer_handler (2) 12 786d 1300d 0/1 auto-obsoleted due to no activity on 2023/01/25 19:39
upstream KASAN: use-after-free Read in tcp_write_timer_handler (4) net 529 709d 1735d 0/28 closed as invalid on 2023/03/21 22:54

Sample crash report:
netlink: 24 bytes leftover after parsing attributes in process `syz-executor.2'.
IPv6: ADDRCONF(NETDEV_UP): veth3: link is not ready
==================================================================
BUG: KASAN: use-after-free in tcp_orphan_retries net/ipv4/tcp_timer.c:139 [inline]
BUG: KASAN: use-after-free in tcp_probe_timer net/ipv4/tcp_timer.c:374 [inline]
BUG: KASAN: use-after-free in tcp_write_timer_handler+0xa4b/0xa60 net/ipv4/tcp_timer.c:602
Read of size 4 at addr ffff888093df0868 by task syz-executor.2/3422

CPU: 1 PID: 3422 Comm: syz-executor.2 Not tainted 4.19.152-syzkaller #0
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+0x1fc/0x2fe lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load4_noabort+0x88/0x90 mm/kasan/report.c:432
 tcp_orphan_retries net/ipv4/tcp_timer.c:139 [inline]
 tcp_probe_timer net/ipv4/tcp_timer.c:374 [inline]
 tcp_write_timer_handler+0xa4b/0xa60 net/ipv4/tcp_timer.c:602
 tcp_write_timer+0x103/0x1b0 net/ipv4/tcp_timer.c:618
 call_timer_fn+0x177/0x700 kernel/time/timer.c:1338
 expire_timers+0x243/0x4e0 kernel/time/timer.c:1375
 __run_timers kernel/time/timer.c:1703 [inline]
 run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1716
 __do_softirq+0x26c/0x9a0 kernel/softirq.c:292
 invoke_softirq kernel/softirq.c:372 [inline]
 irq_exit+0x215/0x260 kernel/softirq.c:412
 exiting_irq arch/x86/include/asm/apic.h:544 [inline]
 smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1094
 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
 </IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline]
RIP: 0010:console_unlock+0xe7b/0x1110 kernel/printk/printk.c:2468
Code: ff df 48 c1 e8 03 80 3c 08 00 0f 85 66 02 00 00 48 83 3d cf ee a1 08 00 0f 84 9e 00 00 00 e8 2c 3c 15 00 48 8b 7c 24 30 57 9d <0f> 1f 44 00 00 e9 9b fc ff ff e8 16 3c 15 00 0f 0b e8 0f 3c 15 00
RSP: 0018:ffff88806cec6c80 EFLAGS: 00000216 ORIG_RAX: ffffffffffffff13
RAX: 0000000000040000 RBX: 0000000000000200 RCX: ffffc90005c21000
RDX: 0000000000040000 RSI: ffffffff814f9084 RDI: 0000000000000216
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff8453fe50
R13: 0000000000000043 R14: 0000000000000000 R15: ffffffff8a6daa70
 vprintk_emit+0x2d1/0x740 kernel/printk/printk.c:1965
 vprintk_func+0x79/0x17e kernel/printk/printk_safe.c:397
 printk+0xba/0xed kernel/printk/printk.c:2040
 addrconf_notify+0xdce/0x21f0 net/ipv6/addrconf.c:3492
 notifier_call_chain+0xc0/0x230 kernel/notifier.c:93
 call_netdevice_notifiers net/core/dev.c:1762 [inline]
 __dev_notify_flags+0x110/0x2b0 net/core/dev.c:7709
 rtnl_configure_link+0x169/0x230 net/core/rtnetlink.c:2839
 rtnl_newlink+0x104e/0x15b0 net/core/rtnetlink.c:3161
 rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4778
 netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455
 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
 netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344
 netlink_sendmsg+0x6bb/0xc40 net/netlink/af_netlink.c:1909
 sock_sendmsg_nosec net/socket.c:622 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:632
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2115
 __sys_sendmsg net/socket.c:2153 [inline]
 __do_sys_sendmsg net/socket.c:2162 [inline]
 __se_sys_sendmsg net/socket.c:2160 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2160
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45de59
Code: 0d b4 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 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f7000a86c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000000000002e5c0 RCX: 000000000045de59
RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000004
RBP: 000000000118bf60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118bf2c
R13: 00007ffc34c25c2f R14: 00007f7000a879c0 R15: 000000000118bf2c

Allocated by task 8140:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 kmem_cache_zalloc include/linux/slab.h:699 [inline]
 net_alloc net/core/net_namespace.c:385 [inline]
 copy_net_ns+0x106/0x335 net/core/net_namespace.c:425
 create_new_namespaces+0x3f6/0x7b0 kernel/nsproxy.c:107
 unshare_nsproxy_namespaces+0xbd/0x1f0 kernel/nsproxy.c:206
 ksys_unshare+0x36c/0x9a0 kernel/fork.c:2530
 __do_sys_unshare kernel/fork.c:2598 [inline]
 __se_sys_unshare kernel/fork.c:2596 [inline]
 __x64_sys_unshare+0x2d/0x40 kernel/fork.c:2596
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 23:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 net_free net/core/net_namespace.c:401 [inline]
 net_drop_ns+0x73/0x90 net/core/net_namespace.c:408
 cleanup_net+0x64c/0x8b0 net/core/net_namespace.c:571
 process_one_work+0x864/0x1570 kernel/workqueue.c:2155
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2298
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

The buggy address belongs to the object at ffff888093df0100
 which belongs to the cache net_namespace of size 8640
The buggy address is located 1896 bytes inside of
 8640-byte region [ffff888093df0100, ffff888093df22c0)
The buggy address belongs to the page:
page:ffffea00024f7c00 count:1 mapcount:0 mapping:ffff8880b5bbed80 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea000253e608 ffffea0002423708 ffff8880b5bbed80
raw: 0000000000000000 ffff888093df0100 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888093df0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888093df0780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888093df0800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                          ^
 ffff888093df0880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888093df0900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/10/21 23:18 linux-4.19.y ad326970d25c be6b1582 .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.