Commit graph

18 commits

Author SHA1 Message Date
Shikha Panwar
c9b992126c Revert^2 "virtualizationmanager is a client of secretkeeper"
It ferries SecretManagement messages to/from Sk. Reflect this is
sepolicies.

Test: With topic, check selinux denials
Bug: 291213394
Change-Id: Ia0d25e46232d56c59fb18f8642767bfa2d5ffab1
2023-12-15 11:23:54 +00:00
Trevor Black
dcef23db69 Revert "virtualizationmanager is a client of secretkeeper"
Revert submission 2705357-sk_vm

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_aosp-main-with-phones&target=aosp_oriole-trunk_staging-userdebug&lkgb=11221468&lkbb=11221626&fkbb=11221480

Reverted changes: /q/submissionid:2705357-sk_vm

Bug: 316391577
Change-Id: Ibc92e4b2c578cdf210e873d82af0f413d6a37dc0
2023-12-14 20:29:33 +00:00
Shikha Panwar
e6c5f205e0 virtualizationmanager is a client of secretkeeper
It ferries SecretManagement messages to/from Sk. Reflect this is
sepolicies.

Test: With topic, check selinux denials
Bug: 291213394
Change-Id: I0acc06424eb834d66a85f9d4f6b8b632d95c4190
2023-12-14 17:05:16 +00:00
Seungjae Yoo
ed25d9436d vendor_microdroid_file shouldn't be overwrited
If malicious process in the host overwrites microdroid vendor image,
unexpected behavior could be happened.

Bug: 285854379
Test: adb shell /apex/com.android.virt/bin/vm run-microdroid --vendor /vendor/etc/avf/microdroid/microdroid_vendor.img

Change-Id: I18ce5112b75b2793c85bb59c137715beb602a5f3
2023-11-28 11:20:18 +09:00
Seungjae Yoo
d2a0892121 Introduce vendor_microdroid_file for microdroid vendor image
In AVF, virtualizationmanager checks the selinux label of given disk
image for proving whether the given image is edited maliciously.
Existing one(vendor_configs_file, /vendor/etc/*) was too wide to use for this purpose.

Bug: 285854379
Test: m
Change-Id: I6c966c92b238a2262d2eb7f41041ed4c359e9e0a
2023-11-16 16:44:15 +09:00
Treehugger Robot
3e4b7bf2ce Merge "[service-vm] Adjust sepolicy for running service VM" into main 2023-09-04 17:10:03 +00:00
Alice Wang
e1bb7d02e1 Merge "[avf] Fix warning when runnning Microdroid" into main 2023-09-04 15:18:49 +00:00
Alice Wang
40519f79dc [service-vm] Adjust sepolicy for running service VM
Bug: 278858244
Test: Runs the ServiceVmClientApp in VM
Test: atest MicrodroidHostTests
Change-Id: Ia59fe910edc0826aa5866468c27558e9d190b58d
2023-09-04 13:01:53 +00:00
Alice Wang
ea51816b10 [avf] Fix warning when runnning Microdroid
This cl fixes the following selinux denial:

09-04 10:15:34.544  3393  3393 W binder:3393_2: type=1400 audit(0.0:17): avc:  denied  { getattr } for  path="socket:[99352]" dev="sockfs" ino=99352 scontext=u:r:virtualizationmanager:s0 tcontext=u:r:adbd:s0 tclass=unix_stream_socket permissive=0

Test: Runs the ServiceVmClientApp
Change-Id: I5f69bc966f8e136dab19d1fdc0bc79190bef5ca5
2023-09-04 12:26:03 +00:00
Jaewan Kim
796ec5f0cb Set neverallow for hypervisor test properties
Bug: 298306391
Change-Id: I754af47d063bb26549cd1793951b09262cadd95a
Test: TH
2023-09-01 07:55:09 +00:00
Jaewan Kim
4183cbb63c Label hypervisor test properties
Bug: 298306391
Change-Id: I160101325989f58ef3403ec5be20895468c2ccbb
Test: TH, atest CustomPvmfwHostTestCases
2023-09-01 02:43:38 +00:00
Inseob Kim
bbe514d9b3 Use regular file for VM DTBO
Bug: 287379025
Test: adb shell /apex/com.android.virt/bin/vm run-microdroid \
      --protected --mem 512 --devices \
      /sys/bus/platform/devices/16d00000.eh
Change-Id: Id77c25f5f22672da9281078fc17f45087d893f4d
2023-08-04 15:26:17 +09:00
Inseob Kim
825056de9a Add permission for VFIO device binding
vfio_handler will bind platform devices to VFIO driver, and then
return a file descriptor containing DTBO. This change adds
permissions needed for that.

Bug: 278008182
Test: adb shell /apex/com.android.virt/bin/vm run-microdroid \
      --devices /sys/bus/platform/devices/16d00000.eh --protected
Change-Id: Ie947adff00d138426d4703cbb8e7a8cd429c2272
2023-08-02 15:06:51 +09:00
Alan Stokes
6d019be31f Allow VMs to log to shell pts
If we run a VM from an adb shell, e.g. via `vm run`, then we would
like to get the VM console & log sent to the shell console.

That doesn't work unless virtualization manager & crosvm can write to
devpts.

Bug: 286355623
Test: Manual: adb shell, /apex/com.android.virt/bin/vm run-microdroid --debug full
Change-Id: I01b233bc6ad5fba8f333f379af62a03806ae8949
2023-06-08 13:47:38 +01:00
Jaewan Kim
0783a9cd36 Allow virtualizationmanager to open test artifacts in shell_data_file
Bug: 275047565
Test: atest
Change-Id: Iff9bdd4434a66af0e17fb74da4f173158dd66399
2023-04-03 15:46:26 +09:00
Jaewan Kim
93f5788ec5 Allow virtualizationmanager to read AVF debug policy
virtualizationmanager may handle some AVF debug policies for unproteted VM.

Bug: 243630590
Test: Run unprotected VM with/without ramdump
Change-Id: I2941761efe230a9925d1146f8ac55b50e984a4e9
2023-02-07 02:04:02 +09:00
Alan Stokes
c5b914670f Suppress harmless denial
Commit 2d736569e716b5c143f296ae124bcfed9630a4d2 improved the logging
in virtualization service by attempting to get the real path from
/proc/self/fd/N for various files.

However, CompOS stores its log files in a directory
(/data/misc/apexdata/...) which VS has no access to, triggering an
SELinux denial:

avc: denied { search } for name="apexdata"
scontext=u:r:virtualizationmanager:s0
tcontext=u:object_r:apex_module_data_file:s0 tclass=dir

Suppress this denial, since it causes no harm (we just don't log the
real path).

Bug: 264496291
Bug: 251751405
Test: composd_cmd test-compile;
 see no denials
Change-Id: Ia55e593c0c0735b8f3085a964f0c789c177375f2
2023-01-09 11:34:52 +00:00
David Brazdil
55d808c28c Start using virtmgr for running VMs
Split virtualizationservice policy into rules that should remain with
the global service and rules that now apply to virtmgr - a child process
of the client that runs the VM on its behalf.

The virtualizationservice domain remains responsible for:
 * allocating CIDs (access to props)
 * creating temporary VM directories (virtualization_data_file, chown)
 * receiving tombstones from VMs
 * pushing atoms to statsd
 * removing memlock rlimit from virtmgr

The new virtualizationmanager domain becomes responsible for:
 * executing crosvm
 * creating vsock connections, handling callbacks
 * preparing APEXes
 * pushing ramdumps to tombstoned
 * collecting stats for telemetry atoms

The `virtualizationservice_use` macro is changed to allow client domains
to transition to the virtmgr domain upon executing it as their child,
and to allow communication over UDS.

Clients are not allowed to communicate with virtualizationservice via
Binder, only virtmgr is now allowed to do that.

Bug: 250685929
Test: atest -p packages/modules/Virtualization:avf-presubmit
Change-Id: Iefdccd908fc28e5d8c6f4566290e79ed88ade70b
2023-01-05 17:39:39 +00:00