syzbot


KASAN: use-after-free Read in io_cancel_async_work

Status: upstream: reported C repro on 2020/08/21 02:57
Reported-by: syzbot+47d3ee74cfc0547914e7@syzkaller.appspotmail.com
First crash: 839d, last: 785d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0x2b/0x100 lib/list_debug.c:42
Read of size 8 at addr ffff8881cdc22b80 by task syz-executor842/330

CPU: 0 PID: 330 Comm: syz-executor842 Not tainted 5.4.59-syzkaller-00509-g013a1a228267 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x14a/0x1ce lib/dump_stack.c:118
 print_address_description+0x93/0x620 mm/kasan/report.c:374
 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506
 kasan_report+0x36/0x60 mm/kasan/common.c:634
 __list_del_entry_valid+0x2b/0x100 lib/list_debug.c:42
 __list_del_entry include/linux/list.h:131 [inline]
 list_del_init include/linux/list.h:190 [inline]
 io_cancel_async_work+0x9b/0x280 fs/io_uring.c:3716
 io_ring_ctx_wait_and_kill+0xaf/0x1380 fs/io_uring.c:3730
 io_uring_release+0x59/0x70 fs/io_uring.c:3753
 __fput+0x27d/0x6c0 fs/file_table.c:280
 task_work_run+0x176/0x1a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xc42/0x2700 kernel/exit.c:808
 do_group_exit+0x155/0x2b0 kernel/exit.c:906
 __do_sys_exit_group+0x13/0x20 kernel/exit.c:917
 __se_sys_exit_group+0x10/0x10 kernel/exit.c:915
 __x64_sys_exit_group+0x37/0x40 kernel/exit.c:915
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x43f998
Code: Bad RIP value.
RSP: 002b:00007ffd6753e468 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 000000000043f998
RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
RBP: 00000000004bf950 R08: 00000000000000e7 R09: ffffffffffffffd0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00000000006d11a0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 330:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc_node mm/slub.c:2793 [inline]
 slab_alloc mm/slub.c:2801 [inline]
 kmem_cache_alloc+0x1d5/0x260 mm/slub.c:2806
 io_get_req+0x1e8/0x850 fs/io_uring.c:642
 io_submit_sqe+0x83/0xe90 fs/io_uring.c:2560
 io_ring_submit fs/io_uring.c:2948 [inline]
 __do_sys_io_uring_enter fs/io_uring.c:3825 [inline]
 __se_sys_io_uring_enter+0x922/0x1ff0 fs/io_uring.c:3786
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 154:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x181/0x230 mm/kasan/common.c:471
 slab_free_hook mm/slub.c:1443 [inline]
 slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1476
 slab_free mm/slub.c:3041 [inline]
 kmem_cache_free+0xac/0x600 mm/slub.c:3057
 io_put_req fs/io_uring.c:762 [inline]
 io_poll_complete_work+0x737/0x940 fs/io_uring.c:1835
 process_one_work+0x777/0xf90 kernel/workqueue.c:2274
 worker_thread+0xa8f/0x1430 kernel/workqueue.c:2420
 kthread+0x2df/0x300 kernel/kthread.c:255
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

The buggy address belongs to the object at ffff8881cdc22a80
 which belongs to the cache io_kiocb of size 264
The buggy address is located 256 bytes inside of
 264-byte region [ffff8881cdc22a80, ffff8881cdc22b88)
The buggy address belongs to the page:
page:ffffea0007370880 refcount:1 mapcount:0 mapping:ffff8881d920cf00 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881d920cf00
raw: 0000000000000000 0000000080150015 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881cdc22a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881cdc22b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881cdc22b80: fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff8881cdc22c00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881cdc22c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==========================================================

Crashes (25):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-android-5-4-kasan 2020/08/21 03:16 https://android.googlesource.com/kernel/common android-5.4 013a1a228267 70160577 .config log report syz C
ci2-android-5-4-kasan 2020/08/23 11:24 https://android.googlesource.com/kernel/common android-5.4 2f4d6c9fd77c a6d5f3ad .config log report syz
ci2-android-5-4-kasan 2020/10/13 22:35 android12-5.4 2a31fdaad927 fc7735a2 .config log report info
ci2-android-5-4-kasan 2020/10/11 22:47 android12-5.4 d0e6eb879517 4a77ae0b .config log report info
ci2-android-5-4-kasan 2020/10/11 19:00 android12-5.4 d0e6eb879517 4a77ae0b .config log report info
ci2-android-5-4-kasan 2020/10/11 18:48 android12-5.4 d0e6eb879517 4a77ae0b .config log report info
ci2-android-5-4-kasan 2020/10/10 16:39 android12-5.4 d0e6eb879517 b74c49a6 .config log report info
ci2-android-5-4-kasan 2020/10/04 07:01 android12-5.4 9d0d630081ae 1a3f9408 .config log report info
ci2-android-5-4-kasan 2020/09/29 01:05 android12-5.4 b9dbbb956e76 1b88c6d5 .config log report info
ci2-android-5-4-kasan 2020/09/27 07:53 android12-5.4 c43f5a389e8c 5dd8aee8 .config log report info
ci2-android-5-4-kasan 2020/09/26 07:06 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 4a006f63 .config log report info
ci2-android-5-4-kasan 2020/09/25 23:39 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 4a006f63 .config log report info
ci2-android-5-4-kasan 2020/09/25 09:17 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 54289b08 .config log report info
ci2-android-5-4-kasan 2020/09/22 21:51 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 3e8f6c27 .config log report info
ci2-android-5-4-kasan 2020/09/21 02:09 https://android.googlesource.com/kernel/common android-5.4 63d1c2f0b547 9564d2e9 .config log report info
ci2-android-5-4-kasan 2020/09/12 06:51 https://android.googlesource.com/kernel/common android-5.4 e1c9ea5fd907 79fb24e2 .config log report
ci2-android-5-4-kasan 2020/09/11 17:05 https://android.googlesource.com/kernel/common android-5.4 aa0ddbda9397 adfb8b4e .config log report
ci2-android-5-4-kasan 2020/09/11 15:38 https://android.googlesource.com/kernel/common android-5.4 aa0ddbda9397 adfb8b4e .config log report
ci2-android-5-4-kasan 2020/09/08 13:01 https://android.googlesource.com/kernel/common android-5.4 98fda21f54f7 abf9ba4f .config log report
ci2-android-5-4-kasan 2020/09/06 16:31 https://android.googlesource.com/kernel/common android-5.4 0ef1db7b69dd abf9ba4f .config log report
ci2-android-5-4-kasan 2020/09/04 22:09 https://android.googlesource.com/kernel/common android-5.4 3f20ba7d5d1d abf9ba4f .config log report
ci2-android-5-4-kasan 2020/09/03 22:42 https://android.googlesource.com/kernel/common android-5.4 0ede4657b27f abf9ba4f .config log report
ci2-android-5-4-kasan 2020/09/01 04:59 https://android.googlesource.com/kernel/common android-5.4 700ba04e5a06 d5a3ae1f .config log report
ci2-android-5-4-kasan 2020/08/21 10:16 https://android.googlesource.com/kernel/common android-5.4 17245be70d1d 1d75fe45 .config log report
ci2-android-5-4-kasan 2020/08/21 02:56 https://android.googlesource.com/kernel/common android-5.4 013a1a228267 70160577 .config log report
* Struck through repros no longer work on HEAD.