Commit graph

18 commits

Author SHA1 Message Date
Noah Gold
2e24140d8b vendor/generic/metrics: document API methods.
BUG=b:331214555
TEST=presubmit

Change-Id: Iaa5db4b4e30d981848ccdac9966b51cf826d2518
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5588285
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2024-06-04 21:46:46 +00:00
Daniel Verkamp
52b8e42869 Cargo.toml: avoid "*" versions for external crates
Ensure that every Cargo.toml dependency on a third-party crates.io crate
specifies at least a major version, or a minor version for 0.x crates,
to ensure that if a new major version is published, it cannot cause API
breaks.

The versions are selected to match the ones already in Cargo.lock, so
this should have no functional change, but it will help prevent new "*"
versions from being introduced via copy-and-paste.

For rationale, see the Cargo FAQ:
<https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies>

`minijail`, `audio_streams`, and `cras` are left as "*" for now, since
they have unusual situations (imported from a submodule and/or replaced
at build time with ebuild magic).

BUG=None
TEST=tools/dev_container tools/presubmit
TEST=verify Cargo.lock is unchanged

Change-Id: Ifa18199f812f01d2d10bfb4146b3353c1a76527c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5555656
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-05-22 01:01:42 +00:00
Daniel Verkamp
92665a611f Cargo.toml: move tempfile to dev-dependencies
The tempfile crate is only used in tests, so it does not need to be in
the main [dependencies] section of any of our first-party crates.

Also fix a couple of [dev_dependencies] instances to the officially
documented [dev-dependencies] name for consistency.

BUG=None
TEST=cargo tree

Change-Id: I1dcb6be10c302baec4e8ebe6f72480f76e4e3760
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5521511
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-05-07 20:00:48 +00:00
David Stevens
d05f9e326e linux: Add support for metrics
Initialize the metrics tube and make sure its kept in all forked
children.

BUG=b:332466813
TEST=tast run DUT arc.Boot.vm

Change-Id: Ide7a9e4ba5a3d8a52e69ac65b9aaaefcf21735a6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5400363
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2024-04-09 01:43:39 +00:00
David Stevens
c552254625 metrics: Remove MetricsRequest from vendor API
Instead of deserializing from the metrics tube in the generic
MetricsController code, we can directly pass the readable tube to the
vendor RequestHandler implementation. This allows us to shrink the size
of the vendor metrics API by removing RequestHandler.

This change also makes MetricsController use RecvTubes instead of Tubes.

BUG=b:332466813
TEST=./tools/dev_container ./tools/presubmit all

Change-Id: Ia1507d5e1c0cdd346d165c968184e9d2bd70314e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5400362
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2024-04-09 01:43:33 +00:00
David Stevens
a21444be9d metrics: Switch metrics from Tube to SendTube
Switch the metrics client API from Tube to SendTube for more specific
typing. We're already making downstream breaking vendor changes, so it's
a good time to do this cleanup.

BUG=b:332466813
TEST=./tools/dev_container ./tools/presubmit all

Change-Id: Id870da0298291955496e0fa339142ac379a49d37
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5404371
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2024-04-09 01:38:03 +00:00
David Stevens
1dd411950b metrics: Remove downstream metrics dependencies
Add a metrics_event package instead of relying on metric events provided
out of a vendor/ crate. The new API defines the same events as the
existing vendor API, except it removes any dependencies on downstream
details. To allow downstream projects to define their own events, the
new API adds a vendor metrics_event package to support downstream-only
event types.

BUG=b:332466813
TEST=./tools/dev_container ./tools/presubmit all

Change-Id: I766ad6ca2a0a437bb487e27fb84a4984f66c9770
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5400361
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2024-04-09 01:36:24 +00:00
Daniel Verkamp
733d5189d6 vendor: generic: remove unused metrics link-search
The generic/metrics/build.rs script previously added a linker search
path, but the generic module doesn't actually link anything. The
generated proto code is compiled via include!(), so no linker options
are necessary.

This previously included a Windows-style path with backslashes into the
linker options, which did not work on Linux, so it was clearly not used.

BUG=b:286107739

Change-Id: If0139267e845fcacc9e3202a880071c938054783
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5420403
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2024-04-04 00:30:44 +00:00
Noah Gold
b63c3f4d76 vm_control: add snapshot encryption.
Introduces a new switch/option on snapshot commands/IPCs that turns on
encryption using the crypto crate.

BUG=b:286345300
TEST=builds upstream; tested end to end downstream.

Change-Id: Ia04074bb23332274d4e6b99eb242c84b0af7a8a9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5371444
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2024-03-18 17:33:29 +00:00
Noah Gold
69c56c5179 crypto: clean up comment.
BUG=b:286345300
TEST=presubmit

Change-Id: Ib5c727ba158ba195f9160a56d98575acaef0f8ec
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5359297
Reviewed-by: Frederick Mayle <fmayle@google.com>
Auto-Submit: Noah Gold <nkgold@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2024-03-11 20:22:43 +00:00
Vikram Auradkar
8798b9cd6b metrics: move noop metrics under generic
downstreams will override metrics_product crate

BUG=b:286107739
TEST=none

Change-Id: I90e05289d509c3f3ff85cc3441c89aad3507f0b0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5356287
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2024-03-08 17:45:25 +00:00
Noah Gold
0092631789 crypto: add generic crate for snapshot encryption.
The generic portion contains only interfaces, but no actual encryption
code. It will be used by an upcoming snapshot encryption option.

BUG=b:286345300
TEST=n/a (intended to always panic)

Change-Id: I54e8d4753a5584ffe7e9f0df5c31636ad34a905d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5350786
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2024-03-07 01:46:03 +00:00
Kaiyi Li
5fa838fdfc vm_control: gpu: remove kiwi feature
Change-Id: I12af995a2fd9daff0b2ff00f54bb9b053bd16d1e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4869237
Commit-Queue: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-10-24 23:19:03 +00:00
A. Cody Schuffelen
97dff044f8 Replace #[cfg(unix)] with #[cfg(any(target_os = "android", target_os = "linux"))]
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>
2023-10-11 00:43:29 +00:00
Vikram Auradkar
45927eafc7 crash_report: refactor product specific code
BUG=b:286107739
TEST=none

Change-Id: I8aa0dd5335a6d85566a75afc2fc1245380dd6dcd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4605997
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-06-09 23:10:04 +00:00
Vikram Auradkar
45a629e3e6 vm_control: refactor product specific code
BUG=b:286107739
TEST=none

Change-Id: I8228a34476daf83dfa809de8d1f70165b6fd6035
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4605895
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2023-06-09 23:09:47 +00:00
Vikram Auradkar
ff58179ba8 broker_ipc: refactor product specific code
Move generic code into /vendor/generic/broker_ipc crate

BUG=b:286107739
TEST=none

Change-Id: I53ff7fecc4e7a8f30443dd54457b8585b25a0ea1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4605894
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-06-09 23:09:41 +00:00
Vikram Auradkar
e30a511986 anti_tamper: refactor generic code
Moves generic anti-tamper into its own crate under
'/vendor/generic/anti_tamper'

BUG=b:286107739
TEST=none

Change-Id: I47045ce9ffe690340cd1ba749bdb692bbd624f92
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4605893
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2023-06-09 23:09:35 +00:00