[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite
From: |
Eric Blake |
Subject: |
Re: [PATCH v2 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t |
Date: |
Wed, 18 May 2022 07:48:22 -0500 |
User-agent: |
NeoMutt/20220429-71-6f7d3e |
On Tue, May 17, 2022 at 03:48:59PM +0100, Alberto Faria wrote:
> On Tue, May 17, 2022 at 3:33 PM Eric Blake <eblake@redhat.com> wrote:
> > ...now end up calling QEMU_IOVEC_INIT_BUF() which tries to do
> > .local_iov.iov_len = bytes, which can silently overflow on 32-bit
> > platforms where iov_len is size_t. We need to add a code guard that
> > callers do not pass in too large of a buffer.
>
> I see. blk_co_pread() and blk_co_pwrite() use assert(bytes <=
> SIZE_MAX). Would that be an appropriate safeguard here? Or should we
> return an error?
I'd be okay with the assert.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- [PATCH v2 00/10] Implement bdrv_{pread, pwrite, pwrite_sync, pwrite_zeroes}() using generated_co_wrapper, Alberto Faria, 2022/05/13
- [PATCH v2 01/10] block: Add a 'flags' param to bdrv_{pread, pwrite, pwrite_sync}(), Alberto Faria, 2022/05/13
- [PATCH v2 02/10] block: Change bdrv_{pread, pwrite, pwrite_sync}() param order, Alberto Faria, 2022/05/13
- [PATCH v2 03/10] block: Make bdrv_{pread, pwrite}() return 0 on success, Alberto Faria, 2022/05/13
- [PATCH v2 04/10] crypto: Make block callbacks return 0 on success, Alberto Faria, 2022/05/13
- [PATCH v2 05/10] block: Make bdrv_co_pwrite() take a const buffer, Alberto Faria, 2022/05/13
- [PATCH v2 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t, Alberto Faria, 2022/05/13
- [PATCH v2 07/10] block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapper, Alberto Faria, 2022/05/13
- [PATCH v2 08/10] block: Add bdrv_co_pwrite_sync(), Alberto Faria, 2022/05/13
- [PATCH v2 09/10] block: Use bdrv_co_pwrite_sync() when caller is coroutine_fn, Alberto Faria, 2022/05/13
- [PATCH v2 10/10] block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty(), Alberto Faria, 2022/05/13