Commit graph

6420 commits

Author SHA1 Message Date
Satoshi Niwa
e4a575f79b Fix a sepolicy violation error for hal_wifi
set_prop(hal_wifi, wifi_hal_prop) violates a neverallow rule
on PRODUCT_SHIPPING_API_LEVEL=28  b/173611344#comment20

Bug: 173611344
Test: m
Change-Id: I56ff953e196777ffdc7a8ca92bcf788e3431aaac
2020-11-25 10:24:41 +09:00
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
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
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
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
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
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
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
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
Josh Gao
1fcd3d9e8c Merge "Let adbd set service.adb.tcp.port." 2020-11-10 00:32:25 +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
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
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
Hayden Gomes
0b5171df39 Merge "Adding support for AIDL AudioControl HAL" 2020-10-30 14:21:10 +00:00
Hayden Gomes
bf08517f2c Adding support for AIDL AudioControl HAL
Bug: 170335834
Test: built and ran without sepolicy issues
Change-Id: Ia25b82aaf676fd2bd37e60bc0d2960f398fa3c90
2020-10-29 10:56:23 -07:00
Alan Stokes
8e307e0847 Merge "Make kmsg_device mlstrustedobject." 2020-10-28 11:20:20 +00:00
Alan Stokes
a0518b7fdb Make kmsg_device mlstrustedobject.
Few domains are granted access to this, but they should have access
from any user.

Also add some neverallows to prevent misuse.

Bug: 170622707
Test: presubmits
Change-Id: Iacbe7b0525604f2339f8bf31c105af738bc3cd75
2020-10-28 09:41:07 +00:00
David Anderson
45ac6e8400 Merge "Add sepolicy for dm-user devices and the snapuserd daemon." 2020-10-27 16:39:14 +00:00
David Anderson
fe30369efb Add sepolicy for dm-user devices and the snapuserd daemon.
dm-user is a new device-mapper module, providing a FUSE-like service for
block devices. It creates control nodes as misc devices under
/dev/dm-user/. Make sure these nodes get a unique selabel.

snapuserd is a daemon for servicing requests from dm-user. It is a
low-level component of Virtual A/B updates, and provides the bridge
betewen dm-snapshot and the new COW format. For this reason it needs
read/write access to device-mapper devices.

Bug: 168259959
Test: ctl.start snapuserd, no denials
      vts_libsnapshot_test, no denials
Change-Id: I36858a23941767f6127d6fbb9e6755c68b91ad31
2020-10-26 23:23:01 -07:00
Woody Lin
8633462d85 Add zygote.critical_window.minute property
This property controls the minimal timing window that triggers init
process fatal abort, when the zygote service crashes repeatedly in it.

Bug: 146818493
Change-Id: Ibd371be0daf6510df8b4d1a1f12f0aab8d6392c7
2020-10-27 01:33:49 +08:00
Yo Chiang
6273186e0f Merge "Allow gsid to find and binder-call vold" 2020-10-26 05:27:36 +00:00
Yo Chiang
453c55057b Merge "Add secdiscard policies for vold_metadata_file" 2020-10-26 05:27:36 +00:00
Primiano Tucci
f1fa1b9114 Merge "Allow tracing service to access kallsyms on userdebug" 2020-10-23 18:03:30 +00:00
Primiano Tucci
cd452300a7 Allow tracing service to access kallsyms on userdebug
This CL allows the traced_probes service to temporarily
lower kptr_restrict and read /proc/kallsyms.
This is allowed only on userdebug/eng builds.
The lowering of kptr_restrict is done via an init
property because the kernel checks that the kptr_restrict
writer is CAP_SYS_ADMIN, regardless of the /proc file ACLs [1].

[1] 4cbffc461e/kernel/sysctl.c (L2254)

Bug: 136133013
Design doc: go/perfetto-kallsyms
Test: perfetto_integrationtests --gtest_filter=PerfettoTest.KernelAddressSymbolization in r.android.com/1454882

Change-Id: Ic06e7a9a74c0f3e42fa63f7f41decc385c9fea2c
2020-10-23 14:03:08 +01:00
Yo Chiang
ffe786ebd7 Allow gsid to find and binder-call vold
Bug: 168571434
Test: 1. Install a DSU system.
  2. Boot the DSU system and reboot back to the host system.
  3. Wipe the DSU installation.
  4. DSU metadata key dir /metadata/vold/metadata_encryption/dsu/dsu is
     destroyed.
Change-Id: I229a02abb7bd1f070bb078bdaf89fb27cc4bfa47
2020-10-23 20:30:00 +08:00
Steven Moreland
7c794ba51d Merge "untrusted_apps: AIDL vendor service parity w/ HIDL" 2020-10-22 23:08:09 +00:00
Steven Moreland
a43e26e3f2 untrusted_apps: AIDL vendor service parity w/ HIDL
Before, we completely dissallowed any untrusted app to access a service
operated by vendor. However, sometimes this is needed in order to
implement platform APIs. So now, vendor services which aren't explicitly
marked as 'protected_service' (like protected_hwservice in HIDL) are
blocked from being used by apps. This gives everyone a mechanism for
apps to directly access vendor services, when appropriate.

For instance:

                        VINTF
                          |
        vendor.img/etc    |   system.img/etc
                          |
 (vendor HAL) <----AIDL---|--> (public lib   <-- loaded by app
                          |     or platform
                          |     component)
                          |
                          |

Fixes: 163478173
Test: neverallow compiles
Change-Id: Ie2ccbff4691eafdd226e66bd9f1544be1091ae11
2020-10-21 22:33:42 +00:00
Treehugger Robot
c1eb80e302 Merge "init: allow LOOP_GET_STATUS ioctl on loop device" 2020-10-21 19:03:38 +00:00
Jeff Vander Stoep
2442019061 init: allow LOOP_GET_STATUS ioctl on loop device
This is needed here:
https://android.googlesource.com/platform/system/core/+/refs/heads/master/init/builtins.cpp#494

Bug: 170934466
Test: TH
Change-Id: I8e6d06cae42d68182e9cca29723f0b16ff413b7c
2020-10-21 11:22:58 +02:00
Treehugger Robot
cc9cfa92c1 Merge "Add SEpolicy for VcnManagementService" 2020-10-21 00:54:35 +00:00
Treehugger Robot
21961caeff Merge "Enforce sysprop owner" 2020-10-21 00:26:34 +00:00
Maciej Żenczykowski
159c6e13dc public/file.te: add 'allow proc_net proc:filesystem associate'
Per http://cs/aosp-master/system/sepolicy/private/genfs_contexts?l=21

  genfscon proc /net u:object_r:proc_net:s0

/proc/net/... portion of proc should be 'proc_net' not the default of 'proc'

For example on a bonito:
  $ adbb shell ls -alZd /proc /proc/net/xt_quota
  dr-xr-xr-x 757 root root u:object_r:proc:s0      0 1969-12-31 16:00 /proc
  dr-xr-xr-x   2 root root u:object_r:proc_net:s0  0 2020-10-20 11:02 /proc/net/xt_quota

This already mostly works, but occasionally on 4.19 devices we see
(apparently spurious) denials (my gut feeling is kernel behaviour
changed and/or is racy):

[   37.434457] type=1400 audit(1574821413.359:2102): avc: denied { associate } for comm="Binder:762_1" name="globalAlert" scontext=u:object_r:proc_net:s0 tcontext=u:object_r:proc:s0 tclass=filesystem permissive=1

Presumably caused by a binder rpc into netd:
  http://cs/aosp-master/system/netd/server/BandwidthController.cpp?l=635&rcl=cdd79f13c670605819333de2d7b67d7f8a42210c

Things seem to work anyway, presumably because eventually it does somehow
get set to 'proc_net' anyway...

This patch will allow the removal of:
    allow proc_net proc:filesystem { associate };
and
    dontaudit proc_net proc:filesystem associate;
from device specific configs.

Bug: 145579144
Bug: 170265025
Test: treehugger will
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I46294d8b1526e846a5eddb350adf51c76634b8f1
2020-10-20 18:25:39 +00:00
Treehugger Robot
913868c19d Merge "Added system_server_dumper service." 2020-10-20 17:46:13 +00:00
Treehugger Robot
766ad4462a Merge "Revert "Prevent isolated_app from searching system_data_file."" 2020-10-20 10:06:54 +00:00
Felipe Leme
e418956ae3 Added system_server_dumper service.
It will be used to dump system_server data that is not associated
with any service.

Test: adb shell dumpsys system_server
Bug: 163921395

Change-Id: I5719f7cd3a9022dc0ab12a3b3b22487e2b4866e0
2020-10-19 21:27:06 -07:00
Inseob Kim
afc09932f6 Enforce sysprop owner
Every property should have an appropriate owner attribute, which can be
one of: system_property_type, product_property_type, or
vendor_property_type. This will be enforced for devices launching with S
or later. Devices launching with R or eariler can relax this by setting
following under BoardConfig.mk:

BUILD_BROKEN_ENFORCE_SYSPROP_OWNER := true

Bug: 131162102
Test: system/sepolicy/tools/build_policies.sh
Change-Id: I7914ef1b7463c9ec00812b9720094531fd63f0c7
2020-10-19 05:07:05 +00:00
Treehugger Robot
d06cdd66d5 Merge "Allow people service to publish apis" 2020-10-16 22:46:28 +00:00
Treehugger Robot
b178fe826c Merge changes from topic "ramdisk_timestamp_runtime_load"
* changes:
  Add ro.bootimage.* property contexts
  Add /second_stage_resources tmpfs.
2020-10-16 19:23:08 +00:00
Julia Reynolds
859e5a3093 Allow people service to publish apis
Test:IPeopleManager.Stub.asInterface(ServiceManager.getService(Context.PEOPLE_SERVICE) is
not null when called from another process
Bug: 169783793

Change-Id: I280568955c50f9deef0a35ad1b9864ffc0a82db4
2020-10-16 19:22:33 +00:00
Jack Yu
dd5c5d7960 Merge "Add sepolicy to allow read/write nfc snoop log data" 2020-10-16 07:56:10 +00:00