fuzz: adapt block_fuzzer for Block::new features param

The Block::new() function now requires the base virtio features to be
passed as the first parameter; add it to the block fuzzer to fix the
fuzzer build.

BUG=chromium:1139427
TEST=`FEATURES=test USE='asan fuzz' emerge-amd64-generic crosvm`

Change-Id: Ia8afd1e38b7bb2bf55dfc18805684e3c462e66a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2477250
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel Verkamp 2020-10-15 16:48:20 -07:00 committed by Manoj Gupta
parent 3038e40a6b
commit 298f1724a1

View file

@ -12,7 +12,7 @@ use std::sync::Arc;
use base::Event;
use cros_fuzz::fuzz_target;
use devices::virtio::{Block, Interrupt, Queue, VirtioDevice};
use devices::virtio::{base_features, Block, Interrupt, Queue, VirtioDevice};
use tempfile;
use vm_memory::{GuestAddress, GuestMemory};
@ -79,8 +79,10 @@ fuzz_target!(|bytes| {
let queue_fd = queue_evts[0].as_raw_fd();
let queue_evt = unsafe { Event::from_raw_fd(libc::dup(queue_fd)) };
let features = base_features();
let disk_file = tempfile::tempfile().unwrap();
let mut block = Block::new(Box::new(disk_file), false, true, 512, None).unwrap();
let mut block = Block::new(features, Box::new(disk_file), false, true, 512, None).unwrap();
block.activate(
mem,