Commit Graph

3685 Commits

Author SHA1 Message Date
Treehugger Robot 9679c6b0c1 Merge "Rename method: Drop the "device", it's cleaner" 2022-03-09 17:28:37 +00:00
Alan Stokes 378f7387ab Use default VM memory size except when compiling
The effect of this is that the VM started by compos_verify is smaller,
as well as only using 1 CPU. (It does very little, so this should be
fine.)

And that should reduce its impact on boot time.

Compilation: "--mem" "1024" "--cpus" "8"
Verification: "--mem" "1024" "--cpus" "8"

Bug: 220824234
Test: staged-apex-compile, reboot, check logs.
Change-Id: I1101965fb532abe7923ec133920d62f5eacfd108
2022-03-09 15:15:23 +00:00
Alan Stokes e77f6010dd Rename method: Drop the "device", it's cleaner
Bug: 218276733
Test: Still builds
Change-Id: I2e6568d103b218ecced5e95723244f6c9d061324
2022-03-09 13:46:00 +00:00
Victor Hsieh 03ef64b482 Merge changes Ib3fd9047,I3126932f,I3450f496
* changes:
  fd_server: use RwLock instead of Mutex
  authfs: use RwLock instead of Mutex
  Only read backing file if chunk index is in range
2022-03-08 16:36:32 +00:00
Treehugger Robot 8a118270e6 Merge "Fix explicit checks for /dev/kvm" 2022-03-08 09:10:19 +00:00
Victor Hsieh bf944d734b fd_server: use RwLock instead of Mutex
`nix::dir::Dir` isn't Sync (required by `RwLock`), so I had to replace
it with `OwnedFd`.

Bug: 220386264
Test: atest AuthFsHostTest
Test: performance change before vs after is hard to tell
Change-Id: Ib3fd9047970a856b532234f0bebad652172e12de
2022-03-08 00:06:22 +00:00
Victor Hsieh 0520f447ee authfs: use RwLock instead of Mutex
Bug: 220386264
Test: Observed faster parallel file reads (at least not much slower,
      possibly due to lock contention), with prototype of multithread
      support.
Change-Id: I3126932f9b3c769756ec1123e4746d3d1de88a1e
2022-03-07 22:41:30 +00:00
Victor Hsieh 887b25074a Only read backing file if chunk index is in range
If the chunk index is out of range (which can be a valid read request),
simply return 0. Previously, we had to deal with fd_server when it
returned an unexpected result. Now we don't need to handle it (the
inconsistant state may still be on Android, but we don't care here).

Bug: 221847239
Test: atest AuthFsHostTest
Change-Id: I3450f496de58f2933fb3818b42e9510c56875061
2022-03-07 20:41:44 +00:00
Treehugger Robot 2e97d869f7 Merge changes I89c9c96d,I9c7b68d5,I6b3f2b0c am: 8c5e23c396
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2008219

Change-Id: Ia94cbe02a133fbbfb0ecbb5a51759fc3568b5f0b
2022-03-07 20:28:46 +00:00
Treehugger Robot 8c5e23c396 Merge changes I89c9c96d,I9c7b68d5,I6b3f2b0c
* changes:
  Fix test action that tampered file at wrong offset
  Verify the last incomplete chunk on resize
  Verify read_chunk for writable file
2022-03-07 20:03:32 +00:00
Victor Hsieh 5222a2d136 Fix test action that tampered file at wrong offset
The implementation in writeZerosAtFileOffsetOnMicrodroid specifies the
offset of the output file by "skip" of "dd". But actually, "skip" is for
"if=", while "seek" is for "of=". The test expectation did not fail
coincidentally.

Bug: N/A
Test: testWriteFailedIfDetectsTampering
Change-Id: I89c9c96d250f4374e51a01c986aa1289b24ac236
2022-03-07 17:16:53 +00:00
Victor Hsieh afdfd0ef42 Verify the last incomplete chunk on resize
Bug: 221847239
Test: AuthFsHostTest
Change-Id: I9c7b68d51faac3e34053d6fbf5d3eeb9f702c7e8
2022-03-07 17:16:51 +00:00
Victor Hsieh 3e35f9a5ef Verify read_chunk for writable file
A new test case is added. Besides, fix a side effect in
testWriteThroughCorrectly that truncates the backing by mistake (though
doesn't affect the purpose of the case).

Bug: 221847239
Test: atest AuthFsHostTest
Change-Id: I6b3f2b0c964c42b6bace94ff04b4f5edbc2d9efd
2022-03-07 17:15:50 +00:00
Alan Stokes 12e0a8e0b5 Don't check for /dev/kvm etc am: 459a5da940
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2010756

Change-Id: I71f28092ffff46b1d84a4f1d8bfe74f117a48ac2
2022-03-07 14:51:10 +00:00
Alan Stokes 459a5da940 Don't check for /dev/kvm etc
Check the properties instead (capability not implementation).

Bug: 218276733
Test: atest VirtualizationTestCases.64
Change-Id: Ifa5d463effb09b30d0166c0bfde13da86978d90c
2022-03-07 12:21:43 +00:00
Alan Stokes e61e324c9a Fix explicit checks for /dev/kvm
We should use the system properties instead (check for capability not
implementation). And we should use the new utilities to do so.

Bug: 218276733
Test: m ComposHostTestCases AuthFsHostTest MicrodroidHostTestCases
Test: atest ComposHostTestCases
Change-Id: I5db819dd874487310a40cb6736f873d3b6273ecd
2022-03-07 11:59:00 +00:00
Treehugger Robot 0f40262629 Merge "Pass serial device to VM to report failure reason." am: 83b1276592
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1997007

Change-Id: I71ee955ec8531a2611114393b9ed70d0a3ae0fa0
2022-03-03 13:05:26 +00:00
Treehugger Robot 83b1276592 Merge "Pass serial device to VM to report failure reason." 2022-03-03 12:48:33 +00:00
Treehugger Robot 4a2b7a9fc5 Merge "Remove JSON schema helper classes" am: 465e8fccb5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2005291

Change-Id: I2aab9593755758f51655c31dbb31d4af5da4058c
2022-03-03 10:08:31 +00:00
Treehugger Robot 465e8fccb5 Merge "Remove JSON schema helper classes" 2022-03-03 09:00:52 +00:00
Inseob Kim 6a15d0b5ff Add pvmfw data compromise test am: cae3c3197c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1998181

Change-Id: I6fcbfb0454ec051cafdbad0b442e31b037161185
2022-03-03 06:39:55 +00:00
Inseob Kim 2ba30bae2e Ensure that u-boot data is missing in non-pVM am: 3eb0a6d5ed
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2000670

Change-Id: I5f100c5d3a3f8cca9b58eebbf2f480b6855cacf1
2022-03-03 06:39:54 +00:00
Inseob Kim c0fe6d3345 Split instance.img compromise tests am: 87751bba76
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1998180

Change-Id: Ibd7761dee7992637619b8d06083f435fe85fbb21
2022-03-03 06:39:53 +00:00
Inseob Kim cae3c3197c Add pvmfw data compromise test
Bug: 218461230
Test: atest MicrodroidTests
Change-Id: Iccf97c822f1043f866b49f9c7e258a8cac1a3f32
2022-03-02 17:11:23 +09:00
Inseob Kim 3eb0a6d5ed Ensure that u-boot data is missing in non-pVM
u-boot uses instance disk only when protected VM.

Bug: 218461230
Test: atest MicrodroidTests
Change-Id: I66956f3b4a5c6bf6d134662d4ede652f46e2dcc3
2022-03-02 17:11:14 +09:00
Jooyung Han 3cf209411c Remove JSON schema helper classes
This removes schema-mapped Java classes which are duplication with
Rust's mapping type.

Bug: 221368644
Test: atest MicdrodroidHostTestCases
Change-Id: I8d2fe9ac21a887543adb05298ddaaae0b413d490
2022-03-02 06:04:51 +00:00
Inseob Kim 87751bba76 Split instance.img compromise tests
For better readability.

Bug: 218461230
Test: atest MicrodroidTests
Change-Id: I80116b978f520092dc1f6e1c9ecbe889fd62d569
2022-03-02 09:52:14 +09:00
Charisee Chiw 9522025c12 Merge "Changes for the Rust 1.59.0 update" am: b3c8bf85dd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2000464

Change-Id: Iaa01484beb1ad3730471aaf7a0026b0b783e6806
2022-03-01 18:41:38 +00:00
Charisee Chiw b3c8bf85dd Merge "Changes for the Rust 1.59.0 update" 2022-03-01 18:17:00 +00:00
Andrew Walbran b27681f6b0 Pass serial device to VM to report failure reason.
Add DeathReason variants for various verification failure possibilities.

Bug: 220071963
Change-Id: I2b014fcd48fa571d9e2089fde09f8199955a9e7f
2022-03-01 13:03:24 +00:00
Charisee 2e0ded0cba Changes for the Rust 1.59.0 update
bug: 215232614
Test: TreeHugger and compiling with m rust
Change-Id: I8d2d37657a3b1b2afdc1f1594d1065ead0b2548f
2022-02-28 21:41:06 +00:00
Pierre-Clément Tosi bb2fa34d40 Drop prebuilt files to android source tree. am: 91c31c90c1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2002292

Change-Id: Iaf8e6fd1cba4daa481e98406ea9f02c829410d6f
2022-02-28 21:00:43 +00:00
Pierre-Clément Tosi 91c31c90c1 Drop prebuilt files to android source tree.
pvmfw.img

Built here: ab/8231605


The change is generated with prebuilt drop tool.

Bug: 217161634
Test: boot a VM
Change-Id: I31c7ce92c01fc7afae86a9b3b39bda7aead147fd
2022-02-28 17:53:16 +00:00
Treehugger Robot 3147213723 Merge "VS: Log to system log" am: c421b5366d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1999391

Change-Id: Id86f877f0fcb04d5f7f041b63144ff0644e24376
2022-02-28 11:46:39 +00:00
Treehugger Robot c421b5366d Merge "VS: Log to system log" 2022-02-28 11:28:02 +00:00
Treehugger Robot 0facf0545a Merge "sign_virt_apex: do not use truncate (/usr/bin)" am: 62e07dcd94
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/2000671

Change-Id: I87b05956e27aa68c31ef68c246252a5485ac869f
2022-02-26 02:17:50 +00:00
Treehugger Robot 62e07dcd94 Merge "sign_virt_apex: do not use truncate (/usr/bin)" 2022-02-26 02:00:03 +00:00
Jooyung Han dcb0b49c1f sign_virt_apex: do not use truncate (/usr/bin)
We've found signing can be run where truncate is not available.
Error:

  No such file or directory: 'truncate'

Use python's truncate() instead.

Bug: 193504286
Test: atest sign_virt_apex_test
Change-Id: I9c8a78ba381274b406ba509f5f3f7ddd049bd60f
2022-02-26 09:04:17 +09:00
Alan Stokes 9c069a41f0 VS: Log to system log
We run VS at early boot (via compos_verify), and we want to see its
logs in case something interesting happens. That seems to require
using the sytem log.

Bug: 215419883
Test: Run staged-apex-compile, reboot, see logs
Change-Id: I24c55196b5403df3057c690691f0f585c4a8f2fc
2022-02-25 16:10:23 +00:00
Jiyong Park eef868ad63 Specify virtual platform version and enforce it am: dcf1741a18
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1976386

Change-Id: I0934e1d86fa20e9448281ca12bfa0c0357f4e3a7
2022-02-25 10:19:57 +00:00
Jiyong Park dcf1741a18 Specify virtual platform version and enforce it
VM config can now specify the requirement on the virtual platform
version. At runtime, the requirement is matched against the actual
virtual platform version that crosvm implements. If they don't match,
the VM can't be created. The version format follows SemVer, allowing us
to express backwards compatible and incompatible changes in the future.

Bug: 193504487
Test: atest VirtualizationTestCases
Change-Id: I23d370081e10399502178b9cfe8a46b05addf186
2022-02-25 16:21:22 +09:00
Treehugger Robot 2e8b1b7a60 Merge "Remove VirtualizationTestCases from CTS" am: 6817d52ace
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1999390

Change-Id: I4e67526cefeebc69e9857046edc375c745fc934f
2022-02-25 00:17:58 +00:00
Treehugger Robot 6817d52ace Merge "Remove VirtualizationTestCases from CTS" 2022-02-24 23:54:24 +00:00
David Brazdil 7600c410c2 Remove VirtualizationTestCases from CTS
The test needs root to run and does not add much over
MicrodroidHostTestCases. Remove it from the CTS suite.

Bug: 218750257
Test: run CTS
Change-Id: I084e43058da5ec05c330c6f08e86a1f0b0a1b1e5
2022-02-24 17:26:46 +00:00
Jooyung Han 004b8f3c66 Embed test-purpose APEXes as data am: 528a368dc9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1998174

Change-Id: If5d01040b01f6fe6bb45474e28cb35c8f40f0f62
2022-02-24 11:52:50 +00:00
Treehugger Robot 747c6ef60e Merge "Test: bootloader checks vbmeta signing key" am: 1d06a6dcac
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1996652

Change-Id: I230e971db22820d96ce3d068dd39aa0f31c25bb1
2022-02-24 04:23:46 +00:00
Jooyung Han 528a368dc9 Embed test-purpose APEXes as data
On Pixel devices, adbd/statsd apexes have different names, which causes
`pm path` to fail.

Instead, embed test-purpose APEXes as data and use them for testing.
This can also provide isolation for the testing environment.

Bug: 221024307
Test: atest MicrodroidHostTestCases (on internal branches)
Change-Id: I4a71ea662e789d48bdbdf2008bbdd666778a72fe
2022-02-24 13:08:39 +09:00
Treehugger Robot 1d06a6dcac Merge "Test: bootloader checks vbmeta signing key" 2022-02-24 03:52:48 +00:00
Jooyung Han 1c3d2fae40 Test: bootloader checks vbmeta signing key
Bootloader fails when its embedded key doesn't match with vbmeta's
signing key.

Note that VM itself doesn't shut down even when boot fails for now.
It should shut down the VM just like pvmfw does.

Bug: 218934597
Test: atest MicrodroidHostTestCases
Change-Id: I8bfef33d3aafe72f672c035fe796d8636bc95e1c
2022-02-24 10:20:41 +09:00
Treehugger Robot 1fd2e5adaf Merge "Add --prefer-staged to composd_cmd test-compile" am: 84e839294e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Virtualization/+/1995890

Change-Id: I93e7f889e4b93bb3f0d445ac56814f2aa496a549
2022-02-23 19:44:51 +00:00