[syzbot] [io-uring?] general protection fault in io_get_cqe_overflow

7 views
Skip to first unread message

syzbot

unread,
Oct 2, 2023, 10:38:03 AM10/2/23
to asml.s...@gmail.com, ax...@kernel.dk, io-u...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 9f3ebbef746f Merge tag '6.6-rc3-ksmbd-server-fixes' of git..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1149528a680000
kernel config: https://syzkaller.appspot.com/x/.config?x=12da82ece7bf46f9
dashboard link: https://syzkaller.appspot.com/bug?extid=efc45d4e7ba6ab4ef1eb
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=128b2062680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=128da28a680000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6347b8b20dfc/disk-9f3ebbef.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/30d3cf579ba8/vmlinux-9f3ebbef.xz
kernel image: https://storage.googleapis.com/syzbot-assets/99f0fa64b776/bzImage-9f3ebbef.xz

The issue was bisected to:

commit f26cc9593581bd734c846bf827401350b36dc3c9
Author: Pavel Begunkov <asml.s...@gmail.com>
Date: Wed Jan 4 01:34:57 2023 +0000

io_uring: lockdep annotate CQ locking

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=10deb67c680000
final oops: https://syzkaller.appspot.com/x/report.txt?x=12deb67c680000
console output: https://syzkaller.appspot.com/x/log.txt?x=14deb67c680000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+efc45d...@syzkaller.appspotmail.com
Fixes: f26cc9593581 ("io_uring: lockdep annotate CQ locking")

general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
CPU: 1 PID: 5030 Comm: syz-executor742 Not tainted 6.6.0-rc3-syzkaller-00146-g9f3ebbef746f #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023
RIP: 0010:io_get_cqe_overflow+0x1f2/0x570 io_uring/io_uring.h:116
Code: fc ff df 80 3c 08 00 74 08 48 89 ef e8 67 54 b2 fd 4c 8b 75 00 49 8d 6e 2c 48 89 e8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 0f 85 18 03 00 00 44 8b 65 00 41 83 e4 04 31 ff
RSP: 0018:ffffc9000398f930 EFLAGS: 00010207
RAX: 0000000000000005 RBX: dffffc0000000000 RCX: dffffc0000000000
RDX: ffff888017a4d940 RSI: 0000000000000020 RDI: 0000000000000000
RBP: 000000000000002c R08: ffffffff84362701 R09: fffff52000731f20
R10: dffffc0000000000 R11: fffff52000731f20 R12: 1ffff1100410b400
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffc9000398f9c0
FS: 0000555555943380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001380 CR3: 000000007d529000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
io_get_cqe io_uring/io_uring.h:132 [inline]
io_fill_cqe_aux io_uring/io_uring.c:884 [inline]
__io_post_aux_cqe+0xe7/0x440 io_uring/io_uring.c:931
io_rsrc_put_work io_uring/rsrc.c:156 [inline]
io_rsrc_node_ref_zero+0x219/0x570 io_uring/rsrc.c:191
io_put_rsrc_node io_uring/rsrc.h:112 [inline]
io_queue_rsrc_removal+0x4a0/0x5c0 io_uring/rsrc.c:667
__io_sqe_buffers_update io_uring/rsrc.c:469 [inline]
__io_register_rsrc_update+0x828/0x1430 io_uring/rsrc.c:499
io_register_rsrc_update+0x1cd/0x220 io_uring/rsrc.c:530
__do_sys_io_uring_register io_uring/io_uring.c:4587 [inline]
__se_sys_io_uring_register+0x78f/0x1470 io_uring/io_uring.c:4547
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fddb16c14e9
Code: 48 83 c4 28 c3 e8 37 17 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe58601a08 EFLAGS: 00000246 ORIG_RAX: 00000000000001ab
RAX: ffffffffffffffda RBX: 0000000000006ba5 RCX: 00007fddb16c14e9
RDX: 0000000020001600 RSI: 0000000000000010 RDI: 0000000000000003
RBP: 0000000000000003 R08: 00000000000ac5f8 R09: 00000000000ac5f8
R10: 0000000000000020 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffe58601bd8 R14: 0000000000000001 R15: 0000000000000001
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:io_get_cqe_overflow+0x1f2/0x570 io_uring/io_uring.h:116
Code: fc ff df 80 3c 08 00 74 08 48 89 ef e8 67 54 b2 fd 4c 8b 75 00 49 8d 6e 2c 48 89 e8 48 c1 e8 03 48 bb 00 00 00 00 00 fc ff df <0f> b6 04 18 84 c0 0f 85 18 03 00 00 44 8b 65 00 41 83 e4 04 31 ff
RSP: 0018:ffffc9000398f930 EFLAGS: 00010207
RAX: 0000000000000005 RBX: dffffc0000000000 RCX: dffffc0000000000
RDX: ffff888017a4d940 RSI: 0000000000000020 RDI: 0000000000000000
RBP: 000000000000002c R08: ffffffff84362701 R09: fffff52000731f20
R10: dffffc0000000000 R11: fffff52000731f20 R12: 1ffff1100410b400
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffc9000398f9c0
FS: 0000555555943380(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020001380 CR3: 000000007d529000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 2 bytes skipped:
0: df 80 3c 08 00 74 filds 0x7400083c(%rax)
6: 08 48 89 or %cl,-0x77(%rax)
9: ef out %eax,(%dx)
a: e8 67 54 b2 fd call 0xfdb25476
f: 4c 8b 75 00 mov 0x0(%rbp),%r14
13: 49 8d 6e 2c lea 0x2c(%r14),%rbp
17: 48 89 e8 mov %rbp,%rax
1a: 48 c1 e8 03 shr $0x3,%rax
1e: 48 bb 00 00 00 00 00 movabs $0xdffffc0000000000,%rbx
25: fc ff df
* 28: 0f b6 04 18 movzbl (%rax,%rbx,1),%eax <-- trapping instruction
2c: 84 c0 test %al,%al
2e: 0f 85 18 03 00 00 jne 0x34c
34: 44 8b 65 00 mov 0x0(%rbp),%r12d
38: 41 83 e4 04 and $0x4,%r12d
3c: 31 ff xor %edi,%edi


---
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 syzk...@googlegroups.com.

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

If the bug is already fixed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

Jens Axboe

unread,
Oct 2, 2023, 11:20:20 AM10/2/23
to syzbot, asml.s...@gmail.com, io-u...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
diff --git a/io_uring/io_uring.h b/io_uring/io_uring.h
index 547c30582fb8..6206ae73412a 100644
--- a/io_uring/io_uring.h
+++ b/io_uring/io_uring.h
@@ -86,21 +86,6 @@ bool __io_alloc_req_refill(struct io_ring_ctx *ctx);
bool io_match_task_safe(struct io_kiocb *head, struct task_struct *task,
bool cancel_all);

-#define io_lockdep_assert_cq_locked(ctx) \
- do { \
- lockdep_assert(in_task()); \
- \
- if (ctx->flags & IORING_SETUP_IOPOLL) { \
- lockdep_assert_held(&ctx->uring_lock); \
- } else if (!ctx->task_complete) { \
- lockdep_assert_held(&ctx->completion_lock); \
- } else if (ctx->submitter_task->flags & PF_EXITING) { \
- lockdep_assert(current_work()); \
- } else { \
- lockdep_assert(current == ctx->submitter_task); \
- } \
- } while (0)
-
static inline void io_req_task_work_add(struct io_kiocb *req)
{
__io_req_task_work_add(req, 0);
@@ -113,8 +98,6 @@ static inline bool io_get_cqe_overflow(struct io_ring_ctx *ctx,
struct io_uring_cqe **ret,
bool overflow)
{
- io_lockdep_assert_cq_locked(ctx);
-
if (unlikely(ctx->cqe_cached >= ctx->cqe_sentinel)) {
if (unlikely(!io_cqe_cache_refill(ctx, overflow)))
return false;

--
Jens Axboe

Jens Axboe

unread,
Oct 2, 2023, 10:02:29 PM10/2/23
to syzbot, asml.s...@gmail.com, io-u...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
#syz test: git://git.kernel.dk/linux.git io_uring-6.6

--
Jens Axboe

syzbot

unread,
Oct 2, 2023, 10:19:35 PM10/2/23
to asml.s...@gmail.com, ax...@kernel.dk, io-u...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

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

Reported-and-tested-by: syzbot+efc45d...@syzkaller.appspotmail.com

Tested on:

commit: 163521f0 io_uring: ensure io_lockdep_assert_cq_locked(..
git tree: git://git.kernel.dk/linux.git io_uring-6.6
console output: https://syzkaller.appspot.com/x/log.txt?x=1674879e680000
kernel config: https://syzkaller.appspot.com/x/.config?x=df91a3034fe3f122
dashboard link: https://syzkaller.appspot.com/bug?extid=efc45d4e7ba6ab4ef1eb
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Note: no patches were applied.
Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages