fuzz: add virtio-blk fuzz target
v2 cover fuzz: add virtio-blk fuzz target
v1 -> v2:
- Update meson build with the CONFIG_VIRTIO_BLK case
- Add "Reviewed-by: Alexander Bulekov" for both patches
Based on the current virtio-scsi-fuzz target implement new virtio-blk fuzz target. Use a virtio_blk_test.c file as a reference for the block device initialization.
Also make a small update to the documentation to fix build/run command lines after meson and build changes in QEMU.
Dima Stepanov (2):
fuzz: add virtio-blk fuzz target
docs/fuzz: update make and run command lines
docs/devel/fuzzing.txt | 6 +- tests/qtest/fuzz/meson.build | 1 + tests/qtest/fuzz/virtio_blk_fuzz.c | 234 +++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+), 3 deletions(-) create mode 100644 tests/qtest/fuzz/virtio_blk_fuzz.c
Signature · 1 line
2.7.4
PATCH v2 1/2 fuzz: add virtio-blk fuzz target
The virtio-blk fuzz target sets up and fuzzes the available virtio-blk queues. The implementation is based on two files:
- tests/qtest/fuzz/virtio_scsi_fuzz.c
- tests/qtest/virtio_blk_test.c
--- tests/qtest/fuzz/meson.build | 1 + tests/qtest/fuzz/virtio_blk_fuzz.c | 234 +++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 tests/qtest/fuzz/virtio_blk_fuzz.c
tests/qtest/fuzz/meson.build +1 -0
@@ -5,6 +5,7 @@ specific_fuzz_ss.add(files('fuzz.c', 'fork_fuzz.c', 'qos_fuzz.c', specific_fuzz_ss.add(when: 'CONFIG_I440FX', if_true: files('i440fx_fuzz.c')) specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio_net_fuzz.c')) specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_SCSI', if_true: files('virtio_scsi_fuzz.c')) +specific_fuzz_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio_blk_fuzz.c')) specific_fuzz_ss.add(files('generic_fuzz.c')) fork_fuzz = declare_dependency(
tests/qtest/fuzz/virtio_blk_fuzz.c new file +234 -0
234 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 5 lines · Dima Stepanov
The virtio-blk fuzz target sets up and fuzzes the available virtio-blk queues. The implementation is based on two files:
-tests/qtest/fuzz/virtio_scsi_fuzz.c
-tests/qtest/virtio_blk_test.c
Quoted 7 lines
Signed-off-by Dima Stepanov <[email protected]>Reviewed-by Alexander Bulekov <[email protected]>--- tests/qtest/fuzz/meson.build | 1 + tests/qtest/fuzz/virtio_blk_fuzz.c | 234 +++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 tests/qtest/fuzz/virtio_blk_fuzz.c
Thanks, I can add this to my next qtest-related pull request.
Note: I just spotted your patch by accident ... please put me on CC: if you want me to merge qtest/fuzzer related patches.
Thomas
Quoted 14 lines · Thomas Huth
Quoted 5 lines · Dima Stepanov
The virtio-blk fuzz target sets up and fuzzes the available virtio-blk queues. The implementation is based on two files:
-tests/qtest/fuzz/virtio_scsi_fuzz.c
-tests/qtest/virtio_blk_test.cQuoted 7 lines
Signed-off-by Dima Stepanov <[email protected]>Reviewed-by Alexander Bulekov <[email protected]>--- tests/qtest/fuzz/meson.build | 1 + tests/qtest/fuzz/virtio_blk_fuzz.c | 234 +++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 tests/qtest/fuzz/virtio_blk_fuzz.c
Quoted 3 lines
Thanks, I can add this to my next qtest-related pull request.
Note: I just spotted your patch by accident ... please put me on CC: if you want me to merge qtest/fuzzer related patches.
Hi Thomas,
Thanks for handling it. Got it! Will add you to CC for the next fuzzing pull requests.
Dima.
Quoted 3 lines
Thomas
PATCH v2 2/2 docs/fuzz: update make and run command lines
In reply to Dima StepanovAfter meson and some other build changes the qemu fuzz target should be build as:
make qemu-fuzz-i386
And also update the run path command line.
--- docs/devel/fuzzing.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
docs/devel/fuzzing.txt +3 -3
@@ -32,15 +32,15 @@ such as out-of-bounds accesses, use-after-frees, double-frees etc. Fuzz targets are built similarly to system/softmmu: - make i386-softmmu/fuzz + make qemu-fuzz-i386 -This builds ./i386-softmmu/qemu-fuzz-i386 +This builds ./build/qemu-fuzz-i386 The first option to this command is: --fuzz-target=FUZZ_NAME To list all of the available fuzzers run qemu-fuzz-i386 with no arguments. For example: - ./i386-softmmu/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz + ./build/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz Internally, libfuzzer parses all arguments that do not begin with "--". Information about these is available by passing -help=1
Signature · 1 line
2.7.4
Re: [PATCH v2 2/2] docs/fuzz: update make and run command lines
Quoted 24 lines · Dima Stepanov
After meson and some other build changes the qemu fuzz target should be build as:
make qemu-fuzz-i386
And also update the run path command line.Signed-off-by Dima Stepanov <[email protected]>Reviewed-by Alexander Bulekov <[email protected]>--- docs/devel/fuzzing.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)docs/devel/fuzzing.txt +2
-2@@ -32,15 +32,15 @@ such as out-of-bounds accesses, use-after-frees, double-frees etc. Fuzz targets are built similarly to system/softmmu: - make i386-softmmu/fuzz + make qemu-fuzz-i386 -This builds ./i386-softmmu/qemu-fuzz-i386 +This builds ./build/qemu-fuzz-i386
docs/devel/fuzzing.txt such as out-of-bounds accesses, use-after-frees, double-frees etc. · line 46
Quoted 10 lines
docs/devel/fuzzing.txt +1
-1The first option to this command is: --fuzz-target=FUZZ_NAME To list all of the available fuzzers run qemu-fuzz-i386 with no arguments. For example: - ./i386-softmmu/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz + ./build/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz Internally, libfuzzer parses all arguments that do not begin with "--". Information about these is available by passing -help=1
This conflicts with Alexander's "docs/fuzz: update fuzzing documentation post-meson" patch ... which one should be used? One is better for people who do in-tree builds, the other is better for people who do out-of-tree builds ... I'll go with Alexander's version for now for my next pull-request, since the text in this file says "/path/to/configure" which rather indicate out-of-tree builds, but in the long run, it would maybe be good to add some clarifying sentences here...
Thomas
Re: [PATCH v2 2/2] docs/fuzz: update make and run command lines
Quoted 33 lines · Thomas Huth
Quoted 32 lines · Dima Stepanov
After meson and some other build changes the qemu fuzz target should be build as:
make qemu-fuzz-i386
And also update the run path command line.Signed-off-by Dima Stepanov <[email protected]>Reviewed-by Alexander Bulekov <[email protected]>--- docs/devel/fuzzing.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)docs/devel/fuzzing.txt +3
-3@@ -32,15 +32,15 @@ such as out-of-bounds accesses, use-after-frees, double-frees etc. Fuzz targets are built similarly to system/softmmu: - make i386-softmmu/fuzz + make qemu-fuzz-i386 -This builds ./i386-softmmu/qemu-fuzz-i386 +This builds ./build/qemu-fuzz-i386 The first option to this command is: --fuzz-target=FUZZ_NAME To list all of the available fuzzers run qemu-fuzz-i386 with no arguments. For example: - ./i386-softmmu/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz + ./build/qemu-fuzz-i386 --fuzz-target=virtio-scsi-fuzz
Quoted 6 lines
docs/devel/fuzzing.txt such as out-of-bounds accesses, use-after-frees, double-frees etc. · line 46
Quoted 2 lines
docs/devel/fuzzing.txt +0
-0Internally, libfuzzer parses all arguments that do not begin with "--". Information about these is available by passing -help=1This conflicts with Alexander's "docs/fuzz: update fuzzing documentation post-meson" patch ... which one should be used? One is better for people who do in-tree builds, the other is better for people who do out-of-tree builds
Ah my bad - I forgot that Dima also sent in fixes to these instructions.
Quoted 5 lines
... I'll go with Alexander's version for now for my next pull-request, since the text in this file says "/path/to/configure" which rather indicate out-of-tree builds, but in the long run, it would maybe be good to add some clarifying sentences here...
Sounds good - I'll add more context/clarification to these instructions later.
- Alex
Quoted 3 lines
Thomas