Commit graph

77 commits

Author SHA1 Message Date
Treehugger Robot
037a21ba15 Merge "Add /dev/vsock permissions to microdroid" 2021-08-24 23:35:34 +00:00
Inseob Kim
2e0fb00f22 Add /dev/vsock permissions to microdroid
microdroid_manager needs to know its own CID until the full RPC binder
support is landed.

Bug: 191845268
Test: run MicrodroidDemoApp
Test: atest MicrodroidHostTestCases
Change-Id: I8f6c667f0827d1089baa21417c2b0ba382d94d26
2021-08-24 14:23:18 +09:00
Victor Hsieh
dedb4909c3 Remove unnecessary privileges from dex2oat in VM
With a change in dex2oat to avoid opening /proc/self/fd, this change
removes open and a few other privileges from dex2oat.

Bug: 196404749
Test: ComposHostTestCases
Change-Id: I822c7ef3886a1cde8601e71afa2eb79973cd573c
2021-08-19 14:01:59 -07:00
Victor Hsieh
5f6e4324b3 Allow compos to getattr on authfs
Bug: 161471326
Bug: 196635431
Test: ComposTestCase
Change-Id: I3a4073726d31686c8eb945ba9417cb2afe238d79
2021-08-13 15:48:21 -07:00
Treehugger Robot
1ca4b5c045 Merge "Define sepolicy for compos and dex2oat" 2021-08-12 14:27:09 +00:00
Victor Hsieh
aa987aaa2d Define sepolicy for compos and dex2oat
Bug: 194474784
Test: ComposTestCase # with debug disabled
Change-Id: I2a53df337356fc8e299837358da2a5a88c9c20d3
2021-08-11 10:42:19 -07:00
Victor Hsieh
5f7c02328c Grant authfs_service and authfs CAP_SYS_ADMIN
CAP_SYS_ADMIN is required to mount a filesystem (currently in authfs, a
child process of authfs_service). It seems the parent also needs to be
allowed.

Bug: 194474784
Test: Use the service (from compsvc), no longer seeing the denials
Change-Id: I122734ee9f11899af4d7b647bc3049e4dbdad09e
2021-08-11 15:48:14 +00:00
Victor Hsieh
a70e6052c2 Allow authfs_service to add itself to service manager
Fixes: 196018177
Test: atest MicrodroidHostTestCases
Change-Id: Ib47b8bf5d5d683e7f163e8f69d8a06ffe8f2675b
2021-08-10 10:55:54 -07:00
Jooyung Han
996da475a1 Merge "microdroid_manager: allow to read dm_device" 2021-08-09 17:49:16 +00:00
Victor Hsieh
14aad3711d Merge "SELinux policy for authfs_service and authfs" 2021-08-09 17:12:22 +00:00
Jooyung Han
797acf9072 Don't audit microdroid_app getattr vsock_socket
Microdroid_manager creates a vsock socket and app's output is redirected
to it.

Bug: 195751698
Test: MicrodroidHostTestCases
Change-Id: I66759067169cc97a6c1fc084395761e06c6e20f6
2021-08-09 12:50:41 +00:00
Victor Hsieh
49c0ec7a67 SELinux policy for authfs_service and authfs
authfs_service is a binder service on microdroid. Upon a request by the
client, the service will create the mount directory, execute authfs to
mount the FUSE, and finally unmount and delete the mount directory.

authfs currently requires more privileges than it should, but it's ok
because the client owns the VM, and all input will be verified by
signatures. But there is plan to keep the privileges isoated in the
service (b/195554831).

Bug: 194717985
Bug: 195554831
Test: Start the service from init, use a test executable to call the
      service API. Only observed denial from the test executable.
Change-Id: Ie53aa9e2796433fc3182357039d0b7ba1c0848ef
2021-08-06 09:16:48 -07:00
Jooyung Han
2ac60775e0 microdroid_manager: allow to read dm_device
Microdroid_manager should verify payloads(APK/APEXes). APK is mounted to
dm_device first and then verified. So, microdroid_manager needs to read
it.

Bug: 190343842
Test: MicrodroidHostTestCases
Change-Id: I530fb8d2394952486f0bad7fb3bed770611cd311
2021-08-07 00:52:00 +09:00
Inseob Kim
7687600c50 Suppress power_supply access inside microdroid
Bug: 193118220
Test: atest MicrodroidHostTestCases
Change-Id: I3dbdcb831c61e9bd24cfdaa10beba9e856e605af
2021-08-05 02:05:16 +00:00
Inseob Kim
2f4b03654a Add servicemanager's service to microdroid policy
Bug: 193118220
Test: atest MicrodroidHostTestCases
Change-Id: I0e57fa913fe857626634f94502b1ad5a0989bdc8
2021-08-04 11:35:57 +00:00
Inseob Kim
0abc4fdf2b Temporarily dontaudit ueventd->tmpfs access
This is the only blocker for SELinux denial test on microdroid. Rather
than consuming more time, this temporarily suppresses the audit message
to turn on the test.

Bug: 193118220
Test: atest MicrodroidHostTestCases -c
Change-Id: Id703107cbaae42352bebe34d0a6373f0701c0f6f
2021-08-04 10:58:22 +00:00
Inseob Kim
ebc11f6a99 Merge "Suppress keystore F2FS related audit" 2021-08-03 02:19:15 +00:00
Inseob Kim
6b5eafedf9 Suppress keystore F2FS related audit
keystore uses sqlite3. sqlite3 calls F2FS_IOC_GET_FEATURES. As
microdroid has nothing to do with that, we just suppress the audit.

Bug: 193118220
Test: atest MicrodroidHostTestCases
Change-Id: I1da00d1fd4b7e208e80a1d9bc5f49c21af684516
2021-07-29 12:18:31 +00:00
Jooyung Han
f9a7dab645 Microdroid_manager is a bootstrap process
Bug: 190343842
Test: MicrodroidHostTestCases
Change-Id: Iaec029726a34f46fd9123d34765a20a1c5dd254a
2021-07-29 17:40:05 +09:00
Alan Stokes
80bb558584 Remove compos_key_cmd from policy
It's a test tool which is generally run as root, and will be deleted
eventually. It doesn't need its own label; system_file works fine.

We never actually allowed it anything, nor defined a transition into
the domain.

Bug: 194474784
Test: Device boots, no denials
Test: compos_key_cmd run from root works
Change-Id: If118798086dae2faadeda658bc02b6eb6e6bf606
2021-07-28 14:36:50 +01:00
Inseob Kim
1f87fbd9fa Add microdroid_payload attribute
microdroid_payload attribute is for processes meant to be run by
microdroid_manager as a payload. Other than microdroid_payload and
crash_dump, transition from microdroid_manager will not be permitted.

Bug: 191263171
Test: atest MicrodroidHostTestCases
Test: atest ComposHostTestCases
Change-Id: I959a8ad8ed83c8de254d7af61fd30bcbffe6b070
2021-07-27 08:30:22 +00:00
Alan Stokes
72cac09097 Add rules for dex2oat.
This is necessary (but not sufficient) to allow CompOsTestCase to
run. Without it we have problems because
system/sepolicy/apex/com.android.art-file_contexts references
dex2oat_exec, and we get an error:

SELinux : Context u:object_r:dex2oat_exec:s0 is not valid (left unmapped).

Bug: 194474784
Test: atest CompOsTestCase (with memory fix patched in)
Change-Id: If229b9891c8fb1acce8d0502675c1712bfed180c
2021-07-23 12:26:26 +01:00
Treehugger Robot
6a4bc81a2b Merge changes I43bf09d8,I1fd35d0e
* changes:
  Disallow microdroid from running arbitrary domains
  Add domain for compos binaries
2021-07-23 09:29:53 +00:00
Inseob Kim
a89d6aa301 Disallow microdroid from running arbitrary domains
Test: atest MicrodroidHostTestCases
Test: atest ComposHostTestCases
Change-Id: I43bf09d85efa4276e929babd854c49ccedfd8058
2021-07-23 06:58:52 +00:00
Jiyong Park
f326072b40 Add more rules around cgroup files in microdroid
The added rules are copied from Android.

Bug: 193118995
Bug: 193118220
Test: adb shell /apex/com.android.virt/bin/vm run-app
/data/local/tmp/virt/MicrodroidDemoApp.apk
/data/local/tmp/virt/MicrodroidDemoApp.apk.idsig
/data/local/tmp/virt/instance.img assets/vm_config.json doesn't show
a selinux denial like the below:
avc:  denied  { create } for  pid=1 comm="init" name="cpus"
scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file
permissive=0

Change-Id: I3d958e4788fdee5993ff1048e86b81cd93b72b03
2021-07-23 15:48:17 +09:00
Inseob Kim
7560aed40a Add domain for compos binaries
Bug: 191263171
Test: atest MicrodroidHostTestCases
Test: atest ComposHostTestCases
Change-Id: I1fd35d0efe83d2cecaa41580e6d1d0b8f6242b3f
2021-07-23 06:01:39 +00:00
Inseob Kim
e1389977e0 Move microdroid sepolicy to system/sepolicy
Bug: 190511750
Test: boot microdroid
Change-Id: I4aa4a56e9be5103d70469c3508110a973f3e4f12
2021-07-19 07:48:34 +00:00