[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7103fcd2-904d-42ac-b5f4-e821697b72f0@kernel.dk>
Date: Sun, 15 Jun 2025 08:08:06 -0600
From: Jens Axboe <axboe@...nel.dk>
To: syzbot <syzbot+cb4bf3cb653be0d25de8@...kaller.appspotmail.com>,
asml.silence@...il.com, io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [io-uring?] WARNING in io_register_clone_buffers
On 6/15/25 1:35 AM, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: d7fa1af5b33e Merge branch 'for-next/core' into for-kernelci
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> console output: https://syzkaller.appspot.com/x/log.txt?x=13db6682580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=89c13de706fbf07a
> dashboard link: https://syzkaller.appspot.com/bug?extid=cb4bf3cb653be0d25de8
> compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
> userspace arch: arm64
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15cab60c580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10c9a60c580000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/da97ad659b2c/disk-d7fa1af5.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/659e123552a8/vmlinux-d7fa1af5.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/6ec5dbf4643e/Image-d7fa1af5.gz.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+cb4bf3cb653be0d25de8@...kaller.appspotmail.com
>
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 6488 at mm/slub.c:5024 __kvmalloc_node_noprof+0x520/0x640 mm/slub.c:5024
> Modules linked in:
> CPU: 0 UID: 0 PID: 6488 Comm: syz-executor312 Not tainted 6.15.0-rc7-syzkaller-gd7fa1af5b33e #0 PREEMPT
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
> pc : __kvmalloc_node_noprof+0x520/0x640 mm/slub.c:5024
> lr : __do_kmalloc_node mm/slub.c:-1 [inline]
> lr : __kvmalloc_node_noprof+0x3b4/0x640 mm/slub.c:5012
> sp : ffff80009cfd7a90
> x29: ffff80009cfd7ac0 x28: ffff0000dd52a120 x27: 0000000000412dc0
> x26: 0000000000000178 x25: ffff7000139faf70 x24: 0000000000000000
> x23: ffff800082f4cea8 x22: 00000000ffffffff x21: 000000010cd004a8
> x20: ffff0000d75816c0 x19: ffff0000dd52a000 x18: 00000000ffffffff
> x17: ffff800092f39000 x16: ffff80008adbe9e4 x15: 0000000000000005
> x14: 1ffff000139faf1c x13: 0000000000000000 x12: 0000000000000000
> x11: ffff7000139faf21 x10: 0000000000000003 x9 : ffff80008f27b938
> x8 : 0000000000000002 x7 : 0000000000000000 x6 : 0000000000000000
> x5 : 00000000ffffffff x4 : 0000000000400dc0 x3 : 0000000200000000
> x2 : 000000010cd004a8 x1 : ffff80008b3ebc40 x0 : 0000000000000001
> Call trace:
> __kvmalloc_node_noprof+0x520/0x640 mm/slub.c:5024 (P)
> kvmalloc_array_node_noprof include/linux/slab.h:1065 [inline]
> io_rsrc_data_alloc io_uring/rsrc.c:206 [inline]
> io_clone_buffers io_uring/rsrc.c:1178 [inline]
> io_register_clone_buffers+0x484/0xa14 io_uring/rsrc.c:1287
> __io_uring_register io_uring/register.c:815 [inline]
> __do_sys_io_uring_register io_uring/register.c:926 [inline]
> __se_sys_io_uring_register io_uring/register.c:903 [inline]
> __arm64_sys_io_uring_register+0x42c/0xea8 io_uring/register.c:903
> __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
> invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49
> el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132
> do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151
> el0_svc+0x58/0x17c arch/arm64/kernel/entry-common.c:767
> el0t_64_sync_handler+0x78/0x108 arch/arm64/kernel/entry-common.c:786
> el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600
> irq event stamp: 370
> hardirqs last enabled at (369): [<ffff8000801fc600>] local_daif_restore+0x1c/0x3c arch/arm64/include/asm/daifflags.h:75
> hardirqs last disabled at (370): [<ffff80008adb9eb8>] el1_dbg+0x24/0x80 arch/arm64/kernel/entry-common.c:511
> softirqs last enabled at (294): [<ffff8000803cf71c>] softirq_handle_end kernel/softirq.c:425 [inline]
> softirqs last enabled at (294): [<ffff8000803cf71c>] handle_softirqs+0xaf8/0xc88 kernel/softirq.c:607
> softirqs last disabled at (289): [<ffff800080020efc>] __do_softirq+0x14/0x20 kernel/softirq.c:613
> ---[ end trace 0000000000000000 ]---
Max buffer count is validated, but buffer count + offset is not.
That can lead to attempting to do a big alloc, below should
fix it.
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index c592ceace97d..94a9db030e0e 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -1177,6 +1177,8 @@ static int io_clone_buffers(struct io_ring_ctx *ctx, struct io_ring_ctx *src_ctx
return -EINVAL;
if (check_add_overflow(arg->nr, arg->dst_off, &nbufs))
return -EOVERFLOW;
+ if (nbufs > IORING_MAX_REG_BUFFERS)
+ return -EINVAL;
ret = io_rsrc_data_alloc(&data, max(nbufs, ctx->buf_table.nr));
if (ret)
--
Jens Axboe
Powered by blists - more mailing lists