Commit graph

154 commits

Author SHA1 Message Date
Inseob Kim
9dd70bc942 Merge "Allow microdroid_manager to stop tombstoned" 2022-07-14 16:09:23 +00:00
Inseob Kim
fa4c5bff42 Allow microdroid_manager to stop tombstoned
If export_tombstones is false, leaving tombstoned running has no
meaning. However, we still can't selectively start tombstoned, because
post-fs-data happens eariler than config parsing. Thus, this change
allows microdroid_manager to stop tombstoned on demand.

Bug: 236588647
Test: atest MicrodroidTests
Change-Id: I813fe667f3394bdd234e204f3d35a27f3a182cb2
2022-07-13 18:59:50 +09:00
Inseob Kim
202fe3c2d6 microdroid: Remove redundant dontaudit from shell
Bug: 238135989
Test: atest MicrodroidHostTestCases
Change-Id: Ia74ee40e952ffc3bf18e1ff890efcff5219ef33a
2022-07-08 08:56:16 +00:00
Inseob Kim
3f0ea4ffde Make logd and logcat bootstrappable
Because we want to collect early kernel logs, before apexd is run.

Bug: 236451404
Test: atest MicrodroidTests
Change-Id: Id84f5b36df00394eb3444fdef5654c6ec0759faf
2022-07-06 14:51:28 +09:00
Jiyong Park
6fb4511df4 Label ro.build.version.known_codenames in Microdroid
Bug: 236602028
Test: atest ComposHostTestCases
Change-Id: I7a479f32f58964b60468b7d19c9cd9f47a334741
2022-06-21 10:59:03 +09:00
Inseob Kim
44f68942fa Allow microdroid_manager to write serial device
A serial device is used to pass failure reason to host.

Bug: 220071963
Test: atest MicrodroidTests
Change-Id: I085e902b4f0a79d3c8d2cd5c737ad169caac3659
2022-06-13 18:00:11 +09:00
Treehugger Robot
fd4b4f8c8e Merge "Selinux permissions for tombstone_transmit inside VM" 2022-05-17 17:51:44 +00:00
Shikha Panwar
2df14574fa Selinux permissions for tombstone_transmit inside VM
r.android.com/2060021 made it possible for tombstone_transmit to remove
the tombstone file from guest after reading it. This is the required
Selinux policy for that.

Bug: 232403725
Test: atest MicrodroidHostTestCases & check vm logs for avc:
denials

Change-Id: Ic071c0bd5ecb85f4ceae84e435afdec155fbba0b
2022-05-17 11:10:42 +00:00
Victor Hsieh
7026c1043b Allow odrefresh to access dalvik system properties
We recently started to forward dalvik related system properties to
CompOS for odrefresh to use.  The properties are set indeed, but we
still need to allow odrefresh to use.

Bug: 231579544
Test: Cherry pick aosp/2096406, run composd_cmd test-compile
      See ro.dalvik.vm.*, dalvik.vm.* and
      persist.device_config.runtime_native_boot.enable_uffd_gc
      properties in cache-info.xml
Ignore-AOSP-First: Will cherry pick
Change-Id: I5a44384bf39c572878b1d305c3df9860d9324eda
Merged-In: I5a44384bf39c572878b1d305c3df9860d9324eda
2022-05-16 11:53:27 -07:00
Victor Hsieh
3423bc4bcb Allow composd to pass some system properties to CompOS
Bug: 231579544
Test: see allowlisted system properties in the VM
Change-Id: Idb263087639e4677e437ac2fcd2726ee71547f48
2022-05-10 16:19:19 -07:00
Victor Hsieh
a62b3ff58a Allow microdroid_manager to set dev.bootcomplete
... and shell to get the same property for testing.

Bug: 230774156
Test: atest MicrodroidTestCase
Change-Id: Iaf04072c2b394d44ef1253fd048d5ccf757a8b89
2022-05-02 10:33:49 -07:00
Shikha Panwar
8feef80fab Merge "Allow microdroid to start tombstone_transmit service" 2022-04-20 11:08:23 +00:00
Jooyung Han
0b3d56d35f apkdmverity: use LOOP_CONFIGURE
LOOP_CONFIGURE is more efficient than LOOP_SET_FD/SET_STATUS64.

apkdmverity has used the latter because LOOP_CONFIGURE didn't work for
loop-mounting IDSIG file.

apkdmverity can use LOOP_CONFIGURE and enabling DIRECT_IO only when
necessary.

Bug: 191344832
Test: atest MicrodroidTestApp
Change-Id: I9503f17a689e2447acee1f6ef9c2aac53cf3c457
2022-04-16 00:07:39 +00:00
Shikha Panwar
23ffb50e5a Allow microdroid to start tombstone_transmit service
... and other required changes for setup

Test: atest MicrodroidHostTestCases
Change-Id: I300ac5db375e5d9f0edb3168effd2f8b9d7c5fc6
2022-04-13 21:09:38 +00:00
Shikha Panwar
a9f1dc9708 Selinux configs for enabling tombstones be passed to host
For Guest: tombstone_tranmit needs permissions for:
1. keeping track of files being written on /data/tombstones.
2. creating vsock socket to talk to virtualizationservice (to forward
   these tombstones)

These permissions will be similar to tombstone_tarnsmit on cuttlefish
(device/google/cuttlefish/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp)

For Host (virtualizationservice) needs:
1. permission to  connect to tombstoned.
2. permission to use fd belonging to tombstoned.
3. append and related permissions on tombstone_data file.

Test: Tested by crashing a process in guest (started using microdroid
demo)

Change-Id: Ifd0728d792bda98ba139f18fa9406494a714879d
2022-04-05 13:09:04 +00:00
Jiyong Park
db9b8670b3 Remove unnecessary entries from microdroid vendor file_contexts
Bug: 225148395
Test: watch TH
Change-Id: Id368605c396fdb79c0044c407abb08ab8c90fa32
2022-04-05 16:41:26 +09:00
Treehugger Robot
c2b73ca1b2 Merge "microdroid: dont audit access to event-log-tags" 2022-03-24 22:16:47 +00:00
Victor Hsieh
e82248bcb0 Merge "Allow odrefresh to use userfaultfd" 2022-03-24 15:15:17 +00:00
Alan Stokes
f69f5a6512 Remove redundant neverallow
commit 7fd8933f0c removed this from host
sepolicy. It's redundant here as well.

Bug: 223596375
Test: Builds
Change-Id: I39d7432c6e31f49de5eb8dca8acc7e9c5d190617
2022-03-24 11:56:20 +00:00
Victor Hsieh
6c874fb295 Allow odrefresh to use userfaultfd
This isn't really used at the moment, but since the decision was to keep
the capability for future ART change, we should also allow it in CompOS
for consistency.

While I'm on in, rearrange the policy to group mirrored policies
together.

Bug: 209488862
Test: None
Change-Id: Id6afafc42005e711127a1e0831d4dd03e48959eb
2022-03-23 17:21:22 -07:00
Oleg Matcovschi
f21542906d microdroid: dont audit access to event-log-tags
Bug: 225223271
Test: run microdroid, confirm no denial messages
Signed-off-by: Oleg Matcovschi <omatcovschi@google.com>
Change-Id: I505402c5ff886c18c06133825f9a7ced84c17c1f
2022-03-23 08:55:19 -07:00
Inseob Kim
85091cd806 Allow init to relabelto console_device
Init will try restorecon /dev/console, together with /dev, at the second
stage boot.

Bug: 193118220
Test: atest MicrodroidHostTestCases
Change-Id: Ie9796368b54bb0773eabf5ff6feb2b4aa41d0bfa
2022-03-22 22:11:03 +09:00
Alan Stokes
7bde36e94e Remove redundant sepolicy
We don't use MLS in Microdroid, so we don't need MLS rules, nor
mlstrusted[subject|object] labels. (We keep one MLS rule to satisfy
checkpolicy.)

A lot of attributes are unused in Microdroid, so we can remove their
declarations and any references to them. (That may not make the
compiled policy smaller, since hopefully they get optimised out
anyway, but it means there is less policy for humans to deal with.)

Remove labels that relate only to apps, which we don't have - MAC
permissions, run-as, seapp_contexts.

In passing, fix a comment snafu in both system & microdroid policy.

Bug: 223596375
Test: Run staged-apex-compile & compos_verify, no denials
Test: atest MicrodroidTests MicrodroidHostTestCases
Change-Id: Ifd3589945a2d8b4c0361e00eec5678795513fd8c
2022-03-15 15:43:50 +00:00
Andrew Scull
629e12499a Merge "Define access to AVF chosen node properties" 2022-03-14 17:06:24 +00:00
Andrew Scull
2dba72540c Define access to AVF chosen node properties
Give microdroid_manager and the DICE HAL access to the AVF chosen node
properties that are used to indicate that the VM is booting in strict
more and that the current boot is provisioning a new VM instance.

Bug: 221051866
Bug: 217376291
Test: atest MicrodroidTests
Change-Id: Ie8451fc80671557086f8d825ad01600f9cb4557a
2022-03-14 11:38:45 +00:00
Inseob Kim
35e87367b8 microdroid: Set mls_cats to 1
Because MLS isn't really used in microdroid, setting it to 1 may help
improve performance a bit.

Bug: 223596384
Test: atest MicrodroidTests
Change-Id: Iace4a45ccda98e34fbf82b16ff2096a53b543132
2022-03-10 13:16:13 +09:00
Victor Hsieh
2a017b61a6 Allow dex2oat to use userfaultfd in microdroid
Bug: 209488862
Test: Follow instructions in b/209488862#comment12, compilation can
      only succeed with this patch
Change-Id: I6475a1be0db635de96b9f8fdbf9dd3a76c3a759b
2022-03-08 22:29:43 +00:00
Alan Stokes
ff648192d9 Block crash_dump from no_crash_dump_domain
These domains already can't transition to crash_dump, but also need to
make sure crash_dump can't be run and pointed at them.

Bug: 218494522
Test: Builds
Change-Id: I76f88faf8ff4c88e85eaf6a8db546dc644a71928
2022-02-24 16:36:40 +00:00
Treehugger Robot
275836a9af Merge "Dontaudit property access by odrefresh in the VM" 2022-02-23 12:07:45 +00:00
Victor Hsieh
e2156d071e Dontaudit property access by odrefresh in the VM
Bug: 210030607
Test: composd_cmd test-compile, no more denials in vm.log
Change-Id: I728398f812680354b813d03e0d23eecca330c47e
2022-02-22 23:10:04 +00:00
Alan Stokes
0c5449b193 Remove now-unused permissions
CompOS no longer talks directly to DICE (compos_key_helper does). odsign
no longer promotes or deletes instance CompOS files, and the key files
don't exist any more.

Bug: 218494522
Test: Manual; trigger compilation, reboot & watch odsign
Change-Id: Ibc251180122e6e4789b4be5669da3da67517b49c
2022-02-22 17:40:05 +00:00
Treehugger Robot
5273f3a486 Merge "Modify sepolicy for compos key changes" 2022-02-18 09:03:30 +00:00
Treehugger Robot
92ec679578 Merge "Remove needless bootloader_prop rule" 2022-02-17 15:51:31 +00:00
Andrew Scull
9738638c03 Let the DICE HAL getattr the device node
Make sure all the permissions are granted to let the HAL do its work
properly.

Bug: 214231981
Test: atest MicrodroidTestApp
Change-Id: I54c633b8163ea313c87856fb0513074a76ac86a1
2022-02-17 12:35:22 +00:00
Alan Stokes
766caba5de Modify sepolicy for compos key changes
Add the compos_key_helper domain for the process which has access to
the signing key, make sure it can't be crashdumped. Also extend that
protection to diced & its HAL.

Rename compos_verify_key to compos_verify, because it doesn't verify
keys any more.

Move exec types used by Microdroid to file.te in the host rather than
their own dedicated files.

Bug: 218494522
Test: atest CompOsSigningHostTest CompOsDenialHostTest
Change-Id: I942667355d8ce29b3a9eb093e0b9c4f6ee0df6c1
2022-02-17 12:14:40 +00:00
Andrew Scull
12bd3d9d2e Remove needless bootloader_prop rule
Bootloader properties are available to all domains so don't need special
policy rules for microdroid_manager.

Test: atest MicrodroidTests
Change-Id: I0ccf6b28467a47c0f3cf7715b9ff34d01e8ac970
2022-02-16 09:40:29 +00:00
Andrew Scull
b13117f3ba Add ro.boot.microdroid.app_debuggable
This property is set in the bootconfig to reflect the debuggability of
the payload app. It is consumed microdroid_manager as a DICE input and
by compos to make choices based on the debuggability, e.g. not doing
test builds in non-debug states.

Bug: 219740340
Test: atest ComposHostTestCases
Test: atest MicrodroidTests
Change-Id: If84710f1fdbab957f5d19ce6ba3daad7e3e65935
2022-02-16 09:40:27 +00:00
Inseob Kim
74caef3591 Add microdroid sepolicy test support
MicrodroidHostTestCases will pull the VM's sepolicy and check it against
system/sepolicy/microdroid's neverallow rules, using sepolicy-analyze
tool.

Bug: 218461215
Test: atest MicrodroidHostTestCases
Change-Id: I62a69053996b71d69dd2bf6b7eabc8b701095477
2022-02-09 23:35:44 +09:00
Jiyong Park
30c416a4bd Allow microdroid_manager to BLKFLSBUF on the instance disk
Microdroid_manager uses the ioctl to flush data to the block device.

Bug: 208639280
Test: atest MicrodroidTestApp
Change-Id: Icd708702618850e1f003b16bdc8a1698c45f6442
2022-02-07 15:13:22 +09:00
Andrew Scull
248e8a998f Allow the microdroid app to use diced
Bug: 214231981
Test: atest MicrodroidTestApp
Change-Id: I9672d678c7b698d15a0efa8dab567dbc2696ca81
2022-01-30 22:42:38 +00:00
Andrew Scull
6f2529c01b Touch up microdroid sepolicy after removing keystore
Avoid divergence in the files that will eventually shared with the main
Android sepolicy and fix a style mistake.

Bug: 215747811
Test: atest MicrodroidTests
Change-Id: I40b0bebb432d73ab6ab847c117e72d8bc18fe873
2022-01-28 13:07:16 +00:00
Andrew Scull
6c288a2676 Remove hwservicemanager from microdroid sepolicy
With the keymint HAL removed from microdroid, there are no more legacy
HALs meaning no further need for hwservicemanager.

Bug: 215747811
Test: atest MicrodroidTests
Change-Id: I111f3456399ef91e51d1cfead67659601c23db9e
2022-01-27 21:48:37 +00:00
Andrew Scull
af2c894f2c Remove keymint from microdroid sepolicy
The keymint HAL has been removed from microdroid to remove the
corresponding sepolicy.

Bug: 215747811
Test: atest MicrodroidTests
Change-Id: I08aae50dd9a4575954db40ec974625e43bff2335
2022-01-27 21:48:37 +00:00
Andrew Scull
f75d5cde48 Remove keystore from microdroid sepolicy
The keystore service has been removed from microdroid to remove the
corresponding sepolicy.

Bug: 215747811
Test: atest MicrodroidTests
Change-Id: I6600b47f8b8c6bba05b1f59b4d87713283805817
2022-01-27 21:48:37 +00:00
Treehugger Robot
fabaac131a Merge "Delete more unused policies by CompOS" 2022-01-25 20:54:41 +00:00
Treehugger Robot
c8ff1677ed Merge "Add context for ro.boot.microdroid.debuggable property" 2022-01-25 20:41:07 +00:00
Victor Hsieh
ea38d6925d Delete more unused policies by CompOS
Bug: 205750213
Test: TH
Change-Id: Ie08465e8801a74d61f85715e85a856293c4232d5
2022-01-25 08:40:46 -08:00
Andrew Scull
30373f3015 Add context for ro.boot.microdroid.debuggable property
This property is read by microdroid_manager to check whether the VM is
in debug mode. Give it a context to satisfy the sepolicy.

Bug: 214231981
Test: atest MicrodroidTestApp
Change-Id: I9d4bda5e487324c95229c7978e8fe0a53fa9f616
2022-01-25 16:07:21 +00:00
Andrew Scull
f451a1407f Give DICE HAL access to driver
The driver facilitates the handover of values from the bootloader so
needs to be accessible by the HAL.

Bug: 214231981
Test: run microdroid with a "google,open-dice" DT node
Change-Id: Ib5317e6a42befe22d8f1dbefeb9803f5ec92b061
2022-01-25 15:22:42 +00:00
Jiyong Park
16c1ae3a3d Add use_bionic_libs macro
... to dedupe rules for allowing access to bootstrap bionic libraries.

Bug: N/A
Test: m
Change-Id: I575487416a356c22f5f06f1713032f11d979d7d4
2022-01-25 09:47:56 +09:00