Commit graph

30193 commits

Author SHA1 Message Date
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
Kelvin Zhang
4b68fb3ff5 Merge "Add sepolicy for build prop for go/vabc-xor" 2021-08-09 14:58:57 +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
Martijn Coenen
a194f2737e Merge "Allow shell to read odsign properties." 2021-08-09 06:45:56 +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
Martijn Coenen
fd6d708cc1 Allow shell to read odsign properties.
The shell context can invoke app_process (ART runtime), which in turn
reads odsign_prop to determine whether we determined that the generated
artifacts are valid. Since this was denied until now, app processes
invoked through shell would fall back to JIT Zygote. This is probably
fine, but since fixing the denial is really simple (and not risky), this
option might be preferred over adding it to the bug map.

Bug: 194630189
Test: `adb shell sm` no longer generates a denial
Change-Id: Ia7c10aec53731e5fabd05f036b12e10d63878a30
2021-08-06 08:40:40 +02:00
Kelvin Zhang
80e0d50643 Add sepolicy for build prop for go/vabc-xor
Add a new build prop for the new Vritual AB Compression with XOR
feature. This allows each lunch target to control if they want to use
the new feature.

Test: th
Bug: 177104308
Change-Id: Ibafc231daecef5e482652d1769ad0f3729206c0f
2021-08-05 18:20:03 +00:00
Bart Van Assche
cb779773b7 Merge "init.te: Allow init to modify the properties of loop devices" 2021-08-05 16:57:53 +00:00
David Anderson
f855bc1231 Merge "Allow snapuserd to inotify watch /dev/socket." 2021-08-05 16:40:57 +00:00
Inseob Kim
1644afe507 Merge changes from topic "microdroid_selinux_denial_test"
* changes:
  Suppress power_supply access inside microdroid
  Add servicemanager's service to microdroid policy
  Temporarily dontaudit ueventd->tmpfs access
2021-08-05 04:53:06 +00:00
Akilesh Kailash
c532a0fc8f Merge "snapuserd: Add selinux policy" 2021-08-05 03:02:07 +00:00
David Anderson
136b4ea873 Allow snapuserd to inotify watch /dev/socket.
snapuserd uses an inotify watch to detect when /dev/socket/snapuserd has
been created.

Bug: N/A
Test: no denials after applying OTA on cuttlefish
Change-Id: I2ca16aee84ce7648bceea5c5de32a561b932f528
2021-08-04 19:26:37 -07: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
Bart Van Assche
9059e215dc init.te: Allow init to modify the properties of loop devices
The init process configures swapping over zram over a loop device. An
I/O scheduler is associated with the loop device. Tests have shown that
no I/O scheduler works better than the default, mq-deadline. Hence
allow the init process to configure the loop device I/O scheduler.

Without this patch, the following SELinux denials are reported during
boot:

1     1 I auditd  : type=1400 audit(0.0:4): avc: denied { read write } for comm="init" name="scheduler" dev="sysfs" ino=78312 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_loop:s0 tclass=file permissive=0
1     1 I auditd  : type=1400 audit(0.0:4): avc: denied { read write } for comm="init" name="scheduler" dev="sysfs" ino=78312 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_loop:s0 tclass=file permissive=0

Bug: 194450129
Test: Built Android images and installed these on an Android device.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Change-Id: I0af0a92c53bb1f68b57f6814c431a7f03d8ea967
2021-08-04 11:48:14 -07: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
Akilesh Kailash
8494fbe048 snapuserd: Add selinux policy
Add selinux policy to allow snapuserd to search
through /dev/block/ and read /sys/block directory.

Bug: 193863442
Test: OTA on pixel
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I656aee69f4c07ed7caeb1c3c14e44e1a25bd1ba1
2021-08-04 08:40:50 +00:00
Allen Webb
8fcf4ca296 Merge "Add rules to cover memfd's for testing." 2021-08-03 13:12:07 +00:00
Inseob Kim
ebc11f6a99 Merge "Suppress keystore F2FS related audit" 2021-08-03 02:19:15 +00:00
Victor Hsieh
87441ca5f9 Merge "Allow odsign to rename & unlink CompOS files." 2021-08-02 22:44:08 +00:00
David Anderson
7c53e0e83a Merge "Allow update_engine, recovery, and fastbootd to read snapuserd properties." 2021-08-02 18:45:44 +00:00
Roshan Pius
36d7c8dff0 Merge "sepolicy: Add entry for uwb apex" 2021-08-02 15:11:31 +00:00
Alan Stokes
17ad9eb63e Allow odsign to rename & unlink CompOS files.
Write access is still denied.

Bug: 194654666
Test: No denials when testing odsign.
Change-Id: Ia9ca85e4008a1a69da0943793d310b974a8484db
2021-07-30 15:00:28 +01:00
Jooyung Han
a036ede5c6 Merge "Microdroid_manager is a bootstrap process" 2021-07-30 12:41:14 +00:00
Rick Yiu
2e8a281466 Merge "Move vendor_sched to common sepolicy" 2021-07-30 03:47:38 +00:00
Rick Yiu
b31ec34eef Move vendor_sched to common sepolicy
Previously vendor_sched is put under product area which will be replaced
by GSI. To solve it, move it to system/sepolicy.

Bug: 194656257
Test: build pass
Change-Id: Ia0b855e3a876a58b58f79b4fba09293419797b47
2021-07-30 03:01:32 +00:00
Roshan Pius
3b7716c98c sepolicy: Add entry for uwb apex
Bug: 188911079
Test: Compiles
Change-Id: Icc4886d608e75e348ad9de0f249b23602d84694a
2021-07-29 18:44:50 -07:00
Linzhao Ye
f023c126fc Merge "Add SeLinux policy for hostapd AIDL service." 2021-07-29 16:12:41 +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
514cc4db44 Merge "Allow CompOS to start a VM with its instance image." 2021-07-29 08:25:13 +00:00
Chris Ye
b7bb89b551 Add SeLinux policy for hostapd AIDL service.
Bug: 194806512
Test: Manual test wifi hotspot.
Change-Id: I12b3e93650fcc6f2ea8794970fa8cf62c0a82475
2021-07-28 23:37:46 -07:00
David Anderson
9e21df22d4 Allow update_engine, recovery, and fastbootd to read snapuserd properties.
Bug: 193833730
Test: OTA applies and boots
Change-Id: I81c089e1763a7e25b23df245f76e04acd52a337e
2021-07-28 22:30:22 -07:00
David Anderson
f595435798 Merge "Add new snapuserd socket and property rules." 2021-07-28 21:59:59 +00:00
Yi Kong
d4e150c4e5 Merge "Allow shell to read profcollect data files" 2021-07-28 20:19:18 +00:00
Yi Kong
b7bb6490df Allow shell to read profcollect data files
Also guard all profcollect related entries with userdebug/eng only and
move them into one place.

Test: manual
Bug: 183487233
Bug: 194155753
Change-Id: If3399bb78b60f0367267e67573007ed72508279a
2021-07-29 01:12:29 +08:00
Alan Stokes
d6a0995ef6 Merge "Remove compos_key_cmd from policy" 2021-07-28 16:32:34 +00: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
Alan Stokes
e2a002cd8c Allow CompOS to start a VM with its instance image.
The image will be stored under
/data/misc/apexdata/com.android.compos. Grant crosvm & virtualization
service read/write but not open access.

This fixes these denials:

avc: denied { read } for comm="Binder:3283_2" path="/data/misc/apexdata/com.android.compos/instance.img" dev="dm-34" ino=5548 scontext=u:r:virtualizationservice:s0 tcontext=u:object_r:apex_compos_data_file:s0 tclass=file permissive=1
avc: denied { getattr } for comm="virtualizations" path="/data/misc/apexdata/com.android.compos/instance.img" dev="dm-34" ino=5548 scontext=u:r:virtualizationservice:s0 tcontext=u:object_r:apex_compos_data_file:s0 tclass=file permissive=1

avc: denied { read } for comm="crosvm" path="/data/misc/apexdata/com.android.compos/instance.img" dev="dm-34" ino=5548 scontext=u:r:crosvm:s0 tcontext=u:object_r:apex_compos_data_file:s0 tclass=file permissive=1
avc: denied { getattr } for comm="crosvm" path="/data/misc/apexdata/com.android.compos/instance.img" dev="dm-34" ino=5548 scontext=u:r:crosvm:s0 tcontext=u:object_r:apex_compos_data_file:s0 tclass=file permissive=1

Test: compos_key_cmd --start /data/misc/apexdata/com.android.compos/instance.img
Test: Works in enforcing mode, no denials seen.
Bug: 193603140
Change-Id: I1137fddd02e84388af873f0e51dd080b1d803ad6
2021-07-28 14:17:20 +01:00
Martijn Coenen
359aea7d49 Merge "Allow odsign to stop itself." 2021-07-28 11:50:22 +00:00
Martijn Coenen
5f21a0fa92 Allow odsign to stop itself.
Carve out a label for the property, and allow odsign to set it.

Bug: 194334176
Test: no denials
Change-Id: I9dafefabc27c679ed9f36e617e824f44f3b16bbd
2021-07-28 10:50:35 +02:00
David Anderson
bf5b6ce422 Add new snapuserd socket and property rules.
This adds a new property prefix owned by snapuserd, for communicating
when the service is ready to accept connections (snapuserd.ready and
snapuserd.proxy_ready).

This also adds a new socket context. This is a seqpacket socket used to
communicate with a special instance of snapuserd that bridges to the
first-stage daemon.

Bug: 193833730
Test: no denials after OTA applies and boots
Change-Id: Ibad03659eba5c25e205ba00f27d0b4f98585a84b
2021-07-27 10:50:59 -07: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
Hongguang
2179e112e1 Allow Tuner AIDL sample HAL.
Bug: 191825295
Test: tuner HAL can run
Change-Id: I069da68cb4fec535c6549a9a0f89202eb17ef003
2021-07-26 11:35:18 -07:00
Jiyong Park
d59b429b63 Merge "Add rules for virtualizationservice and crosvm" 2021-07-26 13:25:39 +00:00
Jiyong Park
5e20d83cfb Add rules for virtualizationservice and crosvm
The test for the services has been running with selinux disabled. To
turn selinux on, required rules are allowed.

Below is the summary of the added rules.

* crosvm can read the composite disk files and other files (APKs,
APEXes) that serve as backing store of the composite disks.
* virtualizationservice has access to several binder services
  - permission_service: to check Android permission
  - apexd: to get apex files list (this will be removed eventually)
* Both have read access to shell_data_file (/data/local/tmp/...) for
testing purpose. This is not allowed for the user build.
* virtualizationservice has access to the pseudo terminal opened by adbd
so that it can write output to the terminal when the 'vm' tool is
invoked in shell.

Bug: 168588769
Test: /apex/com.android.virt/bin/vm run-app --log /dev/null
/data/local/tmp/virt/MicrodroidDemoApp.apk
/data/local/tmp/virt/MicrodroidDemoApp.apk.idsig
/data/local/tmp/virt/instance.img
assets/vm_config.json

without disabling selinux.

Change-Id: I54ca7c255ef301232c6e8e828517bd92c1fd8a04
2021-07-26 10:45:08 +09:00
Jiakai Zhang
329cbf4d4e Track system_server->apex_art_data_file denial.
The denial occurs when system_server dynamically loads AOT artifacts at
runtime.

Sample message:
type=1400 audit(0.0:4): avc: denied { execute } for comm="system_server" path="/data/misc/apexdata/com.android.art/dalvik-cache/arm64/system@framework@com.android.location.provider.jar@classes.odex" dev="dm-37" ino=296 scontext=u:r:system_server:s0 tcontext=u:object_r:apex_art_data_file:s0 tclass=file permissive=0

Currently, system_server is only allowed to load AOT artifacts at startup. odrefresh compiles jars in SYSTEMSERVERCLASSPATH, which are supposed to be loaded by system_server at startup. However, com.android.location.provider is a special case that is not only loaded at startup, but also loaded dynamically as a shared library, causing the denial.

Therefore, this denial is currently expected. We need to compile com.android.location.provider so that its AOT artifacts can be picked up at system_server startup, but we cannot allow the artifacts to be loaded dynamically for now because further discussion about its security implications is needed. We will find a long term solution to this, tracked by b/194054685.

Test: Presubmits
Bug: 194054685

Change-Id: I3850ae022840bfe18633ed43fb666f5d88e383f6
2021-07-24 09:42:03 +08:00
Kalesh Singh
792d519b56 Merge changes from topic "suspend-aidl-1"
* changes:
  sepolicy: Update wakelock_use macro
  sepolicy: Serve suspend AIDL hal from system_suspend
2021-07-23 17:16:28 +00:00