Re: INFO: trying to register non-static key in io_cqring_ev_posted (3)

2020-05-17 Thread Jens Axboe
On 5/16/20 10:30 PM, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:ac935d22 Add linux-next specific files for 20200415
> git tree:   linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=12deaa5e10
> kernel config:  https://syzkaller.appspot.com/x/.config?x=bc498783097e9019
> dashboard link: https://syzkaller.appspot.com/bug?extid=8c91f5d054e998721c57
> compiler:   gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=11d54c0210
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17461e0610
> 
> The bug was bisected to:
> 
> commit b41e98524e424d104aa7851d54fd65820759875a
> Author: Jens Axboe 
> Date:   Mon Feb 17 16:52:41 2020 +
> 
> io_uring: add per-task callback handler
> 
> bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=1488dc3c10
> final crash:https://syzkaller.appspot.com/x/report.txt?x=1688dc3c10
> console output: https://syzkaller.appspot.com/x/log.txt?x=1288dc3c10
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+8c91f5d054e998721...@syzkaller.appspotmail.com
> Fixes: b41e98524e42 ("io_uring: add per-task callback handler")
> 
> RSP: 002b:7fffb1fb9aa8 EFLAGS: 0246 ORIG_RAX: 01a9
> RAX: ffda RBX:  RCX: 00441319
> RDX: 0001 RSI: 2140 RDI: 047b
> RBP: 00010475 R08: 0001 R09: 004002c8
> R10:  R11: 0246 R12: 00402260
> R13: 004022f0 R14:  R15: 
> INFO: trying to register non-static key.
> the code is fine but needs lockdep annotation.
> turning off the locking correctness validator.
> CPU: 1 PID: 7090 Comm: syz-executor222 Not tainted 
> 5.7.0-rc1-next-20200415-syzkaller #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+0x188/0x20d lib/dump_stack.c:118
>  assign_lock_key kernel/locking/lockdep.c:913 [inline]
>  register_lock_class+0x1664/0x1760 kernel/locking/lockdep.c:1225
>  __lock_acquire+0x104/0x4c50 kernel/locking/lockdep.c:4234
>  lock_acquire+0x1f2/0x8f0 kernel/locking/lockdep.c:4934
>  __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
>  _raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:159
>  __wake_up_common_lock+0xb4/0x130 kernel/sched/wait.c:122
>  io_cqring_ev_posted+0xa5/0x1e0 fs/io_uring.c:1160
>  io_poll_remove_all fs/io_uring.c:4357 [inline]
>  io_ring_ctx_wait_and_kill+0x2bc/0x5a0 fs/io_uring.c:7305
>  io_uring_create fs/io_uring.c:7843 [inline]
>  io_uring_setup+0x115e/0x22b0 fs/io_uring.c:7870
>  do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
>  entry_SYSCALL_64_after_hwframe+0x49/0xb3

I think this will likely fix it.


diff --git a/fs/io_uring.c b/fs/io_uring.c
index 70ae7e840c85..79c90eb28c0d 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -924,6 +924,7 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct 
io_uring_params *p)
goto err;
 
ctx->flags = p->flags;
+   init_waitqueue_head(>sqo_wait);
init_waitqueue_head(>cq_wait);
INIT_LIST_HEAD(>cq_overflow_list);
init_completion(>completions[0]);
@@ -6837,7 +6838,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx,
 {
int ret;
 
-   init_waitqueue_head(>sqo_wait);
mmgrab(current->mm);
ctx->sqo_mm = current->mm;
 

-- 
Jens Axboe



INFO: trying to register non-static key in io_cqring_ev_posted (3)

2020-05-16 Thread syzbot
Hello,

syzbot found the following crash on:

HEAD commit:ac935d22 Add linux-next specific files for 20200415
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=12deaa5e10
kernel config:  https://syzkaller.appspot.com/x/.config?x=bc498783097e9019
dashboard link: https://syzkaller.appspot.com/bug?extid=8c91f5d054e998721c57
compiler:   gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=11d54c0210
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17461e0610

The bug was bisected to:

commit b41e98524e424d104aa7851d54fd65820759875a
Author: Jens Axboe 
Date:   Mon Feb 17 16:52:41 2020 +

io_uring: add per-task callback handler

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=1488dc3c10
final crash:https://syzkaller.appspot.com/x/report.txt?x=1688dc3c10
console output: https://syzkaller.appspot.com/x/log.txt?x=1288dc3c10

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+8c91f5d054e998721...@syzkaller.appspotmail.com
Fixes: b41e98524e42 ("io_uring: add per-task callback handler")

RSP: 002b:7fffb1fb9aa8 EFLAGS: 0246 ORIG_RAX: 01a9
RAX: ffda RBX:  RCX: 00441319
RDX: 0001 RSI: 2140 RDI: 047b
RBP: 00010475 R08: 0001 R09: 004002c8
R10:  R11: 0246 R12: 00402260
R13: 004022f0 R14:  R15: 
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
CPU: 1 PID: 7090 Comm: syz-executor222 Not tainted 
5.7.0-rc1-next-20200415-syzkaller #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+0x188/0x20d lib/dump_stack.c:118
 assign_lock_key kernel/locking/lockdep.c:913 [inline]
 register_lock_class+0x1664/0x1760 kernel/locking/lockdep.c:1225
 __lock_acquire+0x104/0x4c50 kernel/locking/lockdep.c:4234
 lock_acquire+0x1f2/0x8f0 kernel/locking/lockdep.c:4934
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x8c/0xbf kernel/locking/spinlock.c:159
 __wake_up_common_lock+0xb4/0x130 kernel/sched/wait.c:122
 io_cqring_ev_posted+0xa5/0x1e0 fs/io_uring.c:1160
 io_poll_remove_all fs/io_uring.c:4357 [inline]
 io_ring_ctx_wait_and_kill+0x2bc/0x5a0 fs/io_uring.c:7305
 io_uring_create fs/io_uring.c:7843 [inline]
 io_uring_setup+0x115e/0x22b0 fs/io_uring.c:7870
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
 entry_SYSCALL_64_after_hwframe+0x49/0xb3
RIP: 0033:0x441319
Code: e8 5c ae 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 
bb 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:7fffb1fb9aa8 EFLAGS: 0246 ORIG_RAX: 01a9
RAX: ffda RBX:  RCX: 00441319
RDX: 0001 RSI: 2140 RDI: 047b
RBP: 00010475 R08: 0001 R09: 004002c8
R10:  R11: 0246 R12: 00402260
R13: 004022f0 R14:  R15: 
general protection fault, probably for non-canonical address 
0xdc00:  [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x-0x0007]
CPU: 1 PID: 7090 Comm: syz-executor222 Not tainted 
5.7.0-rc1-next-20200415-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
RIP: 0010:__read_once_size include/linux/compiler.h:232 [inline]
RIP: 0010:__wake_up_common+0xdc/0x600 kernel/sched/wait.c:86
Code: b9 04 00 00 4c 8b 43 40 49 83 e8 18 49 8d 78 18 48 39 fd 0f 84 d0 00 00 
00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 e3 04 
00 00 49 bd 00 00 00 00 00 fc ff df 4d 8b
RSP: 0018:c90001677c20 EFLAGS: 00010046
RAX: dc00 RBX: 8880a6081120 RCX: 11517002
RDX:  RSI: 0003 RDI: 
RBP: 8880a6081160 R08: ffe8 R09: c90001677cb8
R10: 0003 R11: f520002cef7e R12: 0001
R13:  R14: 0003 R15: 
FS:  0136f880() GS:8880ae70() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 2140 CR3: 936b4000 CR4: 001406e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 __wake_up_common_lock+0xd0/0x130 kernel/sched/wait.c:123
 io_cqring_ev_posted+0xa5/0x1e0 fs/io_uring.c:1160
 io_poll_remove_all fs/io_uring.c:4357 [inline]
 io_ring_ctx_wait_and_kill+0x2bc/0x5a0