Commit graph

26909 commits

Author SHA1 Message Date
Suren Baghdasaryan
37f1a137b6 Add rules for per-API level task profiles and cgroup description files
Define access rights to new per-API level task profiles and cgroup
description files under /etc/task_profiles/.

Bug: 172066799
Test: boot with per-API task profiles
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I04c9929fdffe33a9fc82d431a53f47630f9dcfc3
2020-11-23 09:30:26 -08:00
Treehugger Robot
a2028972db Merge "Add a TODO to remove mlsvendorcompat." 2020-11-23 13:57:36 +00:00
Alan Stokes
689f91f9ed Add a TODO to remove mlsvendorcompat.
One day we won't need this mechanism any more & can remove all traces
of it.

Bug: 141677108
Test: builds
Change-Id: I95525a163ab4f19d8ca411c02a3c06498c6777ef
2020-11-23 12:28:21 +00:00
Neil Fuller
159e046167 Merge "Changes associated with the new geotz module" 2020-11-23 11:44:37 +00:00
Alan Stokes
7e5f37fd6f Merge "Exempt older vendor images from recent mls changes." 2020-11-23 11:09:58 +00:00
Inseob Kim
5637aba56c Merge "Add ro.cpuvulkan.version to property_contexts" 2020-11-23 02:24:30 +00:00
Treehugger Robot
34211741dd Merge "Selinux changes for statsd flags" 2020-11-21 00:12:07 +00:00
Neil Fuller
8f033bd1b5 Changes associated with the new geotz module
The new geotz module has files that need to be readable by the system
process.

Bug: 172546738
Test: build / boot
Change-Id: I4b9867fa1f738b0fabdf5b72e9e73282f1bd9cbc
2020-11-20 22:15:48 +00:00
Inseob Kim
f1a7f16bab Add ro.cpuvulkan.version to property_contexts
Bug: 173683489
Test: vts_treble_sys_prop_test
Test: VulkanTest
Change-Id: I4d78ed5de6640c4342c4f6c2362976577007a681
2020-11-20 17:28:08 +09:00
David Anderson
09bb944221 Add sepolicy for starting the snapuserd daemon through init.
Restrict access to controlling snapuserd via ctl properties. Allow
update_engine to control snapuserd, and connect/write to its socket.

update_engine needs this access so it can create the appropriate dm-user
device (which sends queries to snapuserd), which is then used to build
the update snapshot.

This also fixes a bug where /dev/dm-user was not properly labelled. As a
result, snapuserd and update_engine have been granted r_dir_perms to
dm_user_device.

Bug: 168554689
Test: full ota with VABC enabled
Change-Id: I1f65ba9f16a83fe3e8ed41a594421939a256aec0
2020-11-19 21:03:30 +00:00
Inseob Kim
5d6020d9f5 Merge "Add contexts for sqlite debug properties" 2020-11-19 08:34:58 +00:00
Suren Baghdasaryan
d0753735aa Enable read access to cgroups.json from shell
VTS tests require access to cgroups.json system and vendor files. Enable
read access to these files from shell.

Bug: 172868075
Test: vts_processgroup_validate_test
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I16ad13729e10c4e033499351761b163cad7cef34
2020-11-18 18:36:29 +00:00
Tej Singh
dd0988fb9b Selinux changes for statsd flags
Test: manually verified statsd can get values using
GetServerConfigurableFlag
Bug: 172842175

Change-Id: I05cb2242dc758e32a22ddf30cb6f09088b70f5d4
2020-11-17 19:28:41 -08:00
Inseob Kim
0cef0fe5ac Add contexts for sqlite debug properties
These are read by some apps, but don't have any corresponding property
contexts. This adds a new context as we're going to remove default_prop
access.

Bug: 173360450
Test: no sepolicy denials
Change-Id: I9be28d8e641eb6380d080150bee785a3cc304ef4
2020-11-18 12:14:20 +09:00
Alan Stokes
8bf8a262e5 Exempt older vendor images from recent mls changes.
We no longer allow apps with mlstrustedsubject access to app_data_file
or privapp_data_file. For compatibility we grant access to all apps on
vendor images for SDK <= 30, whether mlstrustedsubject or not. (The
ones that are not already have access, but that is harmless.)

Additionally we have started adding categories to system_data_file
etc. We treat these older vendor apps as trusted for those types only.

The result is that apps on older vendor images still have all the
access they used to but no new access.

We add a neverallow to prevent the compatibility attribute being
abused.

Test: builds
Change-Id: I10a885b6a122292f1163961b4a3cf3ddcf6230ad
2020-11-17 17:30:10 +00:00
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