Add PCI PM capability to virtio pci devices, and generate PMEs for all
virtio device interrupts. PMEs are GPEs advertised ACPI, so they are x86
only. PCIe PME signalling can be investigated in the future.
This is the VMM side patch to [1], which allows Linux guests to enter
system-wide low power states like s2idle without needing to reset the
virtio devices when PCI PM with No_Soft_Reset is advertised.
[1] https://lore.kernel.org/all/20231208070754.3132339-1-stevensd@chromium.org/
BUG=b:301865273
TEST=Manually enable ARCVM s2idle feature
Change-Id: I6b0a122820c5d6932dc3e181d2fd2852b3640e5e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4666701
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
IoBuf is defined in a platform-specific way (it is either iovec on unix
or WSABUF for windows), so it fits into the mission statement of the
base crate, which is meant to be *the* platform abstraction layer in
crosvm.
IoBufMut and VolatileMemory/VolatileSlice are defined in terms of IoBuf,
so they are also moved into base for consistency. Every crate that uses
these types already depended on base, so no extra dependencies are
added, and a few can be removed.
BUG=b:312312646
TEST=tools/dev_container tools/presubmit
Change-Id: I4dddc55d46906dfc55b88e8e6a967d7e1c1922dd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5046605
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Updates are made to source and documentation.
This more accurately represents the currently supported platforms of
Android/Linux and Windows, without unexpectedly including other
unix-like operating systems.
Command to reproduce:
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -i 's/cfg(unix)/cfg(any(target_os = "android", target_os = "linux"))/g' {}
$ cargo fmt
md files manually updated to fix line lengths.
Renaming `unix` modules to `linux` will be done in a later CL.
Test: ./tools/dev_container ./tools/presubmit
Bug: b/298269162
Change-Id: I42c1bf0abf80b9a0df25551613910293217c7295
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4909059
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Currently, crosvm running with --bios <OVMF executable> will only boot
from available block devices if started with a clean BIOS pflash. If
crosvm is not run with a clean pflash, OVMF will get confused and refuse
to boot. The reason for this behavior is that OVMF expects a "bootorder"
file to be present in the fw_cfg device to calibrate its boot order.
This CL allows fw_cfg to specify bootorder, solving the inconsistent
booting behavior. Boot order is specified from the command line with the
bootindex=NUM argument.The bootindex argument is available for block
devices specified with the --block flag. Note that the --fw-cfg flag
must be specified w/ at least on file (can be an empty file with a
random name) on the command line for fw_cfg to actually be made
available to the guest. Also, further investigation is needed if we wish
to boot from pmem devices in the future. See crosvm run -h for more
information about the bootindex argument.
BUG=b:243051819
Change-Id: Ieae1e2cacc14c018832b228db898884281c38a96
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4755415
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Sebastian Hereu <sebastianhereu@google.com>
This cleans up the activate() signature and avoids the need to pass two
related (Queue, Event) variables everywhere a queue is needed.
No functional change intended.
BUG=None
TEST=tools/dev_container tools/presubmit
Change-Id: I9e5259428b39ad3a677fbb8a0bf574b3f15a7f35
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4738991
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Now that an active Queue is a separate type than the pre-activation
QueueConfig, we can ensure that a Queue has a valid reference to the
GuestMemory at creation time instead of passing it to every queue
operation.
No functional change, but simplifies Queue callers and prepares for
use of AtomicU* types in a later change.
BUG=b:264931437
TEST=tools/dev_container tools/presubmit
Change-Id: I30266a5eadbd4f643da5595fbdd2c8f5df34bab3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4671481
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
To support packed virtqueue in block device, add packed-queue runtime
flag to block device. If flag is set true, block deivice uses packed
virtqueue. If flag is not set or set to false, block device use split
virtqueue as default.
BUG=b:243621596
TEST=crosvm run —block ”…,packed-queue=true”
Change-Id: Iaca015392103858e06c9368553540ba937ec3b3d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4648470
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
This reverts commit 0efcbc5a46.
Reason for revert: Adjusted virtio-balloon code to match linux and qemu behavior instead of the virtio spec
Original change's description:
> Revert "virtio: pass explicit queue indices on device activation"
>
> This reverts commit 6199bb371a.
>
> Reason for revert: it broke virtio-balloon on ChromeOS
>
> Original change's description:
> > virtio: pass explicit queue indices on device activation
> >
> > In some cases, I changed the code to actually use the explicit indices
> > defined by the virito spec. In other cases, I was lazy and used
> > `pop_first` to emulate the old behavior.
> >
> > Change-Id: I9f1e4b6681e84b54ddca19e4d41c6508404fce4b
> > Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4697479
> > Reviewed-by: Noah Gold <nkgold@google.com>
> > Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> > Commit-Queue: Frederick Mayle <fmayle@google.com>
>
> Change-Id: I13ac499308f29d8a6a226e98d0eb4748b8e60944
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4705624
> Commit-Queue: Frederick Mayle <fmayle@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Test: use kernel with CONFIG_VIRTIO_BALLOON=y and boot crosvm with --balloon-page-reporting
Change-Id: I59691b1a9c60a44708a0e6c5c05e77e122675934
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4706390
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
This reverts commit 6199bb371a.
Reason for revert: it broke virtio-balloon on ChromeOS
Original change's description:
> virtio: pass explicit queue indices on device activation
>
> In some cases, I changed the code to actually use the explicit indices
> defined by the virito spec. In other cases, I was lazy and used
> `pop_first` to emulate the old behavior.
>
> Change-Id: I9f1e4b6681e84b54ddca19e4d41c6508404fce4b
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4697479
> Reviewed-by: Noah Gold <nkgold@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Commit-Queue: Frederick Mayle <fmayle@google.com>
Change-Id: I13ac499308f29d8a6a226e98d0eb4748b8e60944
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4705624
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
In some cases, I changed the code to actually use the explicit indices
defined by the virito spec. In other cases, I was lazy and used
`pop_first` to emulate the old behavior.
Change-Id: I9f1e4b6681e84b54ddca19e4d41c6508404fce4b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4697479
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
This change creates a new type (QueueConfig) that represents a queue
configuration before it has been activated. The QueueConfig::activate
function serves the same purpose as the previous Queue::activate, but
now it also returns the Queue type, which now always represents an
actively running queue.
BUG=b:290268617
TEST=tools/dev_container tools/presubmit
Change-Id: I502ac6b29bf9f0cfc33ef15f6fb7fe482214eafd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4111872
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Previously, devices used the split virtqueue implemented in
/src/virtio/queue.rs by default. In order to support packed virtqueue in
the future, we implemented the enum type for virtqueue to abstract over
different virtqueue types. We migrated existing split virtqueue to a new
mod in /src/virtio/queue/ directory.
To support different types of virtqueue for each device, we enhanced
virtio_device trait by defining queue_type method to decide which
virtqueue type the device should use. We also modified base_feature function to accept queue type as a parameter.
BUG=b:243621596
TEST=tools/dev_container tools/presubmit
Change-Id: If6cb3e3dd93a7ee3621e54a95742f6f9a524c79b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4648252
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
Exercise more of the virtqueue descriptor chain API by consuming the
reader and writer. This also makes the fuzzer match the real-world usage
of the DescriptorChain APIs.
BUG=None
TEST=cargo +nightly fuzz run virtqueue_fuzzer
Change-Id: Ic56362cda87dd482a7c8fa6b3dd89cebfee8bc30
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4553720
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This simplifies `cargo fuzz` usage. Fuzzers can be built with
`cargo fuzz build` without any other arguments.
BUG=b:279217867
TEST=`cargo fuzz build`
Change-Id: I11b8a8ba4c2b3e2d1a42973699e4d9c3920635b6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4540001
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This change contains the results of running
./tools/contib/cargo_refactor.py
This will break the next uprev, and needs to be synchronizized
with the corresponding ebuild changes in https://crrev.com/c/3248925
BUG=b:195126527
TEST=./tools/run_tests
Change-Id: Ied15a1841887bb8f59fba65b912b81acf69beb73
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3248129
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Use the crates.io implementation of tempfile instead of our own version.
Our reimplementation is kept in the tree for now in case of dependencies
outside of the crosvm tree; it can be removed later once those are fully
switched over to the crates.io implementation.
BUG=b:199204746
TEST=emerge-hatch crosvm
Change-Id: I07d3404239302ab9a17f4ddc82a9479b256e4eb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3209839
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Impose a limit on the maximum nesting of file formats that can open more
files. For example, a qcow2 file can have a backing file, which could be
another qcow2 file with a backing file (or even the same file as the
original), potentially causing unbounded recursion.
BUG=b:198326611
TEST=cros_fuzz
Change-Id: I2f8573a7c71c6d8b310f2c2a75a240f2f8f0c9b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3146214
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
denniskempin will inherit fuzzing or find someone to.
Change-Id: Icb4dc76949726c0d958dab41228ba848ec292c94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2988148
Auto-Submit: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
I don't really remember why the fuzz crate needed to be a separate
workspace and doing it that way seems to break our fuzzer builds so just
move it into crosvm's workspace.
BUG=none
TEST=USE="asan fuzzer" emerge-amd64-generic crosvm
Cq-Depend: chromium:2777911
Change-Id: Ibb0e2de14189683ee5af501392594230996accc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2772678
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
- Add an address space region for the protected KVM firmware.
- Query firmware size, mmap something that size and create a memslot.
BUG=b:163789172
TEST=cargo test
Change-Id: I054cf5d763c980d073c17bce70e85a781816b64d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2623942
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Andrew Walbran <qwandor@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Allow the user to specify a serial number for each virtio block device
using the new id= parameter:
crosvm run --disk disk.img,id=SERIALNO ...
These serial numbers show up in sysfs for each block device, which
allows them to be uniquely identified regardless of the number or order
of block devices added on the crosvm command line. This can be used to
find a specific device by serial number for mounting at boot time.
BUG=b:157687637
BUG=chromium:775781
TEST=crosvm run -r vm_rootfs.img,id=root -p init=/bin/bash vm_kernel
TEST=cat /sys/block/vda/serial # see serial is set to "root"
TEST=cargo test -p devices
Change-Id: I108cdc47c367fb038d6acd55da60f9e1aae59e68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2225559
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The Event API has changed so that it exposes only RawDescriptor, not
RawFd, so the block fuzzer's use of as_raw_fd() no longer worked.
The actual intent of the code using as_raw_fd() was to clone the Event,
so just use the existing Event::try_clone function which achieves the
same result without using platform-specific code.
BUG=chromium:1144535
TEST=`FEATURES=test USE='asan fuzzer' emerge-amd64-generic crosvm`
Change-Id: I64689dde1b1351997aa2f11ed440416e3d226815
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2514901
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
The current crate still require some work to be really reusable as a
regular FUSE, i.e. with a new reader/writer against /dev/fuse. This
change intends to focus on creating the crate, without trying to find
the optimal interface, and still keep virtio/fs working.
BUG=b:168305155
TEST=./build_test
TEST=USE='asan fuzzer' emerge-hatch crosvm
Change-Id: I8b623c9262221113b720c10125a6770763f14dc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2466484
Tested-by: Victor Hsieh <victorhsieh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Victor Hsieh <victorhsieh@chromium.org>
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>
New option, --size-only, speeds up using build_test for getting release
binary size by skipping everything else. The lto flag is also added for
release builds to get a more realistic comparison.
The list of crates to test is built up automatically instead of
hard coded. To modify what gets included, empty .build_test_* files are
checked for existance. This is better than hard coding the list of
packages because it was frequently out of date.
For certain crate tests, a dynamic library that only exists in a sysroot
is required. This change includes a fix that adds the sysroot's lib
directory to the LD_LIBRARY_PATH env variable, similar to how
PKG_CONFIG_LIBDIR is modified.
TEST=build_test
BUG=None
Change-Id: I626cbcccf40035a0d29001cef7989a091848e4c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2444273
Tested-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
The block, qcow, and zimage fuzzers all created a SharedMemory and then
converted it into a file; with the new base API changes, this is no
longer supported. Replace the SharedMemory uses with tempfile to fix
the build (this also simplifies the code).
BUG=chromium:1136895
TEST=`FEATURES=test USE='asan fuzz' emerge-amd64-generic crosvm`
Change-Id: I50d4e8c57ed41419c79a3fac440654224696f80c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2463895
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Note the CL size is large entirely due to the rename,
the changes are mostly negligible.
Also making a few small additional changes in sys_util
areas that don't need much attention in base. This includes
typedefing and adding specific imports for areas that don't
require significant interface changes.
BUG=b:162363783
TEST=./build_test
Change-Id: I4a2c9c4cdce7565806ed338e241c6b8c82c855c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2415180
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
A recent API change made `{Reader,Writer}::new` take `GuestMemory` by
value instead of reference. Since `GuestMemory` is just a pair o'
`Arc`s, this appears to be an easy fix.
BUG=chromium:1125394
TEST=`emerge-amd64-generic crosvm` with a `--profile=fuzzer`'ed board
Change-Id: I964f284134241f958456f87912334a387dfcf61e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2394756
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
For now, this crate simply re-exports all of sys_util, but it will
be updated to provide new interfaces when needed. This is the
first step to making crosvm not directly depend on sys_util, so
that we can make the interface changes we need without fear of
negatively affecting (i.e. completely breaking) other usages
within chromeos.
BUG=b:162363783
TEST=./build_test
Change-Id: I7d0aa3d8a1f66af1c7fee8fd649723ef17027150
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2325168
Tested-by: Michael Hoyle <mikehoyle@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
After vm_memory was added, the dependency wasn't added. So it
caused crosvm-fuzz fail to build. This patch adds the dependency.
BUG=chromium:1110970
TEST=USE="asan fuzzer" emerge-amd64-generic crosvm
Change-Id: Ic71243365ed8603928ba30bce7b7361ca368bf1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2327870
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Tiancong Wang <tcwang@google.com>
Move GuestAddress and GuestMemory to a new crate for VM memory. This
will make separating sys_util and crosvm independent making it easier
to use sys_util functions outside of crosvm.
Change-Id: I12e14948ea85754dfa6267b3a3fb32b77ef6796e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2311251
Auto-Submit: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
When compiling a new-enough crosvm for fuzzing (after
https://crrev.com/c/1749950), the build would fail with an error about
importing two different version of sys_util:
expected struct `sys_util::shm::SharedMemory`, found a different struct
`sys_util::shm::SharedMemory`
expected reference `sys_util::shm::SharedMemory (struct
`sys_util::shm::SharedMemory`)
found reference sys_util::shm::SharedMemory (struct
`sys_util::shm::SharedMemory`)
perhaps two different versions of crate `sys_util` are being used?
Fix this by patching the version of sys_util used by audio_streams
so that it also uses the path dependency instead of the sys_util from
the dev-rust/sys_util ebuild in the fuzz-specific Cargo.toml.
BUG=chromium:1057532
TEST=`USE='asan fuzzer' emerge-nami crosvm`
Change-Id: I38252465a1111a9a8f643a59e36733016c5db99d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2086401
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Move qcow from being its own crate into a module of the disk crate,
similar to the composite disk module.
This will allow use of qcow from disk and vice versa without introducing
a circular crate dependency.
BUG=None
TEST=./build_test.py
TEST=USE='asan fuzzer' emerge-nami crosvm
Change-Id: I77512bbe4b94faff1b5460f9796ee56505135580
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1972477
Reviewed-by: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Fix the build of block_fuzzer after "devices: block: add block_size
option for disks".
It might be nice to generate the block size from the random fuzz data,
but that would complicate things (we'd have to handle failure of
Block::new due to invalid sizes), so let's leave that as a future
improvement for now and just use a block_size of 512 to match previous
behavior.
BUG=chromium:942700
TEST=`USE='asan fuzzer' emerge-nami crosvm`
Change-Id: Ia16ef6a57fc8ce4407f8ec9dda0e708302916c4c
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1962535
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Fix the block_fuzzer build after CL:1906750, which added a new parameter
to the Block::new() function without updating the fuzzer.
This change passes `true` for sparse in order to keep previous behavior
and maximize the available commands for fuzzing.
BUG=chromium:1025757
TEST=`USE='asan fuzzer' emerge-nami crosvm`
Change-Id: I29ed9945077936aee9636ddee20b59729eb78c85
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1922065
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Add handling of the virtio device MSI-X configuration change vector by
using the signal function that was previously factored out.
BUG=chromium:854765
TEST=./build_test
TEST=trigger disk config change with `crosvm disk resize ...`
Change-Id: I462c23e10d152f896586bb70b95634a53088d480
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898269
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Zide Chen <zide.chen@intel.corp-partner.google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Factor out the common creation of struct Interrupt.
No functional change.
BUG=chromium:854765
TEST=./build_test
Change-Id: Idf8804771ba1af5181818f643e15e1b42918258a
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1898268
Tested-by: kokoro <noreply+kokoro@google.com>
Add a fuzzer for the virtio-fs server, which is responsible for decoding
a byte stream into FUSE messages.
BUG=none
TEST=run it with cros_fuzz
Change-Id: Ic7695f2106d3f81e6cf09b98ffedc51831238f1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1865272
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Improve the virtqueue_fuzzer's performance by reducing the maximum queue
size as well as the size of the guest memory. Zeroing out 256MB of
memory on every iteration was slowing things down quite a bit and we
don't actually need that much memory to fuzz the virtqueue code.
Additionally, refactor the fuzzer to use the virtqueue structs from the
virtio spec to fill out the guest memory. This should give us more
targeted fuzzing compared to the previous implementation, while also
removing cases where the fuzzer would spin for thousands of iterations
without making any progress.
BUG=chromium:1018267
TEST=`cros_fuzz reproduce` and also run the fuzzer manually
Change-Id: Ibf71aa83c31f16b7f58b23045a0919f7f6824c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1886533
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Sean Abraham <seanabraham@chromium.org>
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
This eliminates the boilerplate for catching panics and creating a Rust
slice from the fuzzer input data.
BUG=None
TEST=`USE='asan fuzzer' emerge-nami crosvm`
Change-Id: I49666a344b02e3333ad6823bfa7dace08b66b290
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1879495
Reviewed-by: Dylan Reid <dgreid@chromium.org>
This looks like it's copied from the qcow fuzzer, and it doesn't apply
to the block fuzzer. The actual behavior of the block fuzzer is
correctly described by the comment later in the file.
BUG=None
TEST=`USE='asan fuzzer' emerge-nami crosvm`
Change-Id: I9ccd6deba44af8b8df471ee0078ace385696151f
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1853698
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The new USB descriptor parsing code is a nice candidate for a fuzzer,
since it takes an arbitrary stream of bytes as input and parses it.
BUG=chromium:987833
TEST=`USE='asan fuzzer' emerge-nami crosvm`
Cq-Depend: chromium:1863465
Change-Id: I3bbdbf081e9a9dd590c781467f8bd44fa1dcab64
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1862117
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The new constructors are shorter and omit the bare `None` in the `anon`
call sites which gave no clues to the reader what the effect of that
`None` was. This should improve readability.
TEST=./build_test
BUG=None
Change-Id: I2e34e7df9a4ccc5da50edf4e963a6a42e3d84b22
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1797188
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>