Move permission checks to global VS

When a client sends a request to virtmgr, it checks the client's
corresponding permission. Handling the request may later require calling
into VirtualizationServiceInternal (global VS), at which point no more
checks are performed as the only domain allowed to call it is virtmgr.

We can make this a little neater by moving the permission check to
the global VS and let virtmgr propagate the error if it fails. This way
we do not need to assume virtmgr is the only domain that calls VS.

This works for:
 * create VM => check MANAGE_VIRTUAL_MACHINE in VS when VM context is
   allocated
 * debug list VMs => check DEBUG_VIRTUAL_MACHINE in VS

On the other hand, it does not work for USE_CUSTOM_VIRTUAL_MACHINE,
which can only be checked in virtmgr.

We also keep checking MANAGE_VIRTUAL_MACHINE for virtmgr operations that
create idsig/instance.img/encrypted store. These do not perform any
privileged operations but we keep them for API consistency.

Bug: 245727626
Test: atest -p packages/modules/Virtualization:avf-presubmit
Change-Id: I5bc5e73ec72173d5422f27cec91b6227a11f744d
1 file changed
tree: b205810c44d4d1a4f8ec227c96d662608ea533f7
  1. apex/
  2. apkdmverity/
  3. authfs/
  4. avmd/
  5. compos/
  6. demo/
  7. docs/
  8. encryptedstore/
  9. javalib/
  10. launcher/
  11. libs/
  12. microdroid/
  13. microdroid_manager/
  14. pvmfw/
  15. rialto/
  16. tests/
  17. virtualizationservice/
  18. vm/
  19. vm_payload/
  20. vmbase/
  21. vmclient/
  22. zipfuse/
  23. .clang-format
  24. .gitignore
  25. Android.bp
  26. OWNERS
  27. PREUPLOAD.cfg
  28. README.md
  29. TEST_MAPPING
README.md

Virtualization

This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.