This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.
This fulfills the request from legal and unifies our notices.
./tools/health-check has been updated to only accept this style.
BUG=b:246579983
TEST=./tools/health-check
Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Remove the _bytes_read variable, since it is not needed. It was also
misnamed since we are writing, not reading, data.
Fixes a Rust 1.62 clippy lint:
error: this let-binding has unit value
BUG=b:243677117
TEST=tools/clippy # with Rust 1.62
Change-Id: I53f7b675f8e95c94ab127e500127a9153166a906
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3854968
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Behavior should be exactly the same.
- Use `CpuSet::new()` directly instead of duplicating its code
- Use the `syscall!()` macro for error handling
TEST=./tools/presubmit
BUG=None
Change-Id: I371e9a113914db7ffdecbf4bf8770be157368569
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3858174
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Christian Blichmann <cblichmann@google.com>
Reviewed-by: Christian Blichmann <cblichmann@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
If we can't create a PlatformSyslog instance (for example, if /dev/log
is not available on a minimal Linux system without a traditional init),
warn the user and continue executing instead of failing.
BUG=b:242103548
TEST=Run crosvm inside minimal VM with no init
Change-Id: I4d81da396125331ef7ad335e57b37645b6546980
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3842814
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Ensure that openlog_and_get_socket() is only called once by storing its
result in a OnceCell. This fixes logging initialization when the syslog
State structure was constructed more than once, causing the log fd to be
invalidated and breaking sandboxed startup.
BUG=b:242103548
TEST=Start crosvm on Linux with sandbox enabled (default mode)
Change-Id: I663a7e918b81f4c23415a28cfcc2c72f6b4a51d8
Fixes: 7dbdc73063 ("base & src: allow multiple log inits.")
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3842813
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
With the migration to env_logger, we lost the ability to initialize
logging multiple times. This meant that we had to wait until we had
parsed CLI args and knew exactly what we wanted our logging spec to be,
which meant that it would sometimes be too late to log startup errors.
This CL modifies the logging facade to be modifiable on the fly, albeit
with some restrictions, to obviate the problem.
The syslog API has been modified as follows:
syslog::early_init: initializes stderr logging, can be called only once
per process. Called as the first function in main.
syslog::init/init_with: can be called after early_init to modify the
parameters used by the logging system. Can be called only once per
process. Will be called roughly after argument parsing or bootstrapping
is complete.
The fundamental change to enable this was in the logging facade. Now,
the facade passes all logging operations to a static, mutex protected
struct. This way, the facade never changes, but we can modify the
struct whenever we wish.
BUG=b:242103548
TEST=tested downstream
Change-Id: I76bc1bb275c81a69aadc7f03a80b94c297f47781
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3834294
Commit-Queue: Noah Gold <nkgold@google.com>
Tested-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Crashes of rust executables have a generic signature since the user
crash collector is not able to compute a reasonable signature for them.
This custom panic hook allows passing a signature derived from PanicInfo
to the crash collector.
BUG=b:234093439
TEST=See crrev.com/c/3834930 and crrev.com/c/3836804
Change-Id: Ida7f655d3a2463e8a42602d8e32588195a0ce36b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3842808
Commit-Queue: Paramjit Oberoi <psoberoi@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Paramjit Oberoi <psoberoi@google.com>
This CL migrates Tube from directly using a UnixSeqpacket to instead use
a StreamChannel backed by UnixSeqpackets. This CL also migrates users of
the old Tube::new(UnixSeqpacket) function to its renamed counterpart.
Tests are added for new functionality.
This CL enforces that the StreamChannel used by the Tube is backed by a
UnixSeqpacket because the reading and writing behavior of a UnixStream
is different, and it cannot guarantee the same multi-process
concurrent-writers behavior that a UnixSeqpacket can. This is because
the UnixStream does not send data as packets and the size cannot be
queried, so two underlyig writes are required for each Tube write: one
to send a header indicating message size, and one for the actual content
of the sent data. These can be interleaved during concurrent writes,
causing corruption of the Tube's data.
This CL makes the Windows and Unix API closer to each other, with some
differences remaining or added, including Tube::new_from_unix_seqpacket
existing in Unix but necessarily not Windows.
This migration (Tube from UnixSeqpacket to Stream) is intended to move
the Unix Tube API closer to the Windows API, with the eventual goal of
creating a platform-agnostic API for Tube.
Bug: b:231641496
Change-Id: I2422e76b7efa5a20bc40a8d194f5f8390dc71438
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3818253
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: Clarissa Garvey <clarissagarvey@chromium.org>
Commit-Queue: Clarissa Garvey <clarissagarvey@chromium.org>
This CL is one of two CLs in a series that migrate the Unix Tube from
using UnixSeqpackets directly to instead use StreamChannels backed by
UnixSeqpackets. This CL adds some pass-through functions to
StreamChannel that are needed by Tube in the follow-up CL, as well as
a new function to create a StreamChannel directly from a UnixSeqpacket.
Additionally, a test is added for the new constructor-like function.
This migration (Tube from UnixSeqpacket to Stream) is intended to move
the Unix Tube API closer to the Windows API, with the eventual goal of
creating a platform-agnostic API for Tube.
Bug: b:231641496
Change-Id: I8d7da6a0e64d38d8f9833ae8e62ec7a2c4cfda5c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3818249
Tested-by: Clarissa Garvey <clarissagarvey@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
The test isn't unix specific anymore, so we ought to move it to
base/src/syslog.rs, however, when moved, it fails with an "Illegal Seek"
error when run in the presubmit (but not in `cargo test`). The cause is
unclear.
BUG=b:228881485
TEST=./tools/dev_container ./tools/presubmit
Change-Id: I76e6595007a3b59f6bbd5a4afae42f911686f3e3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3817974
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Frederick Mayle <fmayle@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
This CL adds tests for Unix Tube: a test for the platform-specific
Tube::new function, and a serialization/deserialization test that
existed previously in Windows and now is shared between platforms.
Bug: b:231641496
Change-Id: Iabbc15f847b995affd0bfd5b304fd70d34b171b5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3794509
Tested-by: Clarissa Garvey <clarissagarvey@chromium.org>
Commit-Queue: Clarissa Garvey <clarissagarvey@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
This introduces slirp support. On windows, net is enabled only if slirp
is enabled.
BUG=b:213149155
TEST=presubmit
Change-Id: I77f0121ab4545350345c4f42f67b51186279c44c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3787269
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
We already depend on chrono elsewhere, so we might as well use it rather
than rolling our own unsafe wrapper around gmtime_r.
BUG=None
TEST=tools/presubmit --all
Change-Id: I46e4a75ca74f8a02875814f6cb21031db58e1e3a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3795009
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
bionic (the android libc) doesn't have shm_open or shm_unlink.
TEST=presubmit
BUG=b:228881485
Change-Id: Ic0df86387a1110835b1e53a68d249fa3d55803ab
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3803896
Reviewed-by: Devin Moore <devinmoore@google.com>
Auto-Submit: Frederick Mayle <fmayle@google.com>
Tested-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
- Remove trailing ::{self} on all use statements
- Remove any resulting single-level use statements (e.g. use libc;)
- Reformat with `tools/fmt --nightly`
BUG=b:239937122
TEST=tools/dev_container tools/presubmit --all
Change-Id: I8afd1b0458ca6d08d9b41a24583f7d4148597ccb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3798973
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Prior to this CL, the StreamChannel in base/src/sys/unix had no tests
for FramingMode::Message. This CL adds a test for that framing mode.
Bug: b:231641496
Change-Id: I75e13709d558258eca838c3190aaf0237e39513b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3793688
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Clarissa Garvey <clarissagarvey@chromium.org>
Tested-by: Clarissa Garvey <clarissagarvey@chromium.org>
By default, KSM is disabled by the kernel. This is harmless if KSM
is disabled, and only causes merging if the user manually enabled
the feature on their kernel. If enabled, significant memory saving
can occur, at the cost of CPU cycles and a reduction in privacy.
Bug: 1346340
Change-Id: I838cdda97ea8d335b1953dd6775311958069898c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3780870
Reviewed-by: David Manouchehri <david@davidmanouchehri.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Closing one of the deltas in base crate.
BUG=b:213146388
TEST=presubmit
Change-Id: Ibac36d1ad9b1b6387ec74e8b59ccb38319903655
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3793691
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.
Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.
BUG=b:239937122
TEST=CQ
Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The crosvm run --syslog-tag argument was accepted, but it did not do
anything after the argh refactor. Tweak the LogConfig setup so the
default tag is "crosvm" and can be overriden by the --syslog-tag option.
BUG=None
TEST=crosvm run --syslog-tag="TESTVM" ... # observe tag in syslog
Change-Id: I7cd83b0623ac725c59a1dc1fcc4f8952e749e00a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764041
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
We recently started to map VVU device registers into the process address
space, but accessed them like regular memory. This is dangerous as the
compiler can reorder and optimize these accesses.
Add new `write_obj_volatile` and `read_obj_volatile` ops to
`MemoryMapping` that are designed to perform such I/O accesses and use
them where appropriate.
BUG=b:238282334
BUG=b:237647217
TEST=VVU console device can be created from Linux.
Change-Id: I40f30acfd358248d4f9d0c00d5cd708eabae047d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762971
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Move MemoryMapping's implementations of write/read_slice, write/read_obj
and get_slice as well as the definition of the MappedRegion from the
platform module into the base mmap module, since these definitions were
strictly identical between Windows and Linux. This removes quite a bit
of duplicated code.
In the process, some tests need to be adapted in order to work with the
common MemoryMapping type instead of the platform one, as the above
mentioned methods become unavailable on the platform type.
BUG=b:213153157
TEST=./tools/dev_container ./tools/run_tests --target=host
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
TEST=cargo test -p base --doc
Change-Id: I20e6f47c3c4763b63eae707a527a084b229cd951
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762970
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Windows and Unix now use identical code for their Protection
implementation, the only difference being the value of their PROT_*
constants. Make the contants part of the platform and use these from the
common mmap module to avoid duplicated code.
BUG=None
TEST=./tools/dev_container ./tools/run_tests --target=host
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
Change-Id: I95f2769e868f32ae70de8159ac4fbb481c4ef467
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762969
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
This state is invalid for Windows, and we can easily avoid using it
altogether.
BUG=None
TEST=./tools/dev_container ./tools/run_tests
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
Change-Id: Id5aba0498f9c19df0d95e86aea04fbe8a4023707
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762968
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
The Windows and Unix Protection struct are extremely close, with the
only difference being how they internally represent their state. Make
the Windows implementation adopt the same storage type as the Unix one
so we can merge them.
BUG=None
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
Change-Id: Idb47243e7d2003d7eb499e683993dba2419e8841
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3762967
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
If a core is offline, we will not be able to set the cpu affinity to
that core. The TSC calibration code attempts to determine the TSC offset
of all cores. Determining which cores are online requires parsing the
contents of /sys/devices/system/cpu/online on linux, and it's not clear
how to do it on Windows. Instead, the calibration code will treat errors
when calling set_cpu_affinity as legitimate reasons for a core to be
offline, and will exclude that core from the offset information in the
TscState. This will prevent the TSC sync mitigation logic from setting
any vpu's affinity to that core.
This also changes how number_of_logical_cores is implemented on linux,
to count the number of configured cores instead of the number of online
cores, which seems more correct.
BUG=b:230372694
TEST=added a new unittest, also ran unittests with an offline core
Change-Id: I12c187a7ca1dd06e25b396eaeae542628fdf563c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764280
Tested-by: Colin Downs-Razouk <colindr@google.com>
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
We've had multiple silent bugs stemming from the current double-init
behavior of the logging system. To prevent that from happening for the
fourth time, this CL makes all subsequent logging inits panic. This way,
it will be much harder to commit code that won't work. Details:
* Current behavior: only the first init applies logging configuration.
The subsequent inits will silently do nothing, and discard the
supplied settings. These settings could be important things like
setting the log file, whether to echo to stderr, etc.
* New behavior: after the first call to init, any subseqent call will
panic.
NOTE: If this CL breaks a downstream project, there is very likely
a bug in that project which may be causing logs from crosvm to be
lost. Please fix that bug, or revert this CL in the downstream project
temporarily.
In this CL, we discovered that openlog_and_get_socket (used in linux
syslog) mutates global state. In tests, this manifested as a failure.
For this CL, we've chosen to preserve the behavior of only re-creating
State (and by extension, PlatformSyslog) when there is no STATE
currently set. (This behavior is nice for other reasons since it keeps
us from performing unnecessary operations when a no-op is possible.)
BUG=b:238680255
TEST=presubmit & tested downstream by verifying log files were written.
Also ran example_simple & verified it didn't panic.
Change-Id: Iad64c1b52b917e63d14a42cbbd1739ef94107fae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3756274
Commit-Queue: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Change http://crrev.com/c/3737406 removed the custom permission enum for
IOMMU, but did not update the related Windows code. This results in a
build error that was not caught because the Windows builder was
temporarily deactivated.
BUG=b:237620529
TEST=./tools/dev_container ./tools/run_tests --target=host --build-target=mingw64
Change-Id: Id57eb0d0836fe0c61ff578752d5c5eb8941f37b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3758169
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Clock now has a single now() function that returns a std::time::Instant
rather than wrapping an Instant itself.
FakeClock provides the same now() API, except the Instant it reports is
only advanced when test code calls add_ns(). FakeClock continues to
provide the add_event() and add_ns() APIs used by tests.
The only functional difference is that the epoch used by FakeClock is
now whatever moment in (real) time it is created, rather than a fixed
timestamp, but this should not change the results of the tests. The only
way to observe the contents of an Instant is by comparing it to other
Instants, which should all be derived from the Clock/FakeClock now()
API.
BUG=None
TEST=cargo test -p base -- --test-threads=1
TEST=cargo test -p devices
Change-Id: I9a0ed8d252f213d85dba3dfbbcd1182e2db981f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3736922
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
The previous configuration made us pull in three different versions of
rand, and depending on "*" is a recipe for API incompatibility.
crosvm-fuzz needs to match its rand version to the rand_core used in
common/cros_fuzz, so that will be upgraded separately.
BUG=b:236978141
TEST=cargo build
TEST=emerge-hatch crosvm
Change-Id: I655ed3f156e4ac43afa3122596f62e9caa43b4f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3722184
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
The original Pit code encoded the start value of a timer into the
count_load_time field as a number of nanoseconds since the start of
the host's monotonic time value. Instead, we can use the PitCounter's
creation_time as the epoch. This makes the math look a bit more sensible
and removes the use of the non-portable clock_gettime() function.
Before
======
get_channel_state():
count_load_time = get_monotonic_time() - start.elapsed()
=== count_load_time = now() - (now() - start)
=== count_load_time = start
set_channel_state():
start = now() - (get_monotonic_time() - count_load_time)
=== start = now() - now() + count_load_time
=== start = count_load_time
After
=====
get_channel_state():
count_load_time = start - creation_time
set_channel_state():
start = creation_time + count_load_time
BUG=chromium:908689
BUG=b:213149155
TEST=cargo test -p devices pit
TEST=tools/run_tests --target=host --arch=win64
Change-Id: I5468d1d964a04b1ce96979ed583b729d139e1005
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3723804
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This CL adds a command-line flag to crosm that locks the entire guest
memory, per http://go/host-assisted-vm-swap.
The change relies on existing balloon device code that punches holes
within the guest memory region upon "inflate".
BUG=b:236210703
TEST=manual startup, roblox+instagram and various chrome sessions
Change-Id: I11e0e5b0b0cb6450f47124a6a8b6c4befd9de6ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3725731
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Marciano Gimenez <raging@google.com>
Auto-Submit: Alexandre Marciano Gimenez <raging@google.com>
Switch VmMemoryRequest and FsMappingRequest to use base::Protection to
express permissions, in preparation for unifying the APIs.
BUG=b:201745804
TEST=boot ARCVM and crostini
Change-Id: Id001abbd2dde19aa14fcf1643f25abafdd66a2e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3716337
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
The cvt crate dependency was removed and replaced with a manual
check of the returned value in StreamChannel::inner_read.
Bug: b:231641496
Upstream-Crate: base/src/sys/unix
Change-Id: Ie4cfa14b4b4821923828a97546d6c2a767b9356f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3707390
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Clarissa Garvey <clarissagarvey@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
We accidentally removed nanosecond precision at some point (likely when
I redid the formatter). This CL fixes that.
BUG=b:237004396
TEST=tested format string in the playground
Change-Id: Iaa502c13c34c9cc8f4b7be05821a63c8f10cb360
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3722782
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
AsRawDescriptor is a very generic trait and some of the types we want to
use as input sources already implement it for other purposes.
ReadNotifier makes the purpose of the returned descriptor obvious (wait
for some data), so use it instead.
BUG=b:228912920
TEST=console device works in both regular and vhost-user modes.
Change-Id: I68a4ce05be449e07ea71e7cb472e8cda00e9d84d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3671059
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
00068bc0a2f02bd79235ff50b9d6f81a6133986f caused the timestamps on
crosvm logs to switch to UTC (ISO 8601). The 8601 part is great,
but the UTC time is a little annoying for local debugging.
Thanks to auradkar@ for coming up with the new formatter code.
BUG=b:236004673
TEST=ran downstream crosvm & verified logs appear w/ local timestamps.
Change-Id: I715f68b7f4ba545e3eadbfd1b9be9abba69d8258
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3712544
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
We depend on both lazy_static and once_cell, which do basically the same
thing.
The once_cell crate has a few advantages:
- once_cell is on track to be included into libstd.
(https://github.com/rust-lang/rust/issues/74465)
- once_cell doesn't require macro magic.
Replace the uses of lazy_static with their once_cell equivalents so we
don't need to pull in both crates.
BUG=b:236191006
TEST=tools/presubmit --all
TEST=tools/run_tests --target=host --arch=win64 --build-only
TEST=cargo test --features=plugin
Change-Id: I7cabcd837ef4878e8e8ae635bb4f235a58e4cae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3707624
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
cvt isn't used anywhere else in the base crate, and it isn't included in
the ChromeOS crosvm ebuild, so this breaks the CrOS build. Just check
the result and return an error the same way we do elsewhere in base.
BUG=b:231641496
TEST=cargo build
TEST=emerge-hatch crosvm
Fixes: 21445b1b83 ("base: Upstream unix net set_nonblocking fn")
Change-Id: Iba8beee21810210e50e0c715a1b84de29278625a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3716851
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
scoped path is not exported and isn't used in crosvm, so delete it (and
move it to libchromeos-rs).
BUG=b:229016539
TEST=crosvm presubmit passes
Change-Id: I661c253db909874aec356538a687e99f3aa95e3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3706096
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Allen Webb <allenwebb@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>