public inbox for [email protected]
 help / color / mirror / Atom feed
* [syzbot] WARNING in io_link_timeout_fn
@ 2021-05-12 20:28 syzbot
  2021-05-12 20:56 ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2021-05-12 20:28 UTC (permalink / raw)
  To: asml.silence, axboe, io-uring, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

Hello,

syzbot found the following issue on:

HEAD commit:    88b06399 Merge tag 'for-5.13-rc1-part2-tag' of git://git.k..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13c0d265d00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=807beec6b4d66bf1
dashboard link: https://syzkaller.appspot.com/bug?extid=5a864149dd970b546223
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10436223d00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1715208bd00000

The issue was bisected to:

commit 91f245d5d5de0802428a478802ec051f7de2f5d6
Author: Jens Axboe <[email protected]>
Date:   Tue Feb 9 20:48:50 2021 +0000

    io_uring: enable kmemcg account for io_uring requests

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=144fbb23d00000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=164fbb23d00000
console output: https://syzkaller.appspot.com/x/log.txt?x=124fbb23d00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]
Fixes: 91f245d5d5de ("io_uring: enable kmemcg account for io_uring requests")

------------[ cut here ]------------
WARNING: CPU: 1 PID: 8784 at fs/io_uring.c:1499 req_ref_sub_and_test fs/io_uring.c:1499 [inline]
WARNING: CPU: 1 PID: 8784 at fs/io_uring.c:1499 io_put_req_deferred fs/io_uring.c:2191 [inline]
WARNING: CPU: 1 PID: 8784 at fs/io_uring.c:1499 io_link_timeout_fn+0x96c/0xb20 fs/io_uring.c:6369
Modules linked in:
CPU: 1 PID: 8784 Comm: systemd-cgroups Not tainted 5.13.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:req_ref_sub_and_test fs/io_uring.c:1499 [inline]
RIP: 0010:io_put_req_deferred fs/io_uring.c:2191 [inline]
RIP: 0010:io_link_timeout_fn+0x96c/0xb20 fs/io_uring.c:6369
Code: 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 80 3c 02 00 0f 84 f9 fd ff ff e8 ae ff da ff e9 ef fd ff ff e8 f4 03 96 ff <0f> 0b e9 6a fc ff ff e8 e8 03 96 ff 4c 89 ef e8 10 96 ff ff 48 8d
RSP: 0018:ffffc90000dc0d70 EFLAGS: 00010046
RAX: 0000000080010001 RBX: ffff88802c080c80 RCX: 0000000000000000
RDX: ffff8880373954c0 RSI: ffffffff81dece4c RDI: 0000000000000003
RBP: ffff88802c080cdc R08: 000000000000007f R09: ffff88802c080cdf
R10: ffffffff81decab3 R11: 0000000000000000 R12: 000000000000007f
R13: 0000000000000000 R14: ffff88802c15e000 R15: ffff88802c15e680
FS:  0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6ba37daab4 CR3: 0000000015bdf000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <IRQ>
 __run_hrtimer kernel/time/hrtimer.c:1537 [inline]
 __hrtimer_run_queues+0x609/0xe40 kernel/time/hrtimer.c:1601
 hrtimer_interrupt+0x330/0xa00 kernel/time/hrtimer.c:1663
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1089 [inline]
 __sysvec_apic_timer_interrupt+0x146/0x540 arch/x86/kernel/apic/apic.c:1106
 sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1100
 </IRQ>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:647
RIP: 0010:orc_find arch/x86/kernel/unwind_orc.c:166 [inline]
RIP: 0010:unwind_next_frame+0x308/0x1ce0 arch/x86/kernel/unwind_orc.c:443
Code: 48 8d 3c 40 4c 8d 8c 3f cc 27 3d 8e 83 c2 01 49 81 f9 a4 0c dd 8e 0f 83 f3 10 00 00 89 d7 48 8d 3c 7f 48 8d bc 3f cc 27 3d 8e <48> 81 ff a4 0c dd 8e 0f 87 d8 10 00 00 48 8d 3c 85 3c 8f d2 8d 29
RSP: 0018:ffffc9000918f6a8 EFLAGS: 00000293
RAX: 000000000002bff1 RBX: 1ffff92001231edd RCX: 000000000002bff1
RDX: 000000000002bffb RSI: 000000000000b9cd RDI: ffffffff8e4da7ae
RBP: 0000000000000001 R08: 0000000000000000 R09: ffffffff8e4da772
R10: fffff52001231efb R11: 0000000000084087 R12: ffffc9000918f7c8
R13: ffffc9000918f7b5 R14: ffffc9000918f780 R15: ffffffff81b9cd7f
 arch_stack_walk+0x7d/0xe0 arch/x86/kernel/stacktrace.c:25
 stack_trace_save+0x8c/0xc0 kernel/stacktrace.c:121
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
 ____kasan_slab_free mm/kasan/common.c:360 [inline]
 ____kasan_slab_free mm/kasan/common.c:325 [inline]
 __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368
 kasan_slab_free include/linux/kasan.h:212 [inline]
 slab_free_hook mm/slub.c:1581 [inline]
 slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1606
 slab_free mm/slub.c:3166 [inline]
 kmem_cache_free+0x8a/0x740 mm/slub.c:3182
 anon_vma_chain_free mm/rmap.c:141 [inline]
 unlink_anon_vmas+0x472/0x860 mm/rmap.c:439
 free_pgtables+0xe2/0x2f0 mm/memory.c:413
 exit_mmap+0x2b7/0x590 mm/mmap.c:3209
 __mmput+0x122/0x470 kernel/fork.c:1096
 mmput+0x58/0x60 kernel/fork.c:1117
 exit_mm kernel/exit.c:502 [inline]
 do_exit+0xb0a/0x2a60 kernel/exit.c:813
 do_group_exit+0x125/0x310 kernel/exit.c:923
 __do_sys_exit_group kernel/exit.c:934 [inline]
 __se_sys_exit_group kernel/exit.c:932 [inline]
 __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:932
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f6ba4eb3618
Code: Unable to access opcode bytes at RIP 0x7f6ba4eb35ee.
RSP: 002b:00007ffd8038caf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f6ba4eb3618
RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
RBP: 00007f6ba51908e0 R08: 00000000000000e7 R09: fffffffffffffee8
R10: 00007f6ba336e158 R11: 0000000000000246 R12: 00007f6ba51908e0
R13: 00007f6ba5195c20 R14: 0000000000000000 R15: 0000000000000000


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in io_link_timeout_fn
  2021-05-12 20:28 [syzbot] WARNING in io_link_timeout_fn syzbot
@ 2021-05-12 20:56 ` Jens Axboe
  2021-05-12 22:38   ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: Jens Axboe @ 2021-05-12 20:56 UTC (permalink / raw)
  To: syzbot, asml.silence, io-uring, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

On 5/12/21 2:28 PM, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    88b06399 Merge tag 'for-5.13-rc1-part2-tag' of git://git.k..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=13c0d265d00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=807beec6b4d66bf1
> dashboard link: https://syzkaller.appspot.com/bug?extid=5a864149dd970b546223
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10436223d00000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1715208bd00000
> 
> The issue was bisected to:
> 
> commit 91f245d5d5de0802428a478802ec051f7de2f5d6
> Author: Jens Axboe <[email protected]>
> Date:   Tue Feb 9 20:48:50 2021 +0000
> 
>     io_uring: enable kmemcg account for io_uring requests

Don't think that's right...

> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=144fbb23d00000
> final oops:     https://syzkaller.appspot.com/x/report.txt?x=164fbb23d00000
> console output: https://syzkaller.appspot.com/x/log.txt?x=124fbb23d00000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: [email protected]
> Fixes: 91f245d5d5de ("io_uring: enable kmemcg account for io_uring requests")

I think this one is already fixed:

#syz test: git://git.kernel.dk/linux-block.git io_uring-5.13

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in io_link_timeout_fn
  2021-05-12 20:56 ` Jens Axboe
@ 2021-05-12 22:38   ` syzbot
  2021-05-13 21:03     ` Pavel Begunkov
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2021-05-12 22:38 UTC (permalink / raw)
  To: asml.silence, axboe, io-uring, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING in io_req_complete_failed

------------[ cut here ]------------
WARNING: CPU: 0 PID: 10153 at fs/io_uring.c:1505 req_ref_put_and_test fs/io_uring.c:1505 [inline]
WARNING: CPU: 0 PID: 10153 at fs/io_uring.c:1505 io_put_req fs/io_uring.c:2171 [inline]
WARNING: CPU: 0 PID: 10153 at fs/io_uring.c:1505 io_req_complete_failed+0x2ee/0x5a0 fs/io_uring.c:1649
Modules linked in:
CPU: 1 PID: 10153 Comm: syz-executor.3 Not tainted 5.12.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:req_ref_put_and_test fs/io_uring.c:1505 [inline]
RIP: 0010:io_put_req fs/io_uring.c:2171 [inline]
RIP: 0010:io_req_complete_failed+0x2ee/0x5a0 fs/io_uring.c:1649
Code: 58 bd da ff be 01 00 00 00 4c 89 f7 e8 5b 78 fe ff e9 09 fe ff ff e8 f1 32 97 ff 4c 89 ef e8 a9 fd 65 ff eb cb e8 e2 32 97 ff <0f> 0b e9 c8 fd ff ff 4c 89 f7 e8 23 0b db ff e9 3c fd ff ff 4c 89
RSP: 0018:ffffc9000afbfd10 EFLAGS: 00010293

RAX: 0000000000000000 RBX: 000000000000007f RCX: 0000000000000000
RDX: ffff88801f5e0000 RSI: ffffffff81dd35ae RDI: 0000000000000003
RBP: ffff888043314dc0 R08: 000000000000007f R09: ffff888043314e1f
R10: ffffffff81dd3374 R11: 000000000000000f R12: ffffffffffffffea
R13: ffff888043314e1c R14: ffff888043314e18 R15: 00000000ffffffea
FS:  00007fac1b577700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f04f797dd40 CR3: 0000000012dfb000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 __io_queue_sqe+0x61e/0x10f0 fs/io_uring.c:6440
 __io_req_task_submit+0x103/0x120 fs/io_uring.c:2037
 __tctx_task_work fs/io_uring.c:1908 [inline]
 tctx_task_work+0x24e/0x550 fs/io_uring.c:1922
 task_work_run+0xdd/0x1a0 kernel/task_work.c:161
 tracehook_notify_signal include/linux/tracehook.h:212 [inline]
 handle_signal_work kernel/entry/common.c:145 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x24a/0x280 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:57
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665f9
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 bc ff ff ff f7 d8 64 89 01 48


Tested on:

commit:         a298232e io_uring: fix link timeout refs
git tree:       git://git.kernel.dk/linux-block.git io_uring-5.13
console output: https://syzkaller.appspot.com/x/log.txt?x=15f82965d00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=ae2e6c63d6410fd3
dashboard link: https://syzkaller.appspot.com/bug?extid=5a864149dd970b546223
compiler:       


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in io_link_timeout_fn
  2021-05-12 22:38   ` syzbot
@ 2021-05-13 21:03     ` Pavel Begunkov
  2021-05-14  0:08       ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Begunkov @ 2021-05-13 21:03 UTC (permalink / raw)
  To: syzbot, axboe, io-uring, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

On 5/12/21 11:38 PM, syzbot wrote:
> Hello,
> 
> syzbot has tested the proposed patch but the reproducer is still triggering an issue:
> WARNING in io_req_complete_failed

Let's get more info on it

#syz test: https://github.com/isilence/linux.git syz_test6

> 
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 10153 at fs/io_uring.c:1505 req_ref_put_and_test fs/io_uring.c:1505 [inline]
> WARNING: CPU: 0 PID: 10153 at fs/io_uring.c:1505 io_put_req fs/io_uring.c:2171 [inline]
> WARNING: CPU: 0 PID: 10153 at fs/io_uring.c:1505 io_req_complete_failed+0x2ee/0x5a0 fs/io_uring.c:1649
> Modules linked in:
> CPU: 1 PID: 10153 Comm: syz-executor.3 Not tainted 5.12.0-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> RIP: 0010:req_ref_put_and_test fs/io_uring.c:1505 [inline]
> RIP: 0010:io_put_req fs/io_uring.c:2171 [inline]
> RIP: 0010:io_req_complete_failed+0x2ee/0x5a0 fs/io_uring.c:1649
> Code: 58 bd da ff be 01 00 00 00 4c 89 f7 e8 5b 78 fe ff e9 09 fe ff ff e8 f1 32 97 ff 4c 89 ef e8 a9 fd 65 ff eb cb e8 e2 32 97 ff <0f> 0b e9 c8 fd ff ff 4c 89 f7 e8 23 0b db ff e9 3c fd ff ff 4c 89
> RSP: 0018:ffffc9000afbfd10 EFLAGS: 00010293
> 
> RAX: 0000000000000000 RBX: 000000000000007f RCX: 0000000000000000
> RDX: ffff88801f5e0000 RSI: ffffffff81dd35ae RDI: 0000000000000003
> RBP: ffff888043314dc0 R08: 000000000000007f R09: ffff888043314e1f
> R10: ffffffff81dd3374 R11: 000000000000000f R12: ffffffffffffffea
> R13: ffff888043314e1c R14: ffff888043314e18 R15: 00000000ffffffea
> FS:  00007fac1b577700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
> CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 00007f04f797dd40 CR3: 0000000012dfb000 CR4: 00000000001506e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
>  __io_queue_sqe+0x61e/0x10f0 fs/io_uring.c:6440
>  __io_req_task_submit+0x103/0x120 fs/io_uring.c:2037
>  __tctx_task_work fs/io_uring.c:1908 [inline]
>  tctx_task_work+0x24e/0x550 fs/io_uring.c:1922
>  task_work_run+0xdd/0x1a0 kernel/task_work.c:161
>  tracehook_notify_signal include/linux/tracehook.h:212 [inline]
>  handle_signal_work kernel/entry/common.c:145 [inline]
>  exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
>  exit_to_user_mode_prepare+0x24a/0x280 kernel/entry/common.c:208
>  __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
>  syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
>  do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:57
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> RIP: 0033:0x4665f9
> 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 bc ff ff ff f7 d8 64 89 01 48
> 
> 
> Tested on:
> 
> commit:         a298232e io_uring: fix link timeout refs
> git tree:       git://git.kernel.dk/linux-block.git io_uring-5.13
> console output: https://syzkaller.appspot.com/x/log.txt?x=15f82965d00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=ae2e6c63d6410fd3
> dashboard link: https://syzkaller.appspot.com/bug?extid=5a864149dd970b546223
> compiler:       
> 

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in io_link_timeout_fn
  2021-05-13 21:03     ` Pavel Begunkov
@ 2021-05-14  0:08       ` syzbot
  2021-05-14  0:39         ` Pavel Begunkov
  0 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2021-05-14  0:08 UTC (permalink / raw)
  To: asml.silence, axboe, io-uring, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: use-after-free Read in hrtimer_active

==================================================================
BUG: KASAN: use-after-free in hrtimer_active+0x1d6/0x1f0 kernel/time/hrtimer.c:1462
Read of size 8 at addr ffff8880129a64b8 by task syz-executor.0/9928

CPU: 0 PID: 9928 Comm: syz-executor.0 Not tainted 5.12.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:79 [inline]
 dump_stack+0x141/0x1d7 lib/dump_stack.c:120
 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
 hrtimer_active+0x1d6/0x1f0 kernel/time/hrtimer.c:1462
 hrtimer_try_to_cancel+0x21/0x1e0 kernel/time/hrtimer.c:1180
 io_kill_linked_timeout fs/io_uring.c:1794 [inline]
 io_disarm_next+0x196/0xad0 fs/io_uring.c:1827
 __io_req_find_next+0xca/0x160 fs/io_uring.c:1852
 io_req_find_next fs/io_uring.c:1868 [inline]
 io_queue_next fs/io_uring.c:2070 [inline]
 io_free_req fs/io_uring.c:2078 [inline]
 io_put_req_deferred_cb+0x253/0x4a0 fs/io_uring.c:2180
 __tctx_task_work fs/io_uring.c:1909 [inline]
 tctx_task_work+0x24e/0x550 fs/io_uring.c:1923
 task_work_run+0xdd/0x1a0 kernel/task_work.c:161
 tracehook_notify_signal include/linux/tracehook.h:212 [inline]
 handle_signal_work kernel/entry/common.c:145 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
 exit_to_user_mode_prepare+0x24a/0x280 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:57
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665f9
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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f9092a97188 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa
RAX: 0000000000000100 RBX: 000000000056bf60 RCX: 00000000004665f9
RDX: 0000000000000000 RSI: 000000000000450c RDI: 0000000000000003
RBP: 00000000004bfce1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60
R13: 0000000000a9fb1f R14: 00007f9092a97300 R15: 0000000000022000

Allocated by task 9928:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:427 [inline]
 ____kasan_kmalloc mm/kasan/common.c:506 [inline]
 ____kasan_kmalloc mm/kasan/common.c:465 [inline]
 __kasan_kmalloc+0x99/0xc0 mm/kasan/common.c:515
 kmalloc include/linux/slab.h:561 [inline]
 io_alloc_async_data fs/io_uring.c:3116 [inline]
 io_timeout_prep+0x3d9/0x500 fs/io_uring.c:5637
 io_req_prep fs/io_uring.c:5908 [inline]
 io_submit_sqe fs/io_uring.c:6576 [inline]
 io_submit_sqes+0x4e4c/0x6c50 fs/io_uring.c:6734
 __do_sys_io_uring_enter+0xeaf/0x1d50 fs/io_uring.c:9319
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 4826:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
 ____kasan_slab_free mm/kasan/common.c:360 [inline]
 ____kasan_slab_free mm/kasan/common.c:325 [inline]
 __kasan_slab_free+0xf5/0x130 mm/kasan/common.c:367
 kasan_slab_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:1563 [inline]
 slab_free_freelist_hook+0x92/0x210 mm/slub.c:1601
 slab_free mm/slub.c:3162 [inline]
 kfree+0xe5/0x7f0 mm/slub.c:4216
 io_dismantle_req+0x116/0x250 fs/io_uring.c:1743
 io_req_complete_post+0x1d7/0x890 fs/io_uring.c:1600
 io_link_timeout_fn+0x5f7/0xb10 fs/io_uring.c:6369
 __run_hrtimer kernel/time/hrtimer.c:1537 [inline]
 __hrtimer_run_queues+0x609/0xe40 kernel/time/hrtimer.c:1601
 hrtimer_interrupt+0x330/0xa00 kernel/time/hrtimer.c:1663
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1089 [inline]
 __sysvec_apic_timer_interrupt+0x146/0x540 arch/x86/kernel/apic/apic.c:1106
 sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1100
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:632

The buggy address belongs to the object at ffff8880129a6480
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 56 bytes inside of
 96-byte region [ffff8880129a6480, ffff8880129a64e0)
The buggy address belongs to the page:
page:ffffea00004a6980 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x129a6
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888010841780
raw: 0000000000000000 0000000000200020 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 9928, ts 107924339577
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x161/0x1c0 mm/page_alloc.c:2302
 prep_new_page mm/page_alloc.c:2311 [inline]
 get_page_from_freelist+0x1c6f/0x3fb0 mm/page_alloc.c:3951
 __alloc_pages_nodemask+0x2d6/0x730 mm/page_alloc.c:5001
 alloc_pages_current+0x18c/0x2a0 mm/mempolicy.c:2277
 alloc_pages include/linux/gfp.h:561 [inline]
 alloc_slab_page mm/slub.c:1639 [inline]
 allocate_slab+0x2c5/0x4c0 mm/slub.c:1779
 new_slab mm/slub.c:1842 [inline]
 new_slab_objects mm/slub.c:2588 [inline]
 ___slab_alloc+0x44c/0x7a0 mm/slub.c:2751
 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2791
 slab_alloc_node mm/slub.c:2872 [inline]
 slab_alloc mm/slub.c:2916 [inline]
 __kmalloc+0x2e5/0x300 mm/slub.c:4054
 kmalloc include/linux/slab.h:561 [inline]
 io_alloc_async_data fs/io_uring.c:3116 [inline]
 io_timeout_prep+0x3d9/0x500 fs/io_uring.c:5637
 io_req_prep fs/io_uring.c:5908 [inline]
 io_submit_sqe fs/io_uring.c:6576 [inline]
 io_submit_sqes+0x4e4c/0x6c50 fs/io_uring.c:6734
 __do_sys_io_uring_enter+0xeaf/0x1d50 fs/io_uring.c:9319
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1271 [inline]
 free_pcp_prepare+0x2cb/0x410 mm/page_alloc.c:1310
 free_unref_page_prepare mm/page_alloc.c:3205 [inline]
 free_unref_page+0x12/0x1d0 mm/page_alloc.c:3253
 qlink_free mm/kasan/quarantine.c:146 [inline]
 qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
 __kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:437
 kasan_slab_alloc include/linux/kasan.h:223 [inline]
 slab_post_alloc_hook mm/slab.h:516 [inline]
 slab_alloc_node mm/slub.c:2908 [inline]
 slab_alloc mm/slub.c:2916 [inline]
 kmem_cache_alloc+0x153/0x370 mm/slub.c:2921
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
 getname_flags include/linux/audit.h:319 [inline]
 getname+0x8e/0xd0 fs/namei.c:209
 do_sys_openat2+0xf5/0x420 fs/open.c:1181
 do_sys_open fs/open.c:1203 [inline]
 __do_sys_open fs/open.c:1211 [inline]
 __se_sys_open fs/open.c:1207 [inline]
 __x64_sys_open+0x119/0x1c0 fs/open.c:1207
 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff8880129a6380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8880129a6400: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
>ffff8880129a6480: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                                        ^
 ffff8880129a6500: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8880129a6580: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================


Tested on:

commit:         a519b86e io_uring: syz debug output
git tree:       https://github.com/isilence/linux.git syz_test6
console output: https://syzkaller.appspot.com/x/log.txt?x=14127779d00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=ae2e6c63d6410fd3
dashboard link: https://syzkaller.appspot.com/bug?extid=5a864149dd970b546223
compiler:       


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in io_link_timeout_fn
  2021-05-14  0:08       ` syzbot
@ 2021-05-14  0:39         ` Pavel Begunkov
  2021-05-14  1:05           ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Begunkov @ 2021-05-14  0:39 UTC (permalink / raw)
  To: syzbot, axboe, io-uring, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

On 5/14/21 1:08 AM, syzbot wrote:
> Hello,
> 
> syzbot has tested the proposed patch but the reproducer is still triggering an issue:
> KASAN: use-after-free Read in hrtimer_active

#syz test: https://github.com/isilence/linux.git syz_test8

> ==================================================================
> BUG: KASAN: use-after-free in hrtimer_active+0x1d6/0x1f0 kernel/time/hrtimer.c:1462
> Read of size 8 at addr ffff8880129a64b8 by task syz-executor.0/9928
> 
> CPU: 0 PID: 9928 Comm: syz-executor.0 Not tainted 5.12.0-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:79 [inline]
>  dump_stack+0x141/0x1d7 lib/dump_stack.c:120
>  print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233
>  __kasan_report mm/kasan/report.c:419 [inline]
>  kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436
>  hrtimer_active+0x1d6/0x1f0 kernel/time/hrtimer.c:1462
>  hrtimer_try_to_cancel+0x21/0x1e0 kernel/time/hrtimer.c:1180
>  io_kill_linked_timeout fs/io_uring.c:1794 [inline]
>  io_disarm_next+0x196/0xad0 fs/io_uring.c:1827
>  __io_req_find_next+0xca/0x160 fs/io_uring.c:1852
>  io_req_find_next fs/io_uring.c:1868 [inline]
>  io_queue_next fs/io_uring.c:2070 [inline]
>  io_free_req fs/io_uring.c:2078 [inline]
>  io_put_req_deferred_cb+0x253/0x4a0 fs/io_uring.c:2180
>  __tctx_task_work fs/io_uring.c:1909 [inline]
>  tctx_task_work+0x24e/0x550 fs/io_uring.c:1923
>  task_work_run+0xdd/0x1a0 kernel/task_work.c:161
>  tracehook_notify_signal include/linux/tracehook.h:212 [inline]
>  handle_signal_work kernel/entry/common.c:145 [inline]
>  exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
>  exit_to_user_mode_prepare+0x24a/0x280 kernel/entry/common.c:208
>  __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
>  syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:301
>  do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:57
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> RIP: 0033:0x4665f9
> 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 bc ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f9092a97188 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa
> RAX: 0000000000000100 RBX: 000000000056bf60 RCX: 00000000004665f9
> RDX: 0000000000000000 RSI: 000000000000450c RDI: 0000000000000003
> RBP: 00000000004bfce1 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60
> R13: 0000000000a9fb1f R14: 00007f9092a97300 R15: 0000000000022000
> 
> Allocated by task 9928:
>  kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
>  kasan_set_track mm/kasan/common.c:46 [inline]
>  set_alloc_info mm/kasan/common.c:427 [inline]
>  ____kasan_kmalloc mm/kasan/common.c:506 [inline]
>  ____kasan_kmalloc mm/kasan/common.c:465 [inline]
>  __kasan_kmalloc+0x99/0xc0 mm/kasan/common.c:515
>  kmalloc include/linux/slab.h:561 [inline]
>  io_alloc_async_data fs/io_uring.c:3116 [inline]
>  io_timeout_prep+0x3d9/0x500 fs/io_uring.c:5637
>  io_req_prep fs/io_uring.c:5908 [inline]
>  io_submit_sqe fs/io_uring.c:6576 [inline]
>  io_submit_sqes+0x4e4c/0x6c50 fs/io_uring.c:6734
>  __do_sys_io_uring_enter+0xeaf/0x1d50 fs/io_uring.c:9319
>  do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> Freed by task 4826:
>  kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
>  kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
>  kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357
>  ____kasan_slab_free mm/kasan/common.c:360 [inline]
>  ____kasan_slab_free mm/kasan/common.c:325 [inline]
>  __kasan_slab_free+0xf5/0x130 mm/kasan/common.c:367
>  kasan_slab_free include/linux/kasan.h:199 [inline]
>  slab_free_hook mm/slub.c:1563 [inline]
>  slab_free_freelist_hook+0x92/0x210 mm/slub.c:1601
>  slab_free mm/slub.c:3162 [inline]
>  kfree+0xe5/0x7f0 mm/slub.c:4216
>  io_dismantle_req+0x116/0x250 fs/io_uring.c:1743
>  io_req_complete_post+0x1d7/0x890 fs/io_uring.c:1600
>  io_link_timeout_fn+0x5f7/0xb10 fs/io_uring.c:6369
>  __run_hrtimer kernel/time/hrtimer.c:1537 [inline]
>  __hrtimer_run_queues+0x609/0xe40 kernel/time/hrtimer.c:1601
>  hrtimer_interrupt+0x330/0xa00 kernel/time/hrtimer.c:1663
>  local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1089 [inline]
>  __sysvec_apic_timer_interrupt+0x146/0x540 arch/x86/kernel/apic/apic.c:1106
>  sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1100
>  asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:632
> 
> The buggy address belongs to the object at ffff8880129a6480
>  which belongs to the cache kmalloc-96 of size 96
> The buggy address is located 56 bytes inside of
>  96-byte region [ffff8880129a6480, ffff8880129a64e0)
> The buggy address belongs to the page:
> page:ffffea00004a6980 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x129a6
> flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
> raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888010841780
> raw: 0000000000000000 0000000000200020 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 9928, ts 107924339577
>  set_page_owner include/linux/page_owner.h:31 [inline]
>  post_alloc_hook+0x161/0x1c0 mm/page_alloc.c:2302
>  prep_new_page mm/page_alloc.c:2311 [inline]
>  get_page_from_freelist+0x1c6f/0x3fb0 mm/page_alloc.c:3951
>  __alloc_pages_nodemask+0x2d6/0x730 mm/page_alloc.c:5001
>  alloc_pages_current+0x18c/0x2a0 mm/mempolicy.c:2277
>  alloc_pages include/linux/gfp.h:561 [inline]
>  alloc_slab_page mm/slub.c:1639 [inline]
>  allocate_slab+0x2c5/0x4c0 mm/slub.c:1779
>  new_slab mm/slub.c:1842 [inline]
>  new_slab_objects mm/slub.c:2588 [inline]
>  ___slab_alloc+0x44c/0x7a0 mm/slub.c:2751
>  __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2791
>  slab_alloc_node mm/slub.c:2872 [inline]
>  slab_alloc mm/slub.c:2916 [inline]
>  __kmalloc+0x2e5/0x300 mm/slub.c:4054
>  kmalloc include/linux/slab.h:561 [inline]
>  io_alloc_async_data fs/io_uring.c:3116 [inline]
>  io_timeout_prep+0x3d9/0x500 fs/io_uring.c:5637
>  io_req_prep fs/io_uring.c:5908 [inline]
>  io_submit_sqe fs/io_uring.c:6576 [inline]
>  io_submit_sqes+0x4e4c/0x6c50 fs/io_uring.c:6734
>  __do_sys_io_uring_enter+0xeaf/0x1d50 fs/io_uring.c:9319
>  do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> page last free stack trace:
>  reset_page_owner include/linux/page_owner.h:24 [inline]
>  free_pages_prepare mm/page_alloc.c:1271 [inline]
>  free_pcp_prepare+0x2cb/0x410 mm/page_alloc.c:1310
>  free_unref_page_prepare mm/page_alloc.c:3205 [inline]
>  free_unref_page+0x12/0x1d0 mm/page_alloc.c:3253
>  qlink_free mm/kasan/quarantine.c:146 [inline]
>  qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
>  kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
>  __kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:437
>  kasan_slab_alloc include/linux/kasan.h:223 [inline]
>  slab_post_alloc_hook mm/slab.h:516 [inline]
>  slab_alloc_node mm/slub.c:2908 [inline]
>  slab_alloc mm/slub.c:2916 [inline]
>  kmem_cache_alloc+0x153/0x370 mm/slub.c:2921
>  getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
>  getname_flags include/linux/audit.h:319 [inline]
>  getname+0x8e/0xd0 fs/namei.c:209
>  do_sys_openat2+0xf5/0x420 fs/open.c:1181
>  do_sys_open fs/open.c:1203 [inline]
>  __do_sys_open fs/open.c:1211 [inline]
>  __se_sys_open fs/open.c:1207 [inline]
>  __x64_sys_open+0x119/0x1c0 fs/open.c:1207
>  do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47
>  entry_SYSCALL_64_after_hwframe+0x44/0xae
> 
> Memory state around the buggy address:
>  ffff8880129a6380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>  ffff8880129a6400: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
>> ffff8880129a6480: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>                                         ^
>  ffff8880129a6500: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>  ffff8880129a6580: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
> ==================================================================
> 
> 
> Tested on:
> 
> commit:         a519b86e io_uring: syz debug output
> git tree:       https://github.com/isilence/linux.git syz_test6
> console output: https://syzkaller.appspot.com/x/log.txt?x=14127779d00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=ae2e6c63d6410fd3
> dashboard link: https://syzkaller.appspot.com/bug?extid=5a864149dd970b546223
> compiler:       
> 

-- 
Pavel Begunkov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [syzbot] WARNING in io_link_timeout_fn
  2021-05-14  0:39         ` Pavel Begunkov
@ 2021-05-14  1:05           ` syzbot
  0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2021-05-14  1:05 UTC (permalink / raw)
  To: asml.silence, axboe, io-uring, linux-fsdevel, linux-kernel,
	syzkaller-bugs, viro

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: [email protected]

Tested on:

commit:         b580b3d6 io_uring: always remove ltimeout on cb run
git tree:       https://github.com/isilence/linux.git syz_test8
kernel config:  https://syzkaller.appspot.com/x/.config?x=ae2e6c63d6410fd3
dashboard link: https://syzkaller.appspot.com/bug?extid=5a864149dd970b546223
compiler:       

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-14  1:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-12 20:28 [syzbot] WARNING in io_link_timeout_fn syzbot
2021-05-12 20:56 ` Jens Axboe
2021-05-12 22:38   ` syzbot
2021-05-13 21:03     ` Pavel Begunkov
2021-05-14  0:08       ` syzbot
2021-05-14  0:39         ` Pavel Begunkov
2021-05-14  1:05           ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox