Commit graph

26894 commits

Author SHA1 Message Date
Alistair Delva
98825d35cb Allow dumpstate to dump face/fingerprint/gnss HALs
Seen with "adb bugreport" on cuttlefish:

avc: denied { call } for scontext=u:r:dumpstate:s0
  tcontext=u:r:hal_face_default:s0 tclass=binder permissive=0
avc: denied { call } for scontext=u:r:dumpstate:s0
  tcontext=u:r:hal_fingerprint_default:s0 tclass=binder permissive=0
avc: denied { call } for scontext=u:r:dumpstate:s0
  tcontext=u:r:hal_gnss_default:s0 tclass=binder permissive=0

Fix it like aosp/1313514

Bug: 170070222
Change-Id: I1c2d6fc0130ef3ee87662d23de0ee031fb60cbec
2020-11-16 13:52:05 -08:00
Treehugger Robot
79898cb78f Merge "Use app_data_file_type for mls rules." 2020-11-16 11:58:11 +00:00
Alan Stokes
5b58aedf58 Merge "Enforce use of app_data_file_type." 2020-11-16 10:35:48 +00:00
Tej Singh
d083d24c0d Merge "Revert "Enforce RTM_GETLINK restrictions on all 3p apps"" 2020-11-14 01:59:33 +00:00
Tej Singh
f48d1f8e46 Revert "Enforce RTM_GETLINK restrictions on all 3p apps"
Revert "Updates tests for untrusted app MAC address restrictions"

Revert submission 1450615-mac-address-restrictions

Reason for revert: DroidMonitor: Potential culprit for Bug 173243616 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted

Reverted Changes:
I08c709b2b:Enforce RTM_GETLINK restrictions on all 3p apps
I95d124ae8:Soft-enables new MAC address restrictions.
I5392f8339:Updates tests for untrusted app MAC address restri...
I9d214c5d0:Return anonymized MAC for apps targeting SDK < 30

Change-Id: I987dfc86dfba56a2d2a45075dc19885ca6f0a4ad
2020-11-13 22:27:15 +00:00
Lais Andrade
22b499eab5 Add IVibratorManager to sepolicy service_contexts
Bug: 166586119
Change-Id: Ia9339d34bcc7a22d5785cf7c810282f7cb0b724f
Test: N/A
2020-11-13 14:16:46 +00:00
Florian Mayer
b23d38c7a0 Merge "userdebug_or_eng: allow traced_perf to read kallsyms." 2020-11-13 10:02:27 +00:00
Alan Stokes
3f686e323c Merge "Exempt app_data_file_type from neverallow rules." 2020-11-13 09:49:55 +00:00
Roshan Pius
e97cb76018 Merge "sepolicy(hal_wifi): Allow wifi HAL to access persist.vendor.debug properties" 2020-11-13 08:11:40 +00:00
Roshan Pius
a5a81002c8 sepolicy(hal_wifi): Allow wifi HAL to access persist.vendor.debug properties
We want to tweak some device params at runtime via shell (alleviates the
need to recompile HAL for changing device configuration). This will help
us test/teamfood couple of new features under development.

Bug: 173044646
Test: Wifi HAL can read persist.vendor.debug.wifi properties.
Change-Id: Iabd07e72aa5f0d97519a37d0ebb1e0a3458b6d06
2020-11-12 18:22:47 -08:00
Inseob Kim
8eae0aa1fb Merge "Add context for ro.product.property_source_order" 2020-11-13 00:49:15 +00:00
Florian Mayer
167407dc47 userdebug_or_eng: allow traced_perf to read kallsyms.
This tracing daemon interfaces with perf_events, and is used for
callstack sampling. Currently, we only handle userspace stacks. We
have the ability to collect kernel frame addresses (as unwound
by the kernel itself), but need /proc/kallsyms to symbolize them.

This patch mirrors what was done for traced_probes (ftrace event
kptr symbolization) in aosp/1455337 - the daemon can set a sysprop
that causes "init" to temporarily relax kptr_restrict, then the daemon
can open and read /proc/kallsyms. After the file is parsed, the
kptr_restrict value is restored.

To reiterate, this is confined to userdebug_or_eng due to the reasons
outlined in go/perfetto-kallsyms.

Bug: 173124818
Change-Id: I9077bbfe6fea3318f4c37947a5c455061ca43d8d
2020-11-12 20:04:40 +00:00
Alan Stokes
668e74f6f4 Exempt app_data_file_type from neverallow rules.
We need to be able to access app data files from core domains such as
installd even for vendor apps. Those file types should not be
core_data_file_type, so we explicitly exempty app_data_file_type as
well as core_data_file_type from the relevant neverallows.

To prevent misuse of the attribute, add a test to check it is not
applied to anything in file_contexts. Exempt the existing violators in
system policy for now.

Test: Builds
Test: Adding a type with just "file_type, data_file_type, app_data_file_type" works
Test: New test successfully catches  violators.
Bug: 171795911
Change-Id: I07bf3ec3db615f8b7a33d8235da5e6d8e2508975
2020-11-12 18:08:18 +00:00
Bram Bonné
593c3b5c2f Merge "Enforce RTM_GETLINK restrictions on all 3p apps" 2020-11-12 17:07:11 +00:00
Inseob Kim
9985566221 Add context for ro.product.property_source_order
Any partitions should be able to write this property with build.prop.
This adds a new context for ro.product.property_source_order so it can
be set from any build.prop, e.g. vendor/build.prop, product/build.prop,
etc.

Bug: 172459064
Test: PRODUCT_VENDOR_PROPERTIES can set this property
Change-Id: Ibf85a4ad02d8454f621428b271e8e298067aa126
2020-11-12 22:21:51 +09:00
Alan Stokes
9f7d1ff0f1 Merge "Introduce app_data_file_type attribute." 2020-11-12 09:29:06 +00:00
yawanng
895164f402 Added permissions for new dexopt flags on methods/classes percent change.
Bug: 172490638
Test: Make
Change-Id: Ia08895f9ccfba3b860e59d810ef67668f52c675e
2020-11-11 22:51:46 +00:00
Alan Stokes
3c4375a5b4 Enforce use of app_data_file_type.
Extend check_seapp to check that all types specified in seapp_contexts
files have the attribute, to ensure that the neverallow rules apply to
them. As a small bonus, also verify that domain and type values are
actually types not attributes.

Test: Presubmits
Test: Manual: specify an invalid type, build breaks.
Bug: 171795911
Change-Id: I951d6f993445e8ba11c30a504b8de281fdd93c4a
2020-11-11 14:45:32 +00:00
Alan Stokes
f8ad33985d Introduce app_data_file_type attribute.
This gives us an easy way for the policy to refer to all existing or
future types used for app private data files in type= assignments in
seapp_contexts.

Apply the label to all the existing types, then refactor rules to use
the new attribute.

This is intended as a pure refactoring, except that:
- Some neverallow rules are extended to cover types they previous
omitted;
- We allow iorap_inode2filename limited access to shell_data_file and
  nfc_data_file;
- We allow zygote limited access to system_app_data_file.

This mostly reverts the revert in commit
b01e1d97bf, restoring commit
27e0c740f1. Changes to check_seapp to
enforce use of app_data_file_type is omitted, to be included in a
following CL.

Test: Presubmits
Bug: 171795911
Change-Id: I02b31e7b3d5634c94763387284b5a154fe5b71b4
2020-11-11 14:43:36 +00:00
Nikita Ioffe
fce6c327ad Merge "Temporarily allow otapreopt_chroot to query ro.cold_boot_done prop" 2020-11-11 13:28:54 +00:00
Alex Hong
2680a1b55c Merge "Allow dumpstate to read proc_pid_max and access profcollectd via binder" 2020-11-11 06:41:10 +00:00
Nikita Ioffe
f0f047aeaa Temporarily allow otapreopt_chroot to query ro.cold_boot_done prop
Test: presubmit
Bug: 172829167
Bug: 165948777
Change-Id: If7ead4ec43496795e31432db8d3493dbc6fc5e07
2020-11-10 20:38:45 +00:00
Treehugger Robot
16b3c87454 Merge "Revert "Introduce app_data_file_type attribute."" 2020-11-10 20:21:31 +00:00
Alan Stokes
b01e1d97bf Revert "Introduce app_data_file_type attribute."
This reverts commit 27e0c740f1.

Reason for revert: b/172926597

Change-Id: Id2443446cbdf51dc05b303028377895b9cf2a09e
2020-11-10 18:02:14 +00:00
Alan Stokes
c5773a9836 Use app_data_file_type for mls rules.
Now that we have an attribute for all app data files, make use of
it. It's cleaner.

The net effect here is a slight loosening of permissions - we now
allow open fds for any app_data_file_type to be passed to a different
process, rather than just app_data_file and privapp_data_file.

Bug: 171795911
Test: presubmits
Merged-In: I4cf812d01577b923efbe1ea3f276c209844d8858
Change-Id: I4cf812d01577b923efbe1ea3f276c209844d8858
2020-11-10 14:27:59 +00:00
Thiébaud Weksteen
fd86bda955 Merge "Add hal_light to ANR list" 2020-11-10 13:37:36 +00:00
Alan Stokes
256a9b4e46 Merge "Introduce app_data_file_type attribute." 2020-11-10 11:57:41 +00:00
Alex Hong
906c724514 Allow dumpstate to read proc_pid_max and access profcollectd via binder
Now running ps requires the read permission for /proc/sys/kernel/pid_max.
Also, grant the binder_call permission for recently added profcollectd.

Bug: 170070222
Change-Id: I5bc0f89a0538091de40647777ff6bf47f47dc066
2020-11-10 09:53:41 +00:00
Treehugger Robot
aa405a473a Merge "Added read only suspend hal properties" 2020-11-10 04:56:33 +00:00
Josh Gao
1fcd3d9e8c Merge "Let adbd set service.adb.tcp.port." 2020-11-10 00:32:25 +00:00
Treehugger Robot
406a391077 Merge "Add entries for some properties in default_prop" 2020-11-10 00:24:04 +00:00
Benjamin Schwartz
3e4d97b158 Added read only suspend hal properties
Bug: 170587692
Test: Inspected logs to confirm android.system.suspend can access the
properties

Change-Id: Ie6a84afe490df0d2b11ff4f06588c7bca68d9850
2020-11-09 15:47:12 -08:00
Alan Stokes
27e0c740f1 Introduce app_data_file_type attribute.
This gives us an easy way for the policy to refer to all existing or
future types used for app private data files in type= assignments in
seapp_contexts.

Apply the label to all the existing types, then refactor rules to use
the new attribute.

This is intended as a pure refactoring, except that:
- Some neverallow rules are extended to cover types they previous
omitted;
- We allow iorap_inode2filename limited access to shell_data_file and
  nfc_data_file;
- We allow zygote limited access to system_app_data_file.

Also extend check_seapp to check that all types specified in
seapp_contexts files have the attribute, to ensure that the neverallow
rules apply to them. As a small bonus, also verify that domain and
type values are actually types not attributes.

Test: Presubmits
Test: Manual: specify an invalid type, build breaks.
Bug: 171795911
Change-Id: Iab6018af449dab3b407824e635dc62e3d81e07c9
2020-11-09 11:04:02 +00:00
Hai Zhang
a97a3665fb Add TCSETSF to unpriv_tty_ioctls.
This allows calling tcsetattr() with TCSAFLUSH, in addition to TCSANOW
and TCSADRAIN.

Fixes: 172740382
Test: manual
Change-Id: Idd2e9e0db2e0210df515f46d9d0323c6b517dd39
2020-11-09 00:19:01 +00:00
Josh Gao
0cac6fd17a Let adbd set service.adb.tcp.port.
Commit 67c36884 changed the label of service.adb.tcp.port to allow
vendor init to set it, but accidentally prevented adbd from setting it,
which broke `adb tcpip`.

Bug: http://b/171280882
Test: `adb tcpip`
Change-Id: I154e2f43a4d3b72b27508ce02d66298673939738
2020-11-06 13:08:04 -08:00
Michael Sun
dd92be8271 Merge "Update to support splitted SystemSuspend AIDL interfaces" 2020-11-06 17:35:58 +00:00
Inseob Kim
d5a0448a53 Add entries for some properties in default_prop
Currently default_prop is readable by coredomain and appdomain. That's
too broad, and we are going to restrict the access so every property
should be added to property_contexts.

This adds some missing properties to property_contexts. Newly added
property contexts are:

- wrap.*: used by zygote to give arguments. It's assigned as
zygote_wrap_prop, and will be readable from coredomain.

- partition.{mount_name}.verified: used by dm-verity. It's assigned as
vertiy_status_prop, and will only be accessible from init.

- (ro.)?setupwizard.*: used by setup wizard. It's assigned as
setupwizard_prop, and will be readable from coredomain.

Other properties, such as ro.gfx.*, media.stagefright.*,
ro.storage_manager.* are also added to existing contexts.

Bug: 170590987
Test: boot crosshatch and see no denials
Change-Id: Ife9d69a62ee8bd7395a70cd104271898c8a72540
2020-11-06 14:02:34 +09:00
Florian Mayer
12376168b4 New type for printk_formats, allow traced_probes.
Test: ls -lZ /sys/kernel/tracing/printk_formats
      [...] u:object_r:debugfs_tracing_printk_formats:s0 [...]

Test: setenforce 0;
      runcon u:r:system_server:s0 cat /sys/kernel/tracing/printk_formats
      logcat complains about /sys/kernel/tracing/printk_formats

Test: setenforce 0;
      runcon u:r:traced_probes:s0 cat /sys/kernel/tracing/printk_formats
      logcat does not complain about /sys/kernel/tracing/printk_formats

(need to setenforce 0, because otherwise the exec of ls is denied).

Bug: 70292203
Change-Id: I15ddef686f979c59daaba5263fa99aca3cd139e5
2020-11-05 12:55:50 +00:00
Steven Moreland
4537b1ed62 Merge "Policy: file errors include files with attrs" 2020-11-04 16:21:40 +00:00
Treehugger Robot
911dbb25f8 Merge "Add missing build.prop related properties" 2020-11-04 03:22:35 +00:00
Inseob Kim
072e7c8bd2 Add missing build.prop related properties
ro.actionable_compatible_property.enabled and ro.treble.enabled are in
system/build.prop, so they are assigned as build_prop. The other added
properties are introduced by build/make/core/sysprop.mk.

Bug: 170590987
Test: boot and see default_prop
Change-Id: I2ec1df99985ca81d27e657750eb8895fe4b85b35
Merged-In: I2ec1df99985ca81d27e657750eb8895fe4b85b35
2020-11-04 00:52:09 +00:00
Steven Moreland
7f11650293 Policy: file errors include files with attrs
Since many files can correspond to the same error, it can be hard to see
which file is causing the error for an attribute

Example, here I couldn't find which file was 'vendor_file':

  The following types on / must be associated with the "no_fs_type"
  attribute: vendor_file
   corresponding to files: /cache/overlay/oem/upper

Bug: 154851797
Test: see above example
Change-Id: Ic96536da3ce55ccc5f600579b9f6b1b4f56fc93d
2020-11-03 23:20:43 +00:00
David Anderson
ae72bf372c Merge "init: Allow interacting with snapuserd and libsnapshot." 2020-11-03 18:24:49 +00:00
Steven Moreland
42aa7a26e2 Merge "sepolicy_tests.py: system_ext, product, odm" 2020-11-03 16:44:26 +00:00
Thiébaud Weksteen
e992abeaa3 Add hal_light to ANR list
Test: m selinux_policy
Bug: 168939486
Change-Id: I19ea754da68cbf102c9310e96bc7c410e0864514
2020-11-03 17:12:08 +01:00
Roland Levillain
75413123c8 Merge "Allow the shell user to run dex2oat." 2020-11-03 12:24:23 +00:00
Michael Sun
6445f190e8 Update to support splitted SystemSuspend AIDL interfaces
The suspend_control_aidl_interface is updated, renamed, and splitted
into android.system.suspend.control and
android.system.suspend.control.internal. This resulted in two suspend
services, update sepolicy to support this change.

Test: m
Bug: 171598743
Change-Id: I695bde405672af834fe662242347e62079f2e25f
2020-11-02 23:54:21 +00:00
Roland Levillain
06bee189ad Allow the shell user to run dex2oat.
This is required for ART's Checker tests, which are part of
(host-driven) ART run-tests, and will also be required to run ART
run-tests via TradeFed in AOT-compilation modes in the future.

Test: Run `atest art-run-test-004-checker-UnsafeTest18` with
      https://android-review.googlesource.com/c/platform/tools/tradefederation/+/1484277
      merged in, on a device where `adb` commands are not run as root
Bug: 162408889
Bug: 147812905
Change-Id: I3e4824bf15bdbad1ddf26601f871feec11313ecc
2020-11-02 21:51:27 +00:00
Steven Moreland
a01338d4a8 sepolicy_tests.py: system_ext, product, odm
Adds missing partitions to Treble sepolicy tests, and makes exceptions
explicit.

Bug: 154851797
Test: build runs this test

Change-Id: I93f3e633981383d3d215d3a850f6ade12c910415
2020-11-02 20:24:35 +00:00
Hayden Gomes
0b5171df39 Merge "Adding support for AIDL AudioControl HAL" 2020-10-30 14:21:10 +00:00