Skip to content

block/export: vhost-user-blk server tests and input validation

Stefan Hajnoczi qemu-devel 3 versions – Applied

Status from this message: Thanks, applied to the block branch.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest12 patches 5 repliesApplied
  2. v212 patches 13 repliesSuperseded
  3. v110 patches 16 repliesSuperseded

Changes in v3 from the cover letter

* Rebased onto qemu.git/master (7ef8134565dc)
* I asked Coiby Xu for clarification on a comment about vhost-user-blk-test in v2. Please wait for that discussion to finish before merging.

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/12vhost-user-blk: fix blkcfg->num_queues endiannesshw/block/vhost-user-blk.c+3 -42 replies
2/12libqtest: add qtest_socket_server()tests/qtest/libqos/libqtest.h tests/qtest/libqtest.c+31 -170 replies
3/12libqtest: add qtest_kill_qemu()tests/qtest/libqos/libqtest.h tests/qtest/libqtest.c+15 -31 reply
4/12libqtest: add qtest_remove_abrt_handler()tests/qtest/libqos/libqtest.h tests/qtest/libqtest.c+47 -61 reply
5/12test: new qTest case to test the vhost-user-blk-serverMAINTAINERS tests/qtest/libqos/meson.build tests/qtest/libqos/vhost-user-blk.c +3 more+973 -00 replies
6/12tests/qtest: add multi-queue test case to vhost-user-blk-testtests/qtest/vhost-user-blk-test.c+76 -50 replies
7/12block/export: fix blk_size double byteswapblock/export/vhost-user-blk-server.c+1 -10 replies
8/12block/export: use VIRTIO_BLK_SECTOR_BITSblock/export/vhost-user-blk-server.c+12 -30 replies
9/12block/export: fix vhost-user-blk export sector number calculationblock/export/vhost-user-blk-server.c+1 -10 replies
10/12block/export: port virtio-blk discard/write zeroes input validationblock/export/vhost-user-blk-server.c+93 -230 replies
11/12vhost-user-blk-test: test discard/write zeroes invalid inputstests/qtest/vhost-user-blk-test.c+124 -00 replies
12/12block/export: port virtio-blk read/write range checkblock/export/vhost-user-blk-server.c+16 -30 replies

Reviews trailers per patch

4 of 12 patches have a Reviewed-by or Acked-by.

PatchRaphael NorwitzMichael S. TsirkinWainer dos Santos MoschettaThomas Huth
1/12R-b R-b
2/12R-b R-b
3/12R-b R-b
4/12R-b R-b
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/12] block/export: vhost-user-blk server tests and input validation

v3:
* Rebased onto qemu.git/master (7ef8134565dc)
* I asked Coiby Xu for clarification on a comment about vhost-user-blk-test in v2. Please wait for that discussion to finish before merging.

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.

Coiby Xu (1):
test: new qTest case to test the vhost-user-blk-server

Stefan Hajnoczi (11):
vhost-user-blk: fix blkcfg->num_queues endianness
libqtest: add qtest_socket_server()
libqtest: add qtest_kill_qemu()
libqtest: add qtest_remove_abrt_handler()
tests/qtest: add multi-queue test case to vhost-user-blk-test block/export: fix blk_size double byteswap
block/export: use VIRTIO_BLK_SECTOR_BITS
block/export: fix vhost-user-blk export sector number calculation block/export: port virtio-blk discard/write zeroes input validation
vhost-user-blk-test: test discard/write zeroes invalid inputs block/export: port virtio-blk read/write range check

 MAINTAINERS                          |   2 +
 tests/qtest/libqos/libqtest.h        |  37 +
 tests/qtest/libqos/vhost-user-blk.h  |  48 ++
 block/export/vhost-user-blk-server.c | 150 +++-
 hw/block/vhost-user-blk.c            |   7 +-
 tests/qtest/libqos/vhost-user-blk.c  | 130 ++++
 tests/qtest/libqtest.c               |  82 ++-
 tests/qtest/vhost-user-blk-test.c    | 983 +++++++++++++++++++++++++++
 tests/qtest/libqos/meson.build       |   1 +
 tests/qtest/meson.build              |   4 +
 10 files changed, 1385 insertions(+), 59 deletions(-)
 create mode 100644 tests/qtest/libqos/vhost-user-blk.h
 create mode 100644 tests/qtest/libqos/vhost-user-blk.c
 create mode 100644 tests/qtest/vhost-user-blk-test.c
Signature · 1 line
2.29.2