All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Thomas Huth <thuth@redhat.com>,
	Qemu-block <qemu-block@nongnu.org>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Coiby Xu <coiby.xu@gmail.com>, Max Reitz <mreitz@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Raphael Norwitz <raphael.norwitz@nutanix.com>
Subject: Re: [PATCH v2 00/12] block/export: vhost-user-blk server tests and input validation
Date: Tue, 23 Feb 2021 12:06:12 +0100	[thread overview]
Message-ID: <a0b89aef-e3a7-cfcb-5ca1-1fb83f2a42e7@redhat.com> (raw)
In-Reply-To: <CAFEAcA-Urs8JYHmAC1mbtbSNWhTsKyer=8i9zdSpnsa2eH4i2Q@mail.gmail.com>

On 2/19/21 11:38 PM, Peter Maydell wrote:
> On Mon, 15 Feb 2021 at 10:41, Kevin Wolf <kwolf@redhat.com> wrote:
>>
>> Am 07.12.2020 um 18:20 hat Stefan Hajnoczi geschrieben:
>>> v2:
>>>  * Add abrt handler that terminates qemu-storage-daemon to
>>>    vhost-user-blk-test. No more orphaned processes on test failure. [Peter]
>>>  * Fix sector number calculation in vhost-user-blk-server.c
>>>  * Introduce VIRTIO_BLK_SECTOR_BITS/SIZE to make code clearer [Max]
>>>  * Fix vhost-user-blk-server.c blk_size double byteswap
>>>  * Fix vhost-user-blk blkcfg->num_queues endianness [Peter]
>>>  * Squashed cleanups into Coiby vhost-user-blk-test commit so the code is
>>>    easier to review
>>>
>>> The vhost-user-blk server test was already in Michael Tsirkin's recent vhost
>>> pull request, but was dropped because it exposed vhost-user regressions
>>> (b7c1bd9d7848 and the Based-on tag below). Now that the vhost-user regressions
>>> are fixed we can re-introduce the test case.
>>>
>>> This series adds missing input validation that led to a Coverity report. The
>>> virtio-blk read, write, discard, and write zeroes commands need to check
>>> sector/byte ranges and other inputs. This solves the issue Peter Maydell raised
>>> in "[PATCH for-5.2] block/export/vhost-user-blk-server.c: Avoid potential
>>> integer overflow".
>>>
>>> Merging just the input validation patches would be possible too, but I prefer
>>> to merge the corresponding tests so the code is exercised by the CI.
>>
>> Is this series still open? I don't see it in master.
> 
> The Coverity issue is still unfixed, at any rate...

Copying Coverity report here:

CID 1435956 Unintentional integer overflow

In vu_blk_discard_write_zeroes: An integer overflow occurs, with the
result converted to a wider integer type (CWE-190)

 61 static int coroutine_fn
 62 vu_blk_discard_write_zeroes(BlockBackend *blk, struct iovec *iov,
 63                             uint32_t iovcnt, uint32_t type)
 64 {
 65     struct virtio_blk_discard_write_zeroes desc;
 66     ssize_t size = iov_to_buf(iov, iovcnt, 0, &desc, sizeof(desc));
 67     if (unlikely(size != sizeof(desc))) {
 68         error_report("Invalid size %zd, expect %zu", size,
sizeof(desc));
 69         return -EINVAL;
 70     }
 71
 72     uint64_t range[2] = { le64_to_cpu(desc.sector) << 9,

CID 1435956 (#1 of 1): Unintentional integer overflow
(OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression
le32_to_cpu(desc.num_sectors) << 9 with type uint32_t (32 bits,
unsigned) is evaluated using 32-bit arithmetic, and then used in a
context that expects an expression of type uint64_t (64 bits, unsigned).

 73                           le32_to_cpu(desc.num_sectors) << 9 };



  reply	other threads:[~2021-02-23 11:07 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 17:20 [PATCH v2 00/12] block/export: vhost-user-blk server tests and input validation Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 01/12] vhost-user-blk: fix blkcfg->num_queues endianness Stefan Hajnoczi
2021-01-04  4:01   ` Raphael Norwitz
2021-01-20  9:43   ` Michael S. Tsirkin
2020-12-07 17:20 ` [PATCH v2 02/12] libqtest: add qtest_socket_server() Stefan Hajnoczi
2020-12-18 11:29   ` Thomas Huth
2021-01-04 19:23   ` Wainer dos Santos Moschetta
2020-12-07 17:20 ` [PATCH v2 03/12] libqtest: add qtest_kill_qemu() Stefan Hajnoczi
2021-01-04 19:28   ` Wainer dos Santos Moschetta
2020-12-07 17:20 ` [PATCH v2 04/12] libqtest: add qtest_remove_abrt_handler() Stefan Hajnoczi
2021-01-04 21:02   ` Wainer dos Santos Moschetta
2020-12-07 17:20 ` [PATCH v2 05/12] test: new qTest case to test the vhost-user-blk-server Stefan Hajnoczi
2020-12-18 14:56   ` Coiby Xu
2021-02-23 14:40     ` Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 06/12] tests/qtest: add multi-queue test case to vhost-user-blk-test Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 07/12] block/export: fix blk_size double byteswap Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 08/12] block/export: use VIRTIO_BLK_SECTOR_BITS Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 09/12] block/export: fix vhost-user-blk export sector number calculation Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 10/12] block/export: port virtio-blk discard/write zeroes input validation Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 11/12] vhost-user-blk-test: test discard/write zeroes invalid inputs Stefan Hajnoczi
2020-12-07 17:20 ` [PATCH v2 12/12] block/export: port virtio-blk read/write range check Stefan Hajnoczi
2021-02-15 10:41 ` [PATCH v2 00/12] block/export: vhost-user-blk server tests and input validation Kevin Wolf
2021-02-19 22:38   ` Peter Maydell
2021-02-23 11:06     ` Philippe Mathieu-Daudé [this message]
2021-03-10 15:51     ` Peter Maydell
2021-03-10 16:26       ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a0b89aef-e3a7-cfcb-5ca1-1fb83f2a42e7@redhat.com \
    --to=philmd@redhat.com \
    --cc=coiby.xu@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.