syzbot


KASAN: wild-memory-access Read in io_wq_worker_running

Status: upstream: reported C repro on 2023/01/07 05:20
Reported-by: syzbot+d56ec896af3637bdb7e4@syzkaller.appspotmail.com
Fix commit: e6db6f9398da io_uring/io-wq: only free worker if it was allocated for creation
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: 72d, last: 22d
Last patch testing requests:
Created Duration User Patch Repo Result
2023/01/09 03:21 22m axboe@kernel.dk git://git.kernel.dk/linux.git syztest report log
2023/01/08 17:41 23m axboe@kernel.dk git://git.kernel.dk/linux.git io_uring-6.2 report log
2023/01/07 13:22 15m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in io_wq_worker_running+0x114/0x130 io_uring/io-wq.c:674
Read of size 4 at addr ffff888022186804 by task iou-wrk-6473/6485

CPU: 0 PID: 6485 Comm: iou-wrk-6473 Not tainted 6.2.0-rc3-syzkaller-00060-gc757fc92a3f7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:306 [inline]
 print_report+0x15e/0x45d mm/kasan/report.c:417
 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517
 io_wq_worker_running+0x114/0x130 io_uring/io-wq.c:674
 schedule_preempt_disabled+0x13/0x20 kernel/sched/core.c:6690
 __mutex_lock_common kernel/locking/mutex.c:679 [inline]
 __mutex_lock+0xa48/0x1360 kernel/locking/mutex.c:747
 io_ring_submit_lock io_uring/io_uring.h:215 [inline]
 io_file_get_fixed io_uring/io_uring.c:1966 [inline]
 io_assign_file io_uring/io_uring.c:1834 [inline]
 io_assign_file io_uring/io_uring.c:1828 [inline]
 io_wq_submit_work+0x5f7/0xdc0 io_uring/io_uring.c:1916
 io_worker_handle_work+0xc41/0x1c60 io_uring/io-wq.c:587
 io_wqe_worker+0xa5b/0xe40 io_uring/io-wq.c:632
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Allocated by task 6473:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:371 [inline]
 ____kasan_kmalloc mm/kasan/common.c:330 [inline]
 __kasan_kmalloc+0xa5/0xb0 mm/kasan/common.c:380
 kmalloc_node include/linux/slab.h:606 [inline]
 kzalloc_node include/linux/slab.h:731 [inline]
 create_io_worker+0x10c/0x630 io_uring/io-wq.c:801
 io_wqe_create_worker io_uring/io-wq.c:310 [inline]
 io_wqe_enqueue+0x6c3/0xbc0 io_uring/io-wq.c:936
 io_queue_iowq+0x282/0x5c0 io_uring/io_uring.c:475
 io_queue_sqe_fallback+0xf3/0x190 io_uring/io_uring.c:2059
 io_submit_sqe io_uring/io_uring.c:2281 [inline]
 io_submit_sqes+0x11db/0x1e60 io_uring/io_uring.c:2397
 __do_sys_io_uring_enter+0xc1d/0x2540 io_uring/io_uring.c:3345
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 6485:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:518
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
 slab_free mm/slub.c:3787 [inline]
 __kmem_cache_free+0xaf/0x3b0 mm/slub.c:3800
 io_wq_cancel_tw_create io_uring/io-wq.c:1233 [inline]
 io_queue_worker_create+0x567/0x660 io_uring/io-wq.c:381
 io_wqe_dec_running+0x1e4/0x240 io_uring/io-wq.c:410
 io_wq_worker_sleeping+0xa6/0xc0 io_uring/io-wq.c:698
 sched_submit_work kernel/sched/core.c:6597 [inline]
 schedule+0x16e/0x1b0 kernel/sched/core.c:6628
 schedule_preempt_disabled+0x13/0x20 kernel/sched/core.c:6690
 __mutex_lock_common kernel/locking/mutex.c:679 [inline]
 __mutex_lock+0xa48/0x1360 kernel/locking/mutex.c:747
 io_ring_submit_lock io_uring/io_uring.h:215 [inline]
 io_file_get_fixed io_uring/io_uring.c:1966 [inline]
 io_assign_file io_uring/io_uring.c:1834 [inline]
 io_assign_file io_uring/io_uring.c:1828 [inline]
 io_wq_submit_work+0x5f7/0xdc0 io_uring/io_uring.c:1916
 io_worker_handle_work+0xc41/0x1c60 io_uring/io-wq.c:587
 io_wqe_worker+0xa5b/0xe40 io_uring/io-wq.c:632
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Last potentially related work creation:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:488
 task_work_add+0x7f/0x2c0 kernel/task_work.c:48
 io_queue_worker_create+0x41d/0x660 io_uring/io-wq.c:373
 io_wqe_dec_running+0x1e4/0x240 io_uring/io-wq.c:410
 io_wq_worker_sleeping+0xa6/0xc0 io_uring/io-wq.c:698
 sched_submit_work kernel/sched/core.c:6597 [inline]
 schedule+0x16e/0x1b0 kernel/sched/core.c:6628
 schedule_preempt_disabled+0x13/0x20 kernel/sched/core.c:6690
 __mutex_lock_common kernel/locking/mutex.c:679 [inline]
 __mutex_lock+0xa48/0x1360 kernel/locking/mutex.c:747
 io_ring_submit_lock io_uring/io_uring.h:215 [inline]
 io_file_get_fixed io_uring/io_uring.c:1966 [inline]
 io_assign_file io_uring/io_uring.c:1834 [inline]
 io_assign_file io_uring/io_uring.c:1828 [inline]
 io_wq_submit_work+0x5f7/0xdc0 io_uring/io_uring.c:1916
 io_worker_handle_work+0xc41/0x1c60 io_uring/io-wq.c:587
 io_wqe_worker+0xa5b/0xe40 io_uring/io-wq.c:632
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

The buggy address belongs to the object at ffff888022186800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 4 bytes inside of
 512-byte region [ffff888022186800, ffff888022186a00)

The buggy address belongs to the physical page:
page:ffffea0000886100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22184
head:ffffea0000886100 order:2 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffff888012441c80 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6430, tgid 6420 (syz-executor127), ts 185130769293, free_ts 36123067660
 prep_new_page mm/page_alloc.c:2531 [inline]
 get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283
 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549
 __alloc_pages_node include/linux/gfp.h:237 [inline]
 alloc_slab_page mm/slub.c:1853 [inline]
 allocate_slab+0xa7/0x350 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3193
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292
 __slab_alloc_node mm/slub.c:3345 [inline]
 slab_alloc_node mm/slub.c:3442 [inline]
 __kmem_cache_alloc_node+0x1a4/0x430 mm/slub.c:3491
 kmalloc_node_trace+0x21/0x60 mm/slab_common.c:1075
 kmalloc_node include/linux/slab.h:606 [inline]
 kzalloc_node include/linux/slab.h:731 [inline]
 create_io_worker+0x10c/0x630 io_uring/io-wq.c:801
 io_wqe_create_worker io_uring/io-wq.c:310 [inline]
 io_wqe_enqueue+0x6c3/0xbc0 io_uring/io-wq.c:936
 io_queue_iowq+0x282/0x5c0 io_uring/io_uring.c:475
 io_queue_sqe_fallback+0xf3/0x190 io_uring/io_uring.c:2059
 io_submit_sqe io_uring/io_uring.c:2281 [inline]
 io_submit_sqes+0x11db/0x1e60 io_uring/io_uring.c:2397
 __do_sys_io_uring_enter+0xc1d/0x2540 io_uring/io_uring.c:3345
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 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:1446 [inline]
 free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496
 free_unref_page_prepare mm/page_alloc.c:3369 [inline]
 free_unref_page+0x1d/0x490 mm/page_alloc.c:3464
 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2637
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:302
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook mm/slab.h:761 [inline]
 slab_alloc_node mm/slub.c:3452 [inline]
 __kmem_cache_alloc_node+0x1ea/0x430 mm/slub.c:3491
 kmalloc_trace+0x26/0x60 mm/slab_common.c:1062
 kmalloc include/linux/slab.h:580 [inline]
 load_elf_binary+0x5ef/0x4f10 fs/binfmt_elf.c:905
 search_binary_handler fs/exec.c:1735 [inline]
 exec_binprm fs/exec.c:1777 [inline]
 bprm_execve fs/exec.c:1851 [inline]
 bprm_execve+0x7ef/0x19f0 fs/exec.c:1808
 do_execveat_common+0x724/0x890 fs/exec.c:1956
 do_execve fs/exec.c:2030 [inline]
 __do_sys_execve fs/exec.c:2106 [inline]
 __se_sys_execve fs/exec.c:2101 [inline]
 __x64_sys_execve+0x93/0xc0 fs/exec.c:2101
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff888022186700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888022186780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888022186800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888022186880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888022186900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (39):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce 2023/01/13 09:11 upstream c757fc92a3f7 96166539 .config console log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/12 21:35 upstream e8f60cd7db24 96166539 .config console log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/12 04:17 upstream 7dd4b804e080 96166539 .config console log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/12 02:47 upstream 7dd4b804e080 96166539 .config console log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/10 06:34 upstream 5a41237ad1d4 1dac8c7a .config console log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/08 17:09 upstream 9b43a525db12 1dac8c7a .config console log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/07 12:21 upstream a689b938df39 1dac8c7a .config strace log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/07 08:35 upstream a689b938df39 1dac8c7a .config console log report syz C [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/13 07:48 upstream c757fc92a3f7 96166539 .config console log report syz [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-selinux-root 2023/01/12 01:11 upstream 7dd4b804e080 96166539 .config console log report syz [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-qemu2-riscv64 2022/11/25 09:25 git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes 0966d385830d 74a66371 .config console log report info KASAN: wild-memory-access Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/13 17:57 upstream d9fc1511728c 529798b0 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/13 03:03 upstream c757fc92a3f7 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/13 02:22 upstream c757fc92a3f7 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/12 23:57 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/12 18:54 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/12 18:45 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/12 08:58 upstream e8f60cd7db24 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/12 01:04 upstream 7dd4b804e080 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/11 16:58 upstream 7dd4b804e080 96166539 .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/11 06:38 upstream 7dd4b804e080 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/11 02:54 upstream 7dd4b804e080 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/10 17:03 upstream 40c18f363a08 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/09 11:59 upstream 1fe4fd6f5cad 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/09 10:23 upstream 1fe4fd6f5cad 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/08 14:42 upstream 9b43a525db12 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-qemu-upstream 2023/01/08 02:55 upstream 9b43a525db12 1dac8c7a .config console log report info KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/07 23:46 upstream 0a71553536d2 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-root 2023/01/07 20:18 upstream 0a71553536d2 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/07 17:34 upstream a689b938df39 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/07 15:50 upstream a689b938df39 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-qemu-upstream 2023/01/07 12:29 upstream 0a71553536d2 1dac8c7a .config console log report info KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/07 10:06 upstream a689b938df39 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-selinux-root 2023/01/07 05:20 upstream a689b938df39 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-selinux-root 2023/01/07 04:55 upstream a689b938df39 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce 2023/01/07 03:56 upstream a689b938df39 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-kasan-gce-smack-root 2023/01/07 02:53 upstream a689b938df39 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
ci-qemu-upstream-386 2023/01/09 05:13 upstream 1fe4fd6f5cad 1dac8c7a .config console log report info KASAN: use-after-free Read in io_wq_worker_running
ci-upstream-linux-next-kasan-gce-root 2023/01/11 00:38 linux-next 435bf71af3a0 1dac8c7a .config console log report info [disk image] [vmlinux] [kernel image] KASAN: use-after-free Read in io_wq_worker_running
* Struck through repros no longer work on HEAD.