Re: [syzbot] [io-uring?] general protection fault in __io_remove_buffers

From: syzbot
Date: Thu Jul 18 2024 - 14:03:16 EST


> On 7/18/24 02:20, syzbot wrote:
>> Hello,
>>
>> syzbot found the following issue on:
>>
>> HEAD commit: d67978318827 Merge tag 'x86_cpu_for_v6.11_rc1' of git://gi..
>> git tree: upstream
>> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1178e9e9980000
>> kernel config: https://syzkaller.appspot.com/x/.config?x=e206d588252bd3ff
>> dashboard link: https://syzkaller.appspot.com/bug?extid=2074b1a3d447915c6f1c
>> 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=10e07d9e980000
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16adf045980000
>>
>> Downloadable assets:
>> disk image: https://storage.googleapis.com/syzbot-assets/f34b31760156/disk-d6797831.raw.xz
>> vmlinux: https://storage.googleapis.com/syzbot-assets/a92e51d8d32e/vmlinux-d6797831.xz
>> kernel image: https://storage.googleapis.com/syzbot-assets/000a6a162550/bzImage-d6797831.xz
>>
>> The issue was bisected to:
>>
>> commit 87585b05757dc70545efb434669708d276125559
>> Author: Jens Axboe <axboe@xxxxxxxxx>
>> Date: Wed Mar 13 02:24:21 2024 +0000
>>
>> io_uring/kbuf: use vm_insert_pages() for mmap'ed pbuf ring
> Easily reproducible, the diff helps
>
> #syz test:

want either no args or 2 args (repo, branch), got 4

>
>
> diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
> index d2945c9c812b..c95dc1736dd9 100644
> --- a/io_uring/kbuf.c
> +++ b/io_uring/kbuf.c
> @@ -657,8 +657,10 @@ static int io_alloc_pbuf_ring(struct io_ring_ctx *ctx,
> ring_size = reg->ring_entries * sizeof(struct io_uring_buf_ring);
>
> bl->buf_ring = io_pages_map(&bl->buf_pages, &bl->buf_nr_pages, ring_size);
> - if (!bl->buf_ring)
> + if (IS_ERR(bl->buf_ring)) {
> + bl->buf_ring = NULL;
> return -ENOMEM;
> + }
>
> bl->is_buf_ring = 1;
> bl->is_mmap = 1;
>