syzbot


KASAN: invalid-free in tcp_disconnect

Status: internal: reported C repro on 2022/10/04 13:58
Reported-by: syzbot+@syzkaller.appspotmail.com
Fix commit: 72e560cb8c6f tcp: cdg: allow tcp_cdg_release() to be called multiple times
Patched on: [ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-arm64 ci-upstream-gce-leak ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-kmsan-gce ci-upstream-kmsan-gce-386 ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu2-riscv64]
First crash: 117d, last: 102d

Cause bisection: introduced by (bisect log) [no-op commit]:
commit e2d850d5346c3cd751b032a7dccdd472013b8a84
Author: Magnus Karlsson <magnus.karlsson@intel.com>
Date: Tue Sep 7 07:19:21 2021 +0000

  selftests: xsx: Make pthreads local scope

Crash: KASAN: use-after-free Read in __d_alloc (log)
Repro: C syz .config

Sample crash report:
==================================================================
BUG: KASAN: double-free in slab_free mm/slub.c:3539 [inline]
BUG: KASAN: double-free in kfree+0xe2/0x580 mm/slub.c:4567

CPU: 1 PID: 27 Comm: kworker/1:1 Not tainted 6.0.0-syzkaller-03015-g2bca25eaeba6 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Workqueue: events mptcp_worker
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:317 [inline]
 print_report.cold+0x2ba/0x719 mm/kasan/report.c:433
 kasan_report_invalid_free+0x81/0x190 mm/kasan/report.c:462
 ____kasan_slab_free+0x18b/0x1c0 mm/kasan/common.c:356
 kasan_slab_free include/linux/kasan.h:200 [inline]
 slab_free_hook mm/slub.c:1759 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1785
 slab_free mm/slub.c:3539 [inline]
 kfree+0xe2/0x580 mm/slub.c:4567
 tcp_disconnect+0x980/0x1e20 net/ipv4/tcp.c:3145
 __mptcp_close_ssk+0x5ca/0x7e0 net/mptcp/protocol.c:2327
 mptcp_do_fastclose net/mptcp/protocol.c:2592 [inline]
 mptcp_worker+0x78c/0xff0 net/mptcp/protocol.c:2627
 process_one_work+0x991/0x1610 kernel/workqueue.c:2289
 worker_thread+0x665/0x1080 kernel/workqueue.c:2436
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
 </TASK>

Allocated by task 3616:
 kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:437 [inline]
 ____kasan_kmalloc mm/kasan/common.c:516 [inline]
 ____kasan_kmalloc mm/kasan/common.c:475 [inline]
 __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525
 kmalloc include/linux/slab.h:605 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 lsm_task_alloc security/security.c:615 [inline]
 security_task_alloc+0x10b/0x250 security/security.c:1655
 copy_process+0x23d5/0x7090 kernel/fork.c:2236
 kernel_clone+0xe7/0xab0 kernel/fork.c:2671
 __do_sys_clone+0xba/0x100 kernel/fork.c:2805
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

The buggy address belongs to the object at ffff888022279300
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff888022279300, ffff888022279340)

The buggy address belongs to the physical page:
page:ffffea0000889e40 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888022279400 pfn:0x22279
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00009d0748 ffffea0000999288 ffff888011841640
raw: ffff888022279400 000000000020000a 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 56, tgid 56 (kworker/u4:4), ts 9348208493, free_ts 9219488695
 prep_new_page mm/page_alloc.c:2532 [inline]
 get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5549
 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270
 alloc_slab_page mm/slub.c:1829 [inline]
 allocate_slab+0x27e/0x3d0 mm/slub.c:1974
 new_slab mm/slub.c:2034 [inline]
 ___slab_alloc+0x84f/0xe80 mm/slub.c:3036
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3123
 slab_alloc_node mm/slub.c:3214 [inline]
 kmem_cache_alloc_node_trace+0x185/0x410 mm/slub.c:3312
 kmalloc_node include/linux/slab.h:618 [inline]
 kzalloc_node include/linux/slab.h:744 [inline]
 __get_vm_area_node+0xed/0x3f0 mm/vmalloc.c:2477
 __vmalloc_node_range+0x250/0x13a0 mm/vmalloc.c:3156
 alloc_thread_stack_node kernel/fork.c:312 [inline]
 dup_task_struct kernel/fork.c:977 [inline]
 copy_process+0x156c/0x7090 kernel/fork.c:2085
 kernel_clone+0xe7/0xab0 kernel/fork.c:2671
 user_mode_thread+0xad/0xe0 kernel/fork.c:2740
 call_usermodehelper_exec_work kernel/umh.c:174 [inline]
 call_usermodehelper_exec_work+0xcc/0x180 kernel/umh.c:160
 process_one_work+0x991/0x1610 kernel/workqueue.c:2289
 worker_thread+0x665/0x1080 kernel/workqueue.c:2436
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1449 [inline]
 free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499
 free_unref_page_prepare mm/page_alloc.c:3380 [inline]
 free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476
 __vunmap+0x85d/0xd30 mm/vmalloc.c:2696
 free_work+0x58/0x70 mm/vmalloc.c:97
 process_one_work+0x991/0x1610 kernel/workqueue.c:2289
 worker_thread+0x665/0x1080 kernel/workqueue.c:2436
 kthread+0x2e4/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Memory state around the buggy address:
 ffff888022279200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888022279280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff888022279300: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff888022279380: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff888022279400: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (74):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce 2022/10/05 17:54 upstream 2bca25eaeba6 267e3bb1 .config strace log report syz C [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/05 15:35 net 0326074ff465 267e3bb1 .config console log report syz C [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/05 13:13 net-next 0326074ff465 267e3bb1 .config console log report syz C [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/19 00:03 upstream 55be6084c8e0 b31320fc .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/18 06:44 upstream 55be6084c8e0 754863b4 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/16 04:08 upstream 55be6084c8e0 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/15 08:18 upstream 55be6084c8e0 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-root 2022/10/15 03:35 upstream 55be6084c8e0 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/13 16:45 upstream 55be6084c8e0 adf90437 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/13 08:35 upstream 55be6084c8e0 3f6b40a1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-root 2022/10/12 05:05 upstream 55be6084c8e0 16a9c9e0 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/09 20:23 upstream a6afa4199d3d aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-selinux-root 2022/10/09 10:21 upstream a6afa4199d3d aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-selinux-root 2022/10/08 23:50 upstream a6afa4199d3d aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-selinux-root 2022/10/08 11:07 upstream e8bc52cb8df8 aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/07 23:06 upstream 4c86114194e6 0de35f24 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-selinux-root 2022/10/07 20:29 upstream 4c86114194e6 0de35f24 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-smack-root 2022/10/07 14:16 upstream ffb39098bf87 8a212197 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-selinux-root 2022/10/07 03:34 upstream ffb39098bf87 8a212197 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-smack-root 2022/10/06 03:42 upstream 833477fce7a1 2c6543ad .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-selinux-root 2022/10/05 17:03 upstream 2bca25eaeba6 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-root 2022/10/05 16:07 upstream 2bca25eaeba6 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-smack-root 2022/10/05 15:26 upstream 2bca25eaeba6 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/05 14:40 upstream 2bca25eaeba6 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce 2022/10/05 14:18 upstream 2bca25eaeba6 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-root 2022/10/05 13:58 upstream 2bca25eaeba6 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-386 2022/10/14 13:08 upstream 55be6084c8e0 4954e4b2 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-386 2022/10/13 07:26 upstream 55be6084c8e0 3f6b40a1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-386 2022/10/11 12:03 upstream 55be6084c8e0 2b253ced .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-386 2022/10/10 19:12 upstream 4899a36f91a9 aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-386 2022/10/10 17:39 upstream 4899a36f91a9 aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-qemu-upstream-386 2022/10/07 18:48 upstream 4c86114194e6 79a59635 .config console log report info KASAN: invalid-free in tcp_disconnect
ci-upstream-kasan-gce-386 2022/10/07 14:17 upstream ffb39098bf87 8a212197 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/11 07:21 net b15e2e49bfc4 2b253ced .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/11 02:34 net b15e2e49bfc4 2b253ced .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/10 13:54 net af7d23f9d96a aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/10 12:28 net af7d23f9d96a aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/09 17:48 net aabf6155dfb8 aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/08 02:48 net aabf6155dfb8 0de35f24 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/07 18:06 net aabf6155dfb8 0de35f24 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/07 07:34 net 1d22f78d0573 8a212197 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/07 06:13 net 1d22f78d0573 8a212197 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/07 03:28 net 1d22f78d0573 8a212197 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/06 15:30 net 1d22f78d0573 131b38ac .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/05 20:41 net 0326074ff465 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/05 14:25 net 0326074ff465 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-this-kasan-gce 2022/10/05 14:13 net 0326074ff465 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/18 16:14 net-next 0326074ff465 b31320fc .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/18 11:32 net-next 0326074ff465 754863b4 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/17 03:21 net-next 0326074ff465 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/17 00:32 net-next 0326074ff465 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/16 10:56 net-next 0326074ff465 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/15 22:25 net-next 0326074ff465 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/15 13:59 net-next 0326074ff465 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/15 09:58 net-next 0326074ff465 67cb024c .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/14 14:11 net-next 0326074ff465 4954e4b2 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/13 21:08 net-next 0326074ff465 adf90437 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/09 05:37 net-next 0326074ff465 aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/08 17:45 net-next 0326074ff465 aea5da89 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/07 23:54 net-next 0326074ff465 0de35f24 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/05 23:10 net-next 0326074ff465 2c6543ad .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/05 19:33 net-next 0326074ff465 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/05 17:20 net-next 0326074ff465 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/05 14:20 net-next 0326074ff465 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/05 11:15 net-next 0326074ff465 267e3bb1 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/05 01:07 net-next 450a580fc4b5 eab8f949 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/04 16:04 net-next 450a580fc4b5 eab8f949 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
ci-upstream-net-kasan-gce 2022/10/04 13:57 net-next 450a580fc4b5 eab8f949 .config console log report info [disk image] [vmlinux] KASAN: invalid-free in tcp_disconnect
* Struck through repros no longer work on HEAD.