Commit graph

3581 commits

Author SHA1 Message Date
Vikram Auradkar
95707cfa9c io_uring: use WaitContext
BUG=b:213153157
TEST=presubmit

Change-Id: I5875151109f391fbd217269c864abe7d32b7b92e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626209
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-05 16:59:04 +00:00
Dennis Kempin
d724d41e19 infra: Add CQ status host
This will allow us to view Change Verifier task information
at https://luci-change-verifier.appspot.com/ui/recents/crosvm

BUG=1300370
TEST=lucicfg validate main.star

Change-Id: Ia9db97888a2d18241b56a0efbbebd406ae4980a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3628240
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
2022-05-05 00:25:59 +00:00
Dennis Kempin
1b2000227f infra: Add CI and TRY builders to luci configuration
BUG=1300370
TEST=lucicfg validate main.star

Change-Id: I67eca30a694a69875eb585ad155fbf0419fed353
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626224
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-04 21:40:49 +00:00
Dennis Kempin
6b2b2184fd infra: Add example verify_cl recipe
The recipe follows luci onboarding instructions to verify configuration.

It currently just checks out the gerrit change provided as input.

BUG=1300370
TEST=Basic test included

Change-Id: I249ce2124f4b161465d7603155cbe25a85d2551a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626223
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yuanjun Huang <yuanjunh@google.com>
2022-05-04 21:40:49 +00:00
Andrew Walbran
ecbf9dcfa1 Derive Debug for SharedMemory.
This is useful when adding temporary logs to dump it for debugging.

TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: Ia982104943b214b67472f7bdd03c9511191c35cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627452
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
2022-05-04 18:01:58 +00:00
Andrew Walbran
9ef18e4760 Use ? rather than Result::map.
It's simpler and cleaner.

TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: I6289722c2415e5afd51c337a8628ba7f5dcc0702
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3627451
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-04 17:01:41 +00:00
Shikha Panwar
dac771b644 Add --unprotected-vm-with-firmware flag to simulate protected mode.
This runs an unprotected VM but uses the same memory layout as for a
protected VM, loads pVM firmware, disables the same devices as for
protected mode. This is useful for debugging pVM firmware and other
protected VM issues.

TEST=crosvm --extended-status run --disable-sandbox --serial=stdout,hardware=serial,num=1 --unprotected-vm-with-firmware=pvmfw --bios=test_bootloader
TEST=tools/dev_container tools/run_tests --target=vm:aarch64
BUG=b:230475926

Change-Id: I9a8077d76874f10221071ea312291659d81da3d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3623760
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Andrew Walbran <qwandor@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-04 09:36:08 +00:00
Douglas Anderson
3df2a8db60 seccomp: Add memfd_create: arg1 == 3 for arm64
With testing, we're seeing secomp violations on aarch64. We need to
give access to "memfd_create" just like we did for arm32. Copy the
snippet from there.

BUG=b:223410173, b:230609113
TEST=Start arcvm; start android-sh; run tast arc.VMConfig

Change-Id: I4922e6decd67c3bc23fb090987b0318c384e0d68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626017
Auto-Submit: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-04 00:22:28 +00:00
Ryan Neph
60b6ed0e77 rutabaga_gfx: add context_name param to ffi/lib.rs
Follow-up to commit 13108989b1 to fix
broken rutabaga ffi after introducing the new context_name parameter
to create_context().

BUG=b:230678191
BUG=b:230788302
TEST=emerge crosvm

Change-Id: If1165662e66dd349ef4c52bece26fe724a861b78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621210
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Ryan Neph <ryanneph@google.com>
2022-05-03 23:08:55 +00:00
Anton Romanov
bf27367aab Revert "Do not run cros_async tests on armhf"
This reverts commit 15a4ee3200.

Reason for revert: Should pass now

Original change's description:
> Do not run cros_async tests on armhf
>
> The test has been flaking with segfaults occasionally.
>
> BUG=None
> TEST=presubmit
>
> Change-Id: Ifbfee7e7ed5de91b7bdf9b25db7983139951f81f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3606751
> Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Dennis Kempin <denniskempin@google.com>

Bug: None
Change-Id: I85d0885ce9f9fa3d46dd86536a5a20a71ffbbabb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3626010
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-05-03 22:48:46 +00:00
Anton Romanov
6cc69d676d crosvm: cros_async: Drain uring operations when dropping uring executor
Otherwise we may drop the memory that kernel still references.

BUG=b:230934649
TEST=cargo test

Change-Id: I1ab4fcc721118f744b8975d01fc907c511309585
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3625899
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-03 22:48:45 +00:00
Vikram Auradkar
d0e5b6ae83 base: export PollContext as EventContext
EventContext is a platform independent name.

BUG=b:213153157
TEST=presubmit

Change-Id: Ib0f51fabb622a4ff0b0678768cee8f0e1ab9bba0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3625896
Commit-Queue: Noah Gold <nkgold@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-03 21:23:12 +00:00
Vikram Auradkar
68fb967912 base: Export event related symbols from base in windows
BUG=b:213153157
TEST=presubmit

Change-Id: If4b122b70c11ec1b1591296ff2f67c389fa89671
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3625708
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 21:04:21 +00:00
Vikram Auradkar
cdb9e125ae base: rename EventFd to Event
Note that
- the file/symbols within `src/sys/unix/eventfd.rs` have not
  changed yet.
- base still exports EventFd to keep common/cros_asyncv2 happy

BUG=b:213153157
TEST=presubmit

Change-Id: Ie0a4308e8501d2e91364b049e6575d656af866cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3624568
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-03 21:04:19 +00:00
Peter Collingbourne
6ec88e1c1d aarch64: Expose pointer authentication to guests
As with any other CPU feature, if pointer authentication is supported
on the host, we should also support it in guests.

Change-Id: Ia09ba9e3b48a88a280bd1922e976393e10545ba2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3622797
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Peter Collingbourne <pcc@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 20:10:35 +00:00
Vikram Auradkar
d67395808e base: move unix specific trait into sys/unix/shm.rs
Also makes symbols exported from sys/unix/mod.rs slightly more
explicit.

BUG=b:213153157
TEST=presubmit

Change-Id: Ibf4390ddf448ab8dc41973ea5071ca59f6abfc29
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621212
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 18:55:33 +00:00
Vikram Auradkar
cceb96ee3c base: add from_safe_descriptor to SharedMemory
from_safe_descriptor is used by both windows and unix - windows has to
supply size because the way `handle`s are treated. So make size
optional.

BUG=b:213153157
TEST=presubmit

Change-Id: I984b706852f91f5df6b8701df09526f40068f8fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621211
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-05-03 18:55:32 +00:00
Daniel Verkamp
df929efce3 base: timer: fix crate name in ignored tests
Update the crate name in the comments describing how to run the ignored
timer tests now that they've been moved into the base crate.

BUG=b:213153157
TEST=cargo test -p base timer -- --ignored

Change-Id: I6f8d233c7743c6d379ac4c78d20a70c82344876c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621200
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-05-03 17:09:19 +00:00
Daniel Verkamp
7b272a4a1b base: use a common FakeClock implementation
The unix and windows clock modules are almost identical now that they
both use the base::Event type, so we can merge them into a single
platform-independent version now.

BUG=b:213153157
TEST=tools/presubmit

Change-Id: I442f3b21b0425f86ca79d0090cae54acfbdfd344
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621204
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>
2022-05-03 16:33:49 +00:00
Vikram Auradkar
936b567452 base: move ioctl.rs from windows/win/ to windows/
BUG=b:213153157
TEST=presubmit

Change-Id: If3958b6f0a5075f11ecdad0cb8c02a91de667b24
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602923
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 02:20:00 +00:00
Vikram Auradkar
c73a8581ca base: make src/mmap.rs platform independent
Mostly moves a code around. Note-worthy changes includes,
- Adds an optional file descriptor field to MemoryMapping.
- Adds is_file_descriptor to MemoryMappingBuilder.

BUG=b:213153157
TEST=presubmit

Change-Id: I288c666eb45bf2bd2fcbcb90c0d748674c287367
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3614853
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-05-03 02:19:31 +00:00
Vikram Auradkar
6dbc26eec3 base: Export windows ioctl interfaces
Minor refactor to rename variables from 'handle' to 'descriptor'

BUG=b:213153157
TEST=presubmit

Change-Id: Ic4c51368f53b3dfab15a12f2bd07be7f1bc277a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602922
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-03 01:11:02 +00:00
Vikram Auradkar
d27a1b1f25 base: refactor unix ioctl
There is very little of ioctl that is shared across platforms. This
cl moves all of code from src/ioctl.rs into src/sys/unix/ioctl.rs.

We also prefer to keep descriptor version of the interfaces.

Deletes unused windows ioctl.rs file located under src/sys/windows/.
Windows version of the file will have same interfaces but completely
different implementation.

BUG=b:213153157
TEST=presubmit

Change-Id: I047f58c3732c05a16dfe6885b2b875b07fedf860
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602921
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-03 01:11:00 +00:00
Yuanjun Huang
95e1e6bb14 [Config] Add service accounts for the example builder
Bug:1300370
Change-Id: Ie8a3260c8539ea1aea736cc0f4bb4bfd61ac5871
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3622237
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Yuanjun Huang <yuanjunh@google.com>
2022-05-02 23:12:31 +00:00
Noah Gold
3a3d73b3cb virtio_sys: add DataInit for net struct.
On Windows, we have to generate virtio_net_hdr_mrg_rxbuf ourselves since
there is no actual TAP device. Since we have to serialize it onto a
binary pipe, we need to get it as a binary slice, so here we implement
DataInit on that struct.

BUG=b:213151463
TEST=builds

Change-Id: I25a3333c20a87d6bf576f0225aac3e1c816a46ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3609237
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-05-02 21:00:19 +00:00
Noah Gold
fdd42b7b0e book: update cross platform code samples
Our original code sample was missing some elements in the use statements
that clarified how modules were organized with sys.

BUG=none
TEST=n/a

Change-Id: I62d6a294218fa7c9c5853dbefc6550de763e7c8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3614852
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2022-05-02 20:59:59 +00:00
Daniel Verkamp
55a5b54bf2 base: clean up vestigal sys_util references
The sys_util crate has been merged into base, but a few places still
refer to the old name. Fix or remove them as appropriate.

BUG=b:227226222
TEST=tools/presubmit --all

Change-Id: Icf9b57aff672b7c1afec768c9694e059f0f9a43d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3621205
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-05-02 20:16:18 +00:00
Daniel Verkamp
afc4fb8dc0 base: syslog: fix error log case
Previously, err_buf would just be a slice of 1024 zero bytes, but it
seems like we wanted to print out the warning message instead.

BUG=None
TEST=tools/presubmit

Change-Id: I92613fd4b9e09b951cd52f5a1ab227068e9de092
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617366
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2022-05-02 17:54:34 +00:00
Grzegorz Jaszczyk
6b8680bc15 vm_control: minor style improvements for powerbtn command
Minor style improvement - no functional changes.

BUG=None
TEST=Make sure that "crosvm powerbtn /run/<>/crosvm.sock" works as
expected.

Change-Id: Ide843707d69c25c9e0473bc8e55db8c4a6da7553
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3616883
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-01 20:35:34 +00:00
Grzegorz Jaszczyk
ae70c7f3e9 acpi: add support for generating fixed sleep button event from cmd line
Add support for injecting an ACPI sleep button event using the command
line. Upon receiving crosvm sleep command, emulate vPM1 accordingly and
trigger vSCI to the guest if ACPI fixed sleep button event is enabled.

Additionally do not mask the ACPI sleep button event in FADT flags for
the guest anymore. Quoting ACPI specification regarding the sleep button
flag: "If the system does not have a sleep button, this value would be
“1” and no sleep button device would be present".

BUG=b:194391015
TEST=Boot the VM, issue "crosvm sleepbtn /run/vm/vm.<hash>/crosvm.sock",
check guest /sys/firmware/acpi/interrupts/ff_slp_btn counter and if vSCI
was injected. With some additional changes (e.g. acpid on the guest)
suspend guest by issuing sleepbtn command from the host.

Change-Id: Ie50a3a781ba4fbfa04da75186fb5549919a5bd68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602867
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
2022-05-01 20:29:35 +00:00
Anton Romanov
50d2f5599d crosvm: test_runner: Allow arch to be specified separately for TestTarget
Fixes cases when we use target vm:aarch64 but arch armhf and test_runner
picks up tests for aarch64

BUG=none
TEST=run and made sure armhf-disabled tests are not picked up

Change-Id: I4d0734bb6320fc698bf16adc59de5e03b00a4a68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617081
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Anton Romanov <romanton@google.com>
2022-04-30 01:10:15 +00:00
Vikram Auradkar
f0b1a5d112 base: move windows timer
Move and use windows timer. With this, windows base should export/test
Timer/FakeTimer functionality.

A series of patches move unix specific code into src/sys/unix/timer.rs,
retain platform independent code in src/timer.rs and then introduces
windows timer.rs.

BUG=b:213153157
TEST=presubmit

Change-Id: Icbd48756c270184395f0b324e9e1f49d564a929a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600761
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-04-29 23:40:09 +00:00
Vikram Auradkar
093fb570a9 base: use common timer
- Use SafeDescriptor in Timer is it platform independent
- Move FakeTimer into src/timer.rs as it can be shared across platforms
- Add windows required but unix only(for now) functionality

A series of patches move unix specific code into src/sys/unix/timer.rs,
retain platform independent code in src/timer.rs and then introduces
windows timer.rs.

BUG=b:213153157
TEST=presubmit

Change-Id: I902cae151f7c6d073711b6055e343246f2bea2af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600760
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-04-29 23:40:08 +00:00
Vikram Auradkar
dc6fc84d41 base: define Timer type
Alias TimerFd to Timer for now. Next patch should get rid of the alias.

A series of patches move unix specific code into src/sys/unix/timer.rs,
retain platform independent code in src/timer.rs and then introduces
windows timer.rs.

BUG=b:213153157
TEST=presubmit

Change-Id: I155936fb14c2435a121d8ef602e208ffb88ebf3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3600759
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-04-29 23:40:07 +00:00
Daniel Verkamp
c9ae4da251 base: windows: remove STDOUT_FILENO/STDERR_FILENO
These are not used in the downstream fork. Removing them lets us get rid
of the build.rs file for the base crate.

BUG=None
TEST=tools/presubmit --all

Change-Id: I8d8dfea77b0dc49d2179f0825edb4d1525d8724a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617364
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-29 22:38:14 +00:00
Noah Gold
dd26934e16 net_sys: add constants used on Windows.
The constants herein are used on Windows. Normally we'd prefer to get
them from libc, but on Windows, these constants aren't available. For
consistency, cross platform code has been adjusted to use the net_sys
versions of the constants.

BUG=b:213151463
TEST= builds

Change-Id: I9048269483b9553f316aa8690da3ba4acdc8272a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3609236
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-29 21:03:57 +00:00
Noah Gold
100aab600b tools: update bindgen docs.
BUG=none
TEST=n/a

Change-Id: I4853084af339516164bf5988742310a1a7c26c31
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617163
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-29 21:02:26 +00:00
Daniel Verkamp
7296fa5e12 base: remove unix Fd type
All users have been migrated to the more portable Descriptor type.

BUG=None
TEST=tools/presubmit

Change-Id: I41ea238995242c48f9ad02a78491a73e0d9bdbe6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3616617
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-29 20:20:35 +00:00
Yuanjun Huang
f058ca98bd Fix Luci related configs validation errors
Fix validation errors in luci-scheduler.cfg:
1. (acl_sets): aclSet "ci" has no entries
2. (job / Example Builder / task): legacy v1 bucket names like
"luci.crosvm.ci" are no longer allowed, use "ci" instead
3. (job / Example Builder / acl_sets): referencing AclSet "ci" which
doesn't exist
4. (job / Example Builder): Job or Trigger must have OWNER acl set

The setup doc doesn’t mention what the ACL values should be. So I coped
ACL configs from `projects/infra` configs and those can be changed later.

Bug: chromium:1300370
Change-Id: Iffc57e37b62d5048ccff83836bb6dddec9e34c68
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617164
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Yuanjun Huang <yuanjunh@google.com>
2022-04-29 19:53:33 +00:00
Noah Gold
b36bfca634 book: document using crosvm tools in cros tree.
BUG=none
TEST=n/a

Change-Id: Ifee38e534fe13a148c8a57fca7aae1b95c944175
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617162
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-04-29 19:10:42 +00:00
Noah Gold
dc8d1dbdca cros_async: update Timer & sleep docs for Windows.
base::Timer's sleep may wake early on Windows, which has knockon effects
here where we consume it.

BUG=b:229680949
TEST=n/a

Change-Id: I44a8f78e3dbc01ef562101c2706b89d2a88e5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3617161
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-29 19:10:41 +00:00
Vikram Auradkar
fb874a8a9f base: Prefer platform independent descriptor over fd
BUG=b:213153157
TEST=presubmit

Change-Id: Ie697c92fe84beeb8fb91620b4888bc354882d5db
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615334
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-04-29 17:54:31 +00:00
Vikram Auradkar
be1cc96549 Make the mod not-arm only
BUG=b:213153157
TEST=presubmit

Change-Id: Ia351a3254c4bc261f2abd5380e5e678156353900
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3614614
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Anton Romanov <romanton@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-04-29 17:45:59 +00:00
Noah Gold
7e0c7f1173 base: document early wake potential on Timer.
The Windows timer can wake up early, which may be unexpected. This CL
documents that behavior.

BUG=b:229680949
TEST=n/a

Change-Id: I2047c1cdcf0819ed1c4b5f5d4ed9c70e8cb71caf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615343
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-04-29 17:39:38 +00:00
Vikram Auradkar
7c7a4788d5 base: enable notifier
BUG=b:213153157
TEST=presubmit

Change-Id: I9e7af1e84e57c8f176d47cff1c15abbcd0e00776
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3602930
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-04-29 17:16:52 +00:00
Vikram Auradkar
7e6cfb912d base: remove unused files
These files are left-over from a couple of earlier refactors.

BUG=b:213153157
TEST=`cargo test` from base/

Change-Id: I9944d42db6101f3f77a140021f0fa7d0111b075d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615335
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-04-29 15:51:20 +00:00
Douglas Anderson
893f8d7e0b seccomp: move arm32 gettid in gpu common policy to same place as in common
In <https://crrev.com/c/1952565> we moved gettid to the common
policy. Let's move the definition in the gpu common policy to the
same place to match.

This change was requested for arm64 in the code review of
<https://crrev.com/c/3543889>. This makes the call be in the same
place for arm32 and arm64.

BUG=None
TEST=CQ

Change-Id: I40628d344ca36267302e621709bb632406595b59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615332
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-04-29 00:20:41 +00:00
Douglas Anderson
5124d62f86 seccomp: Fixes needed for aarch64 to allow arcvm to start
With these changes arcvm starts when running with 64-bit userspace and
this grep turns up blank:
  grep SECCOMP /var/log/audit/audit.log

Generated by:
* Hacking minijail0 to always log <https://r.android.com/2072091> and
  making sure it was compiled in debug mode.
* Hacking "crosvm run" to be "crosvm run --seccomp-log-failures". I
  don't truly know if this is needed but it didn't hurt.
* Diffing arm vs. arm64

From comparing arm vs. arm64 there could still be some things missing,
or it's possible that arm has simply accumulated some cruft. More can
be added later if we find it's needed.

BUG=b:223410173, b:230609113
TEST=Start arcvm; start android-sh; run tast arc.VMConfig

Change-Id: Ib5407ddecc3d19f43e14e5b036ac64baee9335bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3543889
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Douglas Anderson <dianders@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
2022-04-29 00:05:48 +00:00
Anton Romanov
ed50691066 crosvm: ignore certain tests on wine
Use target_env as heuristic to detect wine as we build wine tests with
mingw while real tests use msvc

BUG=none
TEST=cargo test --target x86_64-pc-windows-gnu -- --test-threads=1

Change-Id: I96afd964d52539ab40b56d236442aa3651637991
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3615511
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2022-04-28 23:50:58 +00:00
Daniel Verkamp
9975e79f78 devices: vsock: simplify device path to a PathBuf
The vhost-vsock device had some special-case code to handle a file
descriptor as the vhost device rather than a path. However, crosvm
already has base::open_file(), which has special handling for magic
/proc/self/fd/<N> paths and treats them as already-open file descriptors
without requiring a separate command-line option.

This change converts the vhost vsock device to accept only a path
instead of a special path/fd enum, using base::open_file() to support
passing already-open file descriptors via the /proc/self/fd path format.
The existing --vhost-vsock-fd option is kept for compatibility, but it
now just creates a /proc/self/fd path from the passed fd. Existing users
are encouraged to migrate to --vhost-vsock-device.

BUG=b:218223240
TEST=cargo test -p devices vsock::tests::params

Change-Id: Ifad2b7ad0824d4f24d9b12a4af1448557fadcdc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3564224
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-04-28 23:05:29 +00:00