Commit graph

30288 commits

Author SHA1 Message Date
Howard Chen
8720492f2e Allow vold to get the DSU status
Currently, the vold detects the factory reset by checking the
metadata encryption key. This logic is only valid when the
device is not in DSU mode. This CL allows vold to get the DSU
status.

Test: run DSU installation on a Pixel device
Bug: 199222795
Change-Id: Ia6ca3b27afd52347b132d7e2d8be244fb9f15e7d
2021-09-16 09:58:43 +08:00
Inseob Kim
e17b985e1c microdroid: Remove default_prop access
This adds properties necessary to run microdroid to property_contexts,
and then removes default_prop access to all domains except for init, as
init should be able to write all properties.

Bug: 194447534
Test: atest MicrodroidHostTestCases ComposHostTestCases
Change-Id: I2f80c71ce257613b3c3b019a3e988a5a0653d879
2021-09-15 05:26:03 +00:00
Treehugger Robot
855f16dd87 Merge "Bundle proc_bootconfig permission into read_fstab" 2021-09-15 03:36:24 +00:00
Kelvin Zhang
2b5f108143 Bundle proc_bootconfig permission into read_fstab
fs_mgr::ReadDefaultFstab calls fs_mgr:ReadFstabFromDt() which eventually
calls fs_mgr_get_boot_config_from_bootconfig_source to read boot config.
Therefore bundle permission to read proc_bootconfig. This resolves some
selinux denials for update_engine

Test: th
Change-Id: Ia8bd94eb33a38ccd939577b54910645fec4ccda8
2021-09-14 18:44:42 -07:00
Changyeon Jo
c5e8db55f9 Allow automotive_display_service to use EGL files
Bug: 199739880
Test: m -j selinux_policy and run evs_app
Change-Id: If0df74ad4708b00f213c42516eb404b98873cf4f
2021-09-13 17:35:46 +00:00
Treehugger Robot
0bbfc68a49 Merge "Initial sepolicy for composd" 2021-09-13 11:47:21 +00:00
Alan Stokes
d376e2041f Initial sepolicy for composd
Add what we need to allow composd to run and expose an AIDL service.

Also delete the policy for compsvc; we never access it in the host
now, and the real policy is in microdroid. Retain the compos_exec
type, since it is referenced in the APEX sepolicy.

Bug: 186126194
Test: adb shell cmd -w android.system.composd; no denials.
Change-Id: I5f06b2b01852cdebd2d67009b363ec08b17ce33a
2021-09-13 10:33:53 +01:00
Jooyung Han
6e60287a1f Allow microdroid_manager to create a /apex/* file
Microdroid_manager needs to pass APEX pubkeys to APEXd. Since the data
is too big for a system property, it creates a file
/apex/vm-payload-metadata so that APEXd reads/uses it.

Bug: 199371341
Test: MicrodroidHostTestCases
Change-Id: Iaf2b4fc08b36610032d9c339f787e5e34994448b
2021-09-10 17:35:26 +09:00
Jooyung Han
f19cd64a0e Merge "make zipfuse a bootstrap process" 2021-09-10 08:16:31 +00:00
Treehugger Robot
68e5958902 Merge "Add the 'bdev_type' attribute to all block device types" 2021-09-10 01:27:48 +00:00
Treehugger Robot
a37bf10692 Merge "allow system server to read extcon state and type from sysfs" 2021-09-10 01:12:49 +00:00
Gregory Montoir
2881a253da Merge "Allow adbd to access /proc/net/{tcp,tcp6,udp,udp6}" 2021-09-10 00:47:09 +00:00
Jooyung Han
53c773a3fd make zipfuse a bootstrap process
Bug: n/a
Test: MicrodroidHostTestCases
Change-Id: Ia2ad615e919f4fcb0452d8458e505ecfbdd5818f
2021-09-10 08:56:08 +09:00
Christopher Ferris
adaabe529c Merge "Allow crash_dump to read from /data/local/tests." 2021-09-09 23:20:41 +00:00
Christopher Ferris
f2acb20e1b Allow crash_dump to read from /data/local/tests.
Without this change, any crash from an executable in /data/local/tests
is incomplete. Specifically, function names are missing which makes
the crash nearly useless for debugging.

Bug: 197229540

Test: Used the crasher executable and copied it to /data/local/tests
Test: and verified that running it as root and shell results in
Test: tombstones that have full unwinds with function names.
Change-Id: Ic4862ca6ee9b02132a593ccd5fe26508ed5c8510
2021-09-09 14:49:36 -07:00
Bill Yi
a053861726 Merge "Merge RQ3A.210905.001 to aosp-master - DO NOT MERGE" 2021-09-09 21:27:25 +00:00
Hongguang
8e5d3d469f allow system server to read extcon state and type from sysfs
The target device needs to lable the SoC's extcons to sysfs_extcon in
the device's vendor sepolicy to allow the system_server access.

Bug: 152245127
Bug: 193492798
Bug: 193114615
Test: pressubmit and manual
Change-Id: Ib0a90ac5ce2c9437b19d6dc1e0b2cc50fed41dc3
2021-09-09 14:15:19 -07:00
Gregory Montoir
0e1044ae8f Allow adbd to access /proc/net/{tcp,tcp6,udp,udp6}
File accesses go through com.android.ddmlib.SyncService for CTS
ListeningPortsTest.

Bug: 193151739
Change-Id: I0c66fb5e35cda3b1799cf003402e454d7a951e96
2021-09-09 14:31:15 +08:00
Inseob Kim
2f7600920d Add vsock permissions to microdroid_payload
microdroid_payload needs to open a vsock server, so this change grants
permissions for that. This change also temporarily grants permissions to
get local CID, which should be removed once the RPC binder API supports
getting CID.

Bug: 195381416
Test: atest MicrodroidHostTestCases
Change-Id: I57a603e74d7552e13a83fa4934621e09e13015fd
2021-09-09 02:30:59 +00:00
Alan Stokes
f96cd6557e Restrict VM usage to platform_app.
Remove access from untrusted apps and instead grant it to platform_app
(but on user builds as well as debug).

Also restrict any app from creating a vsock_socket; using an already
created one is fine.

Bug: 193373841
Test: Microdroid demo app now gets a denial
Test: Rebuild demo with certifcate: platform, adb install, no denial
Change-Id: I7be011e05244767a42d4c56e26de792db4fe599d
2021-09-09 02:30:43 +00:00
Bill Yi
82fd149648 Merge RQ3A.210905.001 to aosp-master - DO NOT MERGE
Merged-In: I637157e5836746048bc597ccc97ad5cb506bf561
Merged-In: I7666150b5e36ef12e4bb4cc0d27bc48dc8bd8449
Merged-In: I7666150b5e36ef12e4bb4cc0d27bc48dc8bd8449
Change-Id: I5e73ddfc69c46aed26cb2a28533d2210c000c635
2021-09-08 17:57:11 -07:00
Bart Van Assche
8a6f8e51bc Add the 'bdev_type' attribute to all block device types
The following patch iterates over all block devices:
https://android-review.googlesource.com/c/platform/system/core/+/1783847/9

The following patch grants 'init' and 'apexd' permission to iterate over
all block devices:
https://android-review.googlesource.com/c/platform/system/sepolicy/+/1783947

The above SELinux policy change requires to add the 'bdev_type'
attribute to all block devices. Hence this patch.

Bug: 194450129
Test: Untested.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
Change-Id: Iee1c984f176eb2752194493999921cb1aa24ac64
2021-09-08 16:13:25 -07:00
Ytai Ben-Tsvi
c71b2c18cc Allow audioserver to access sensorservice
This is required for accessing sensor data in audioserver.

Bug: 188502620
Test: log-based verification of sensor data coming through.
Change-Id: I183ce5106401ae7853096e80a8650cc7919e6221
2021-09-08 11:44:11 -07:00
Jooyung Han
6f3b5e2edc microdroid: rename property to "apk_root_hash"
Bug: 193504400
Test: atest MicrodroidHostTestCases
Change-Id: I3bd0fd337d85b29e5dfdfba49ee5328e48f5be89
2021-09-08 16:05:29 +09:00
Pirama Arumuga Nainar
b85fd253cd Merge "Allow access to trace_data_file from untrusted_app context" 2021-09-07 19:50:34 +00:00
Yabin Cui
dd2079d7f0 Revert "allow simpleperf to profile more app types."
This reverts commit 26de4c4ecc.

Reason for revert: security concern

Bug: 199086135
Test: none
Change-Id: I0f3aa7f099121f350e487db4ef0135aa045911cb
2021-09-07 10:18:28 -07:00
Treehugger Robot
ab5a2c23cf Merge "Microdroid boot process is controlled by microdroid_manager" 2021-09-07 16:21:24 +00:00
Pirama Arumuga Nainar
0612731aa5 Allow access to trace_data_file from untrusted_app context
Bug: http://b/170257616

This allows native code in CTS tests to write their coverage profiles.
Like other cases of this pattern, this is only enabled with the
NATIVE_COVERAGE build parameter, and shouldn't affect release build
configurations.

Test: atest -a CtsNdkBinderTestCases and verify non-zero coverage in
      cts/tests/tests/binder_ndk/libbinder_ndk_test/
Change-Id: Id78aa67750f33c4a8ec6e7fcf8418ff23fc27ac7
2021-09-07 09:03:03 -07:00
Jiyong Park
27bb6c6608 Microdroid boot process is controlled by microdroid_manager
Previously, the boot process of microdroid was mostly implemented in the
init.rc file. microdroid_manager was started first in the background,
then apexd, apkdmverity, and zipfuse were executed in sequence. However,
in order to correctly implement the app payload verification scheme,
most of the early boot process has to be controlled by
microdroid_manager. Specifically, apkdmverity should be started "after"
the apk roothash is read from the instance disk by microdroid_manager.

As an alternative, we could let apkdmverity the read instance disk by
itself. However, this is undesirable because doing so requires multiple
processes - microdroid_manager and apkdmverity - have access to the
instance disk and more seriously the secret key to decrypt it.

Another alternative is to let microdroid_manager do the dm-verity
configuration which apkdmverity does. This also is considered
undesirable because then we would give the permissions for configuring
dm-verity devices to microdroid_manager which is a long-running daemon
process. Note that apkdmverity is not a daemon process.

This CL introduces a few number of changes which are required to let
microdroid_manager directly control the early boot process:

1) microdroid_manager is allowed to start the services apkdmverity and
zipfuse by using the `ctl.start` sysprop.

2) apkdmverity is allowed to use bootstrap bionic libraries as it is now
executed before APEXd activates the APEXes.

3) A new sysprop `microdroid_manager.apk_roothash` is added. It is
written by microdroid_manager and read by apkdmverity. It contains the
roothash read from the instance disk. This value is not a secret.

4) Another new sysprop `apex_config.done` is added. It is set by init
just after `perform_apex_config` and read by microdroid_manager.
Microdroid_manager uses this to wait until linker configuration is ready
so that it can execute app payloads with the config.

Bug: 193504400
Test: atest MicrodroidHostTestCases
Change-Id: If29ce17d7a6cb4859e8ceeffb321724e7f11bf82
2021-09-07 17:13:43 +09:00
Woody Lin
7ed2456b45 Add userspace_panic_device and userpanic_use
Define type userspace_panic_device and macro userpanic_use for init,
llkd, and system_server to access /dev/userspace_panic - a kernel file
node for userspace processes to request kernel panic.

Bug: 188777408
Change-Id: I1e9d115d85f664aa84bdd6bb4b95bdb48e3aab9a
2021-09-07 01:18:25 +08:00
Alan Stokes
d1ac340034 Merge "SEPolicy for compos_verify_key." 2021-09-06 07:55:58 +00:00
Alan Stokes
39f497013c SEPolicy for compos_verify_key.
Remove some allow rules for odsign, since it no longer directly
modifies CompOs files. Instead allow it to run compos_verify_key in
its own domain.

Grant compos_verify_key what it needs to access the CompOs files and
start up the VM.

Currently we directly connect to the CompOs VM; that will change once
some in-flight CLs have landed.

As part of this I moved the virtualizationservice_use macro to
te_macros so I can use it here. I also expanded it to include
additional grants needed by any VM client that were previously done
for individual domains (and then deleted those rules as now
redundant).

I also removed the grant of VM access to all apps; instead we allow it
for untrusted apps, on userdebug or eng builds only. (Temporarily at
least.)

Bug: 193603140
Test: Manual - odsign successfully runs the VM at boot when needed.
Change-Id: I62f9ad8c7ea2fb9ef2d468331e26822d08e3c828
2021-09-03 16:31:02 +01:00
Bart Van Assche
d05534f3d5 Add the 'bdev_type' attribute to all block device types
The following patch iterates over all block devices:
https://android-review.googlesource.com/c/platform/system/core/+/1783847/9

The following patch grants 'init' and 'apexd' permission to iterate over
all block devices:
https://android-review.googlesource.com/c/platform/system/sepolicy/+/1783947

The above SELinux policy change requires to add the 'bdev_type'
attribute to all block devices. Hence this patch.

Bug: 194450129
Test: Untested.
Change-Id: I706285544f348944ca0c24e031b7c4e1052ec390
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-09-02 10:13:16 -07:00
Tianjie Xu
e4623f3219 Merge "Set context for partition.*.verified.root_digest properties." 2021-09-01 17:47:11 +00:00
Treehugger Robot
4442c1f7eb Merge "allow installd to kill dex2oat and dexoptanalyzer" 2021-09-01 17:11:23 +00:00
Treehugger Robot
c5cc2e9730 Merge "Allow microdroid_manager to write instance.img" 2021-09-01 09:38:41 +00:00
Jiyong Park
ee3661ef2b Allow microdroid_manager to write instance.img
Bug: 193504400
Test: atest MicrodroidHostTestCases
Change-Id: Icac8aa7e1badc90d2725c81e3c0f9594b7e18608
2021-08-31 17:14:09 +09:00
Tianjie
ade005f8dd Set context for partition.*.verified.root_digest properties.
This is requested by the partner engineer team to uniquely identify
a partition.

Bug: 197973981
Test: boot the device
Change-Id: Id0393698d730391eb8e438e424e527451f54d4ea
2021-08-30 17:13:51 -07:00
Roshan Pius
0f98b1c6bb Mark uwb apex data directory as system_server_data_dir
UWB stack needs to persist state inside it's apex directory.

Denial logs:
08-30 19:44:53.670  1635  1635 W queued-work-loo: type=1400 audit(0.0:9):
avc: denied { write } for name="com.android.uwb" dev="dm-40" ino=206
scontext=u:r:system_server:s0 tcontext=u:object_r:apex_module_data_file:s0
tclass=dir permissive=0

Bug: 197963882
Test: Verified shared preferences file creation/write under uwb
apex data directory.

Change-Id: Ic4925822ca7e01cd23aea6805c80720f2a3db9d7
2021-08-30 13:03:08 -07:00
Roshan Pius
3015324460 Allow uwb HAL client/server to talk to service manager
Denial logs:
08-27 21:43:18.716   801   801 W android.hardwar: type=1400 audit(0.0:4): avc:
denied { call } for scontext=u:r:hal_uwb_default:s0 tcontext=u:r:servicemanager:s0
tclass=binder permissive=0

Bug: 195308730
Test: Bootup default UWB HAL implementation on cuttlefish & verify UCI stack
can talk to the HAL.

Change-Id: I493af52513fd5b8f89d1375f80226ffa10c34f48
2021-08-28 00:01:59 +00:00
Ankita Vyas
7ac013be94 Merge "Add selinux changes for Locale Manager Service" 2021-08-27 03:59:42 +00:00
Treehugger Robot
d7fc7bd30b Merge "sepolicy: Change UWB HAL from HIDL to versioned AIDL" 2021-08-27 01:45:00 +00:00
Roshan Pius
cd8333b53a sepolicy: Change UWB HAL from HIDL to versioned AIDL
No new HIDL HAL's are allowed in Android T. UWB HAL converted to
versioned AIDL interface to be compliant.

Bug: 195308730
Test: Compiles
Change-Id: I35cf8edd244baa02778ee8eff46840ae26424869
2021-08-27 00:28:56 +00:00
Roshan Pius
ea6c84b560 Merge "sepolicy: Add UWB HAL interface in AOSP" 2021-08-27 00:25:17 +00:00
Treehugger Robot
0e88c8807f Merge "sepolicy: Rename hal_uwb -> hal_uwb_vendor" 2021-08-26 15:51:45 +00:00
“Ankita
623ece0386 Add selinux changes for Locale Manager Service
Test: build and booted device

Bug: 194094788

Change-Id: Ic3c1f135985a5003ed07a8da9dbd7a3f8b61ae71
2021-08-26 14:33:24 +00:00
Treehugger Robot
aedbe31acb Merge "sepolicy: Add new crypto type ro.crypto.type=managed" 2021-08-26 04:37:37 +00:00
Treehugger Robot
2ce33d50bc Merge "Allow Bluetooth to access system config" 2021-08-25 13:40:12 +00:00
wescande
4b6a6aa861 Allow Bluetooth to access system config
The removing of getSystemConfigEnabledProfilesForPackage
hidden api for mainline project triggered a SEDenial:
```
avc: denied { read } for comm="droid.bluetooth" name="u:object_r:incremental_prop:s0" dev="tmpfs" ino=20229 scontext=u:r:bluetooth:s0 tcontext=u:object_r:incremental_prop:s0 tclass=file permissive=0
avc: denied { open } for comm="droid.bluetooth" path="/dev/__properties__/u:object_r:incremental_prop:s0" dev="tmpfs" ino=180 scontext=u:r:bluetooth:s0 tcontext=u:object_r:incremental_prop:s0 tclass=file permissive=0
avc: denied { getattr } for comm="droid.bluetooth" path="/dev/__properties__/u:object_r:incremental_prop:s0" dev="tmpfs" ino=180 scontext=u:r:bluetooth:s0 tcontext=u:object_r:incremental_prop:s0 tclass=file permissive=0
avc: denied { map } for comm="droid.bluetooth" path="/dev/__properties__/u:object_r:incremental_prop:s0" dev="tmpfs" ino=180 scontext=u:r:bluetooth:s0 tcontext=u:object_r:incremental_prop:s0 tclass=file permissive=0

avc: denied { read } for comm="droid.bluetooth" name="filesystems" dev="proc" ino=4026532079 scontext=u:r:bluetooth:s0 tcontext=u:object_r:proc_filesystems:s0 tclass=file permissive=0
avc: denied { open } for comm="droid.bluetooth" path="/proc/filesystems" dev="proc" ino=4026532079 scontext=u:r:bluetooth:s0 tcontext=u:object_r:proc_filesystems:s0 tclass=file permissive=0
avc: denied { getattr } for comm="droid.bluetooth" path="/proc/filesystems" dev="proc" ino=4026532079 scontext=u:r:bluetooth:s0 tcontext=u:object_r:proc_filesystems:s0 tclass=file permissive=0
```

Bug: 190440540
Test: Manual
Tag: #refactor
Change-Id: I86c77e540d783a4286a15cdf66b083aae1a55589
2021-08-25 12:33:00 +00:00
Roshan Pius
8a5370c5e4 sepolicy: Add UWB HAL interface in AOSP
Adding sepolicy rules for the AOSP HAL interface.

Ignore-AOSP-First: Dependent changes in internal-only projects.

Bug: 195308730
Test: Compiles
Change-Id: I56302b570a749f7d72b6fe8f4f4a8767ea4785c1
Merged-In: I56302b570a749f7d72b6fe8f4f4a8767ea4785c1
2021-08-24 20:10:21 -07:00