Commit Graph

8 Commits

Author SHA1 Message Date
Alan Stokes 6d1f56e17a Check in stub.c
Add a copy of the generated stub.c, for use in other build
systems. Add a readme to explain why, and how to update.

Bug: 259237660
Test: n/a
Change-Id: If4aba724b9addf3b67ea125777f668b7c908717d
2022-12-07 11:49:59 +00:00
Shikha Panwar ddc124b675 Implement native method getEncryptedStoragePath()
AVmPayload_getEncryptedStoragePath will return path to encrypted storage
if present, otherwise it will return NULL pointer.

The existence of ENCRYPTEDSTORE_MOUNTPOINT path is sufficient to
determine this. This is because Microdroid manager passes this path as
the mountpoint to encryptedstore & waits for it before starting
vm_payload_service.

Bug: 254454578
Test: build succeeds
Change-Id: Ifdfe1b97f08fc2e3f84ba1e49e6ca3e25e0013fc
2022-11-30 11:55:22 +00:00
Alan Stokes bcc2ec27fe libvm_payload as a cc_library
Define a symbole file for libvm_payload, and request stubs. Make sure
the clients build against the stubs.

Mark the implementation as not required, to prevent the missing
dependencies check triggering; it is actually present at runtime
inside Microdroid.

Bug: 243512108
Bug: 255920361
Test: atest MicrodroidTests
Test: composd-cmd test-compile
Change-Id: I78c33b6fba706fd0e52435ac13d02a25171862f1
2022-11-28 11:15:29 +00:00
Alan Stokes e0945ad0e4 RPC Server never returns
In normal operation AVmPayload_runVsockRpcServer should never return -
the calling thread joins the server's thread pool, and we provide no
way to shut down the server. If the server does exit, that indicates a
failure somewhere.

If there is a failure of any sort (including unexepected server exit)
there is nothing the caller can do, so we panic rather than returning
a bool.

Update callers to not expect a return value.

I got slightly carried away and also:
- Modified compsvc to use AVmPayload_runVsockRpcServer rather than
  rolling its own.
- Turned on unsafe_op_in_unsafe_fn in the API implementation. That
  requires us to explicitly mark unsafe blocks in unsafe functions, so
  I've gone through and done that. I checked that all the top-level
  functions that should be marked unsafe are.

Bug: 243512108
Test: atest MicrodroidTests
Test: composd_cmd test-compile
Change-Id: I447ce0baa09d6a244ffe2ba7ab08092be3cd0f82
2022-11-25 10:14:14 +00:00
Treehugger Robot 338e0281d3 Merge "Panic on non-actionable failures" 2022-11-24 11:05:16 +00:00
Alan Stokes 65bbb91d48 Panic on non-actionable failures
This is based on Michael's comments on aosp/2280849. For methods which
should never fail unless the VM is already dying, and for which
clients cannot take any meaningful action, panic instead of returning
false. Make sure we log the cause first.

Update client code to match. Update doc comments in the header file.

Also clarify that calling notify read more than once is harmless
(otherwise it would panic).

Incidentally, rename vs_payload_service.rs because it was confusing me
(we have a file of the same name in microdroid manager which actually
implements the service.)

Changes to AVmPayload_runVsockRpcServer will come later.

Bug: 243512108
Test: atest MicrodroidTests
Test: composd_cmd --test-compile
Change-Id: Ie6f6203ba54246cac669f4a68e8ab76f0a5792ae
2022-11-23 15:36:11 +00:00
David Brazdil 73988ea300 Run RpcBinder server for each VM on port==CID
Change CID allocation to allocate CIDs in the 0-65535 range (same as
ports), with the first 2048 reserved for platform use (such as port
2000 for tombstone receiver). Then run VirtualMachineService on the
same port as the VM's CID.

Change microdroid_manager to find the local CID and use it as port
number.

The host server will currently accept connections from all VMs. This
will be addressed in a follow-up CL.

Bug: 245727626
Test: atest -p packages/modules/Virtualization:avf-presubmit
Change-Id: Ia4c8448f76a0aa015658d6220c11fa73a8da8e73
2022-11-23 14:21:40 +00:00
Alan Stokes 06cba6fd5f Move vm_payload to the top level
Makes it more visible, and easier to expose to potential clients.

Bug: 243512108
Test: atest MicrodroidTests
Change-Id: I79c4724fac0df6c29761d4b4c2eb85362f588fe5
2022-11-23 09:44:17 +00:00