================================================================== BUG: KASAN: use-after-free in io_kill_linked_timeout+0x7fa/0x960 fs/io_uring.c:1932 Read of size 4 at addr ffff88813d700418 by task syz-executor.5/7990 CPU: 0 PID: 7990 Comm: syz-executor.5 Tainted: G W 5.10.102-syzkaller-00171-ge1b86e7f5cbb #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_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x8d/0x3d0 mm/kasan/report.c:233 __kasan_report+0x142/0x220 mm/kasan/report.c:419 kasan_report+0x51/0x70 mm/kasan/report.c:436 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 io_kill_linked_timeout+0x7fa/0x960 fs/io_uring.c:1932 __io_req_find_next fs/io_uring.c:2011 [inline] io_req_find_next fs/io_uring.c:2029 [inline] io_queue_next fs/io_uring.c:2128 [inline] io_free_req fs/io_uring.c:2136 [inline] io_put_req_deferred_cb+0xb2/0x520 fs/io_uring.c:2233 task_work_run+0x147/0x1b0 kernel/task_work.c:154 get_signal+0x167f/0x1f70 kernel/signal.c:2584 arch_do_signal+0x8d/0x620 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop kernel/entry/common.c:161 [inline] exit_to_user_mode_prepare+0xaa/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f6340221059 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f633f397168 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa RAX: 0000000000000400 RBX: 00007f6340333f60 RCX: 00007f6340221059 RDX: 0000000000000000 RSI: 0000000000001d49 RDI: 0000000000000004 RBP: 00007f634027b08d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffff561a8ef R14: 00007f633f397300 R15: 0000000000022000 Allocated by task 7990: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] __kasan_slab_alloc+0xb2/0xe0 mm/kasan/common.c:461 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:583 [inline] kmem_cache_alloc_bulk+0x2d5/0x3f0 mm/slub.c:3412 io_alloc_req fs/io_uring.c:1857 [inline] io_submit_sqes+0x6bf/0x2da0 fs/io_uring.c:6697 __do_sys_io_uring_enter fs/io_uring.c:9113 [inline] __se_sys_io_uring_enter+0x322/0x12b0 fs/io_uring.c:9055 __x64_sys_io_uring_enter+0xe5/0x100 fs/io_uring.c:9055 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 7990: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x133/0x170 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1602 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1628 slab_free mm/slub.c:3210 [inline] kmem_cache_free+0xb5/0x1f0 mm/slub.c:3226 __io_free_req+0x20e/0x380 fs/io_uring.c:1912 io_free_req fs/io_uring.c:2137 [inline] io_put_req_deferred_cb+0x64/0x520 fs/io_uring.c:2233 task_work_run+0x147/0x1b0 kernel/task_work.c:154 get_signal+0x167f/0x1f70 kernel/signal.c:2584 arch_do_signal+0x8d/0x620 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop kernel/entry/common.c:161 [inline] exit_to_user_mode_prepare+0xaa/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345 task_work_add+0xa7/0x320 kernel/task_work.c:39 io_req_task_work_add fs/io_uring.c:2052 [inline] io_free_req_deferred fs/io_uring.c:2241 [inline] io_put_req_deferred+0x12a/0x240 fs/io_uring.c:2254 io_link_timeout_fn+0x4c8/0x600 fs/io_uring.c:6279 __run_hrtimer+0x199/0x6a0 kernel/time/hrtimer.c:1583 __hrtimer_run_queues kernel/time/hrtimer.c:1647 [inline] hrtimer_interrupt+0x639/0x1380 kernel/time/hrtimer.c:1709 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1084 [inline] __sysvec_apic_timer_interrupt+0xf9/0x3c0 arch/x86/kernel/apic/apic.c:1101 asm_call_irq_on_stack+0xf/0x20 __run_sysvec_on_irqstack arch/x86/include/asm/irq_stack.h:37 [inline] run_sysvec_on_irqstack_cond arch/x86/include/asm/irq_stack.h:89 [inline] sysvec_apic_timer_interrupt+0x85/0xe0 arch/x86/kernel/apic/apic.c:1095 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:635 Second to last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:345 task_work_add+0xa7/0x320 kernel/task_work.c:39 io_req_task_work_add fs/io_uring.c:2052 [inline] io_req_task_queue fs/io_uring.c:2115 [inline] __io_queue_deferred fs/io_uring.c:1540 [inline] io_commit_cqring+0x6aa/0xa00 fs/io_uring.c:1587 io_cqring_add_event fs/io_uring.c:1771 [inline] __io_req_complete fs/io_uring.c:1814 [inline] io_accept fs/io_uring.c:4800 [inline] io_issue_sqe+0x6f34/0xfc10 fs/io_uring.c:6065 __io_queue_sqe+0x2cf/0x2fa0 fs/io_uring.c:6354 __io_req_task_submit+0x150/0x1a0 fs/io_uring.c:2090 io_req_task_submit+0x4c/0x130 fs/io_uring.c:2104 task_work_run+0x147/0x1b0 kernel/task_work.c:154 get_signal+0x167f/0x1f70 kernel/signal.c:2584 arch_do_signal+0x8d/0x620 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop kernel/entry/common.c:161 [inline] exit_to_user_mode_prepare+0xaa/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff88813d7003c0 which belongs to the cache io_kiocb of size 216 The buggy address is located 88 bytes inside of 216-byte region [ffff88813d7003c0, ffff88813d700498) The buggy address belongs to the page: page:ffffea0004f5c000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13d700 flags: 0x8000000000000200(slab) raw: 8000000000000200 0000000000000000 0000000100000001 ffff8881049ba900 raw: 0000000000000000 00000000000c000c 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 6550, ts 207083434569, free_ts 207072171108 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0xa74/0xa90 mm/page_alloc.c:4063 __alloc_pages_nodemask+0x3c8/0x820 mm/page_alloc.c:5107 alloc_slab_page mm/slub.c:1813 [inline] allocate_slab+0x6b/0x350 mm/slub.c:1815 new_slab mm/slub.c:1876 [inline] new_slab_objects mm/slub.c:2635 [inline] ___slab_alloc+0x143/0x2f0 mm/slub.c:2798 kmem_cache_alloc_bulk+0x167/0x3f0 mm/slub.c:3391 io_alloc_req fs/io_uring.c:1857 [inline] io_submit_sqes+0x6bf/0x2da0 fs/io_uring.c:6697 __do_sys_io_uring_enter fs/io_uring.c:9113 [inline] __se_sys_io_uring_enter+0x322/0x12b0 fs/io_uring.c:9055 __x64_sys_io_uring_enter+0xe5/0x100 fs/io_uring.c:9055 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xa9 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1331 [inline] free_pcp_prepare+0x18f/0x1c0 mm/page_alloc.c:1405 free_unref_page_prepare mm/page_alloc.c:3291 [inline] free_unref_page mm/page_alloc.c:3341 [inline] free_the_page mm/page_alloc.c:5166 [inline] __free_pages+0x2e3/0x4a0 mm/page_alloc.c:5174 __free_slab+0xdf/0x1a0 mm/slub.c:1901 free_slab mm/slub.c:1916 [inline] discard_slab mm/slub.c:1922 [inline] unfreeze_partials+0x17d/0x1b0 mm/slub.c:2416 put_cpu_partial+0xc8/0x190 mm/slub.c:2452 __slab_free+0x2eb/0x4e0 mm/slub.c:3102 do_slab_free mm/slub.c:3198 [inline] ___cache_free+0x131/0x150 mm/slub.c:3217 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146 qlist_free_all mm/kasan/quarantine.c:165 [inline] kasan_quarantine_reduce+0x178/0x1d0 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:583 [inline] slab_alloc_node mm/slub.c:2954 [inline] slab_alloc mm/slub.c:2962 [inline] kmem_cache_alloc+0x1a2/0x380 mm/slub.c:2967 getname_flags+0xba/0x650 fs/namei.c:141 getname+0x19/0x20 fs/namei.c:212 do_sys_openat2+0xd2/0x470 fs/open.c:1205 do_sys_open fs/open.c:1227 [inline] __do_sys_openat fs/open.c:1243 [inline] __se_sys_openat fs/open.c:1238 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1238 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46 Memory state around the buggy address: ffff88813d700300: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc ffff88813d700380: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb >ffff88813d700400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88813d700480: fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88813d700500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 0 PID: 7990 at lib/refcount.c:28 refcount_warn_saturate+0x165/0x1b0 lib/refcount.c:28 Modules linked in: CPU: 0 PID: 7990 Comm: syz-executor.5 Tainted: G B W 5.10.102-syzkaller-00171-ge1b86e7f5cbb #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:refcount_warn_saturate+0x165/0x1b0 lib/refcount.c:28 Code: c7 60 bc 49 85 31 c0 e8 89 ac ea fe 0f 0b eb 83 e8 f0 c9 17 ff c6 05 ed 0f 68 04 01 48 c7 c7 c0 bc 49 85 31 c0 e8 6b ac ea fe <0f> 0b e9 62 ff ff ff e8 cf c9 17 ff c6 05 cd 0f 68 04 01 48 c7 c7 RSP: 0018:ffffc90006d77a70 EFLAGS: 00010246 RAX: fc25916df1538800 RBX: 0000000000000003 RCX: 1ffff92000daef08 RDX: ffffc90001b40000 RSI: 000000000003ffff RDI: 0000000000040000 RBP: ffffc90006d77a80 R08: ffffffff81544d58 R09: ffffed103ee04e83 R10: ffffed103ee04e83 R11: 0000000000000000 R12: ffff88813d700430 R13: ffff88813d6ffcd8 R14: 0000000000000003 R15: 00000000ffffffff FS: 00007f633f397700(0000) GS:ffff8881f7000000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f03bcc9ed00 CR3: 0000000119489000 CR4: 00000000003506b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __refcount_sub_and_test include/linux/refcount.h:283 [inline] __refcount_dec_and_test include/linux/refcount.h:315 [inline] refcount_dec_and_test include/linux/refcount.h:333 [inline] io_put_req fs/io_uring.c:2225 [inline] io_kill_linked_timeout+0x3f4/0x960 fs/io_uring.c:1949 __io_req_find_next fs/io_uring.c:2011 [inline] io_req_find_next fs/io_uring.c:2029 [inline] io_queue_next fs/io_uring.c:2128 [inline] io_free_req fs/io_uring.c:2136 [inline] io_put_req_deferred_cb+0xb2/0x520 fs/io_uring.c:2233 task_work_run+0x147/0x1b0 kernel/task_work.c:154 get_signal+0x167f/0x1f70 kernel/signal.c:2584 arch_do_signal+0x8d/0x620 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop kernel/entry/common.c:161 [inline] exit_to_user_mode_prepare+0xaa/0xe0 kernel/entry/common.c:191 syscall_exit_to_user_mode+0x24/0x40 kernel/entry/common.c:266 do_syscall_64+0x3d/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f6340221059 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f633f397168 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa RAX: 0000000000000400 RBX: 00007f6340333f60 RCX: 00007f6340221059 RDX: 0000000000000000 RSI: 0000000000001d49 RDI: 0000000000000004 RBP: 00007f634027b08d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffff561a8ef R14: 00007f633f397300 R15: 0000000000022000 ---[ end trace 5d5df853690b6994 ]---