Commit graph

2702 commits

Author SHA1 Message Date
Treehugger Robot
554f18163a Merge "sepolicy: Allow apps to get info from priv_app by ashmem" 2018-10-24 18:02:23 +00:00
Anton Hansson
854adfd6a8 Merge "Add sepolicy for preloads_copy script" 2018-10-24 17:09:11 +00:00
Tom Cherry
fc1980eb8a Merge "Combine vendor-init-actionable with vendor-init-readable" 2018-10-24 15:52:06 +00:00
Tom Cherry
30dd711157 Combine vendor-init-actionable with vendor-init-readable
Historically, vendor-init-actionable was created since the various
property_contexts files were not yet available when init parses its
scripts.  Since then, the property_contexts files are now always
available when init parses its scripts, so we can collapse these two
categories.

Specifically, this change ensures that all of the properties in the
previous 'stable_properties.h' file in init, which contained the
vendor-init-actionable properties, are able to be read by init
according to SEPolicy.

Bug: 71814576
Test: vendor_init fails to use non-readable properties as a trigger
Test: vendor_init successfully uses readable properties as a trigger

Change-Id: Ic6d9919b6047f3076a1a19fc26295c6a77aca627
2018-10-24 01:58:32 +00:00
Sudheer Shanka
95767cce45 Track vrcore_app SELinux denial
Bug: 118185801
Test: bug no. appears in the denial logs
Change-Id: Ib1d1bbbdf25e0e63ac8a7dec98aca08cafc3f870
2018-10-23 12:19:27 -07:00
Anton Hansson
edd13bc3b2 Add sepolicy for preloads_copy script
Copied from device/google/crosshatch-sepolicy.

Test: diff files in system/etc/selinux before and after for aosp_marlin
Change-Id: I518c43af9c217483bdab02424e4aef0270aad366
2018-10-23 17:11:36 +01:00
ji, zhenlong z
fdfa42bf29 sepolicy: Allow apps to get info from priv_app by ashmem
This is used to address a CTS testcase failure. This CTS
testcase need to access the content of Contact, some data
from ContactProvider is transfered through ashmem.

Currently ashmem is backed by the tmpfs filesystem, ContactProvider
in android run as a priv_app, so the file context of the ashmem
created by ContactProvider is priv_app_tmpfs. CTS runs as an
untrusted_app, need to be granted the read permission to the
priv_app_tmpfs files.

Bug: 117961216

[Android Version]:
android_p_mr0_r0

[Kernel Version]:
4.19.0-rc8

[CTS Version]:
cts-9.0_r1

[Failed Testcase]:
com.android.cts.devicepolicy.ManagedProfileTest#testManagedContactsPolicies

[Error Log]:
11-11 11:15:50.479 12611 12611 W AndroidTestSuit: type=1400 audit(0.0:811):
avc: denied { read } for path=2F6465762F6173686D656D202864656C6574656429
dev="tmpfs" ino=174636 scontext=u:r:untrusted_app:s0:c113,c256,c522,c768
tcontext=u:object_r:priv_app_tmpfs:s0:c522,c768 tclass=file permissive=0

[Test Result With This Patch]:
PASS

Change-Id: I45efacabe64af36912a53df60ac059889fde1629
2018-10-23 12:37:03 +08:00
Treehugger Robot
faba431221 Merge "priv_app: remove /proc/net access" 2018-10-22 17:33:48 +00:00
Nick Kralevich
674b168480 start enforcing ioctl restrictions on blk_file
am: 4c8eaba75a

Change-Id: Ic97b8aafa7f6edcf54e08230905b34500fbe677e
2018-10-19 00:00:42 -07:00
Nick Kralevich
acb41aca25 Move class bpf definition
am: f5a1b1bfa9

Change-Id: Idd4890670d766d71d4b2f6feb0066993ca079b90
2018-10-18 23:58:19 -07:00
Jiyong Park
6d474849e8 Allow apexd to realpath(3) on apex_key_files
am: ecc09871ba

Change-Id: I43f3d98669537d24879f3a734e2684968813e148
2018-10-18 23:46:29 -07:00
Nick Kralevich
4c8eaba75a start enforcing ioctl restrictions on blk_file
Start enforcing the use of ioctl restrictions on all Android block
devices. Domains which perform ioctls on block devices must be explicit
about what ioctls they issue. The only ioctls allowed by default are
BLKGETSIZE64, BLKSSZGET, FIOCLEX, and FIONCLEX.

Test: device boots and no problems.
Change-Id: I1195756b20cf2b50bede1eb04a48145a97a35867
2018-10-18 15:24:32 -07:00
Nick Kralevich
dfc3c33689 priv_app: remove /proc/net access
Remove most of /proc/net access for priv_apps. Files in /proc/net leak
unique device identifiers and side channel information about other app's
network connections.

Access for most third party applications was removed in commit
d78e07cbb7. This change applies the same
constraints to priv-apps that we apply to normal apps.

Bug: 114475727
Bug: 9496886
Bug: 68016944
Test: policy compiles and device boots
Change-Id: I5c41ba57fcd6b81d72c4f3a40b310d2188fc79c3
2018-10-18 09:44:50 -07:00
Nick Kralevich
f5a1b1bfa9 Move class bpf definition
No functional change. This reorg just makes it easier to perform diffs
against https://github.com/SELinuxProject/refpolicy/blob/master/policy/flask/access_vectors

Test: policy builds.
Change-Id: I10cf9547d57981c76ee7e76daa382bb504e36d0b
2018-10-18 09:08:26 -07:00
Jiyong Park
ecc09871ba Allow apexd to realpath(3) on apex_key_files
apexd uses realpath(3) to ensure that the public key file that will use
is under /system/etc/security/apex directory. In order to support it,
allow apexd to getattr on apex_key_files.

The canonicalization is required because the key name from APEX might be
wrong. For example, if the key name from an APEX is '../../some/path'
then apexd will use '/system/etc/security/apex/../../some/path' as the
public key file, which is incorrect.

Bug: 115721587
Test: m apex.test; m
/apex/com.android.example.apex@1 exists

Change-Id: I6dc5efa0de369f8497e4f6526e0164e2de589c67
2018-10-18 20:39:37 +09:00
Nick Kralevich
f00935a550 mediaprovider: add functionfs ioctl
am: a73f58aee1

Change-Id: I573c72eb0795862a498772e74cb7f230876fa914
2018-10-17 14:02:36 -07:00
Nick Kralevich
a73f58aee1 mediaprovider: add functionfs ioctl
Addresses the following denial:

type=1400 audit(0.0:51894): avc: denied { ioctl } for comm="MtpServer" path="/dev/usb-ffs/mtp/ep1" dev="functionfs" ino=30291 ioctlcmd=0x6782 scontext=u:r:mediaprovider:s0:c512,c768 tcontext=u:object_r:functionfs:s0 tclass=file permissive=0 app=com.android.providers.media

Test: policy compiles.
Change-Id: I5290abb2848e5824669dae4cea829d4cbea98ab4
2018-10-17 10:14:40 -07:00
Dario Freni
84a010c48c Allow apexd to create symlink in /apex.
am: bab267a88f

Change-Id: I2ae046cd9434b983abe6366bd72e595b48ddfdf4
2018-10-17 09:32:41 -07:00
Dario Freni
bab267a88f Allow apexd to create symlink in /apex.
Bug: 115710947
Test: on device
Change-Id: Ie712689d80fb829f16de70e865cac4f0ff4e9b35
2018-10-17 11:25:02 +01:00
Bowgo Tsai
0a2efc1698 Merge "Allow input config to be under /vendor/odm"
am: 247f061a65

Change-Id: Ibec2927b80068cedc0c7ba7391e6fe53d9ae0892
2018-10-16 17:27:24 -07:00
Bowgo Tsai
591293111e Allow input config to be under /vendor/odm
Input config should be under /odm when it's "device-specific",
instead of /vendor (for "SoC-specific").

However, not all device have /odm partition so having the fallback
symlink: /odm -> /vendor/odm is important

Bug: 112880217
Test: build
Change-Id: I294e2b172d06d58a42c51c128e448c7644f854dc
2018-10-16 18:18:53 +08:00
Chong Zhang
c601d9e5a9 add media.codec.update service
am: 52fb3edbb6

Change-Id: I106c471e9251ec7a4f43b13103c429c3b4fc2476
2018-10-15 17:15:08 -07:00
Florian Mayer
40144ea2af Merge "Add heapprofd selinux config."
am: d5c62bfb41

Change-Id: Ie33eefd304941d2d4553eb35a91e174b2c3c859d
2018-10-15 14:21:32 -07:00
Chong Zhang
52fb3edbb6 add media.codec.update service
Add a service in mediaswcodec to load updated codecs,
and restrict it to userdebug/eng. Reuse existing
mediaextractor_update_service since the codec update
service is identical, this avoids adding a new one
for now as we may not need the service anymore
after switching to APEX.

Bug: 111407413
Bug: 117290290

Change-Id: Ia75256f47433bd13ed819c70c1fb34ecd5d507b4
2018-10-15 21:06:53 +00:00
Florian Mayer
4fde9ec7b3 Add heapprofd selinux config.
This does not actually grant any permissions but just adds the
necessary boilerplate for a new service.

Bug: 117762471
Bug: 117761873

Change-Id: I7cdd2ae368616cfd54fc685c15f775604bfc80d4
2018-10-15 18:31:26 +01:00
Tri Vo
3026dc738f Audit access to same_process_hal_file.
am: 81ade3dd1d

Change-Id: Ie3437cd699d16cbf72fca61c5646800d90feaa2a
2018-10-12 22:43:35 -07:00
Tri Vo
7151273060 Merge "Add type for /system/bin/tcpdump."
am: af9251539a

Change-Id: Ie51d95317f6613e086b2b80a5ca967779ab9eb32
2018-10-12 22:43:20 -07:00
Tri Vo
81ade3dd1d Audit access to same_process_hal_file.
same_process_hal_file is exempted from many Treble neverallows. We want
to know which processes access this type to eventually constrain access
to it.

Bug: 37211678
Test: m selinux_policy
Change-Id: I61c0df21250eb1b1ae2d9c5fa9c801a828539813
2018-10-13 05:27:03 +00:00
Tri Vo
e8b33c3139 Add type for /system/bin/tcpdump.
We add this type with the intent to expose /system/bin/tcpdump to
vendor on userdebug devices only.

Bug: 111243627
Test: device boots /system/bin/tcpdump correctly labeled as
tcpdump_exec, can browse internet, turn wifi on/off
Change-Id: Icb35e84c87120d198fbb2b44edfa5edf6021d0f0
2018-10-12 21:51:46 +00:00
Siarhei Vishniakou
c38d803278 Merge "Allow system_server to read vendor_file"
am: 25b4eb217c

Change-Id: I78ecee68fdc8dadf62b0c3977f01a0571a1bdc1f
2018-10-12 13:14:55 -07:00
Siarhei Vishniakou
3639f57960 Allow system_server to read vendor_file
Input device configuration files .idc, .kl that are placed in /vendor
are currently not accessible.
Allow the read access here.

Bug: 112880217
Test: move .idc and .kl files from /system to /vendor, then observe
logcat. With this patch, avc denials disappear.

Change-Id: I72ad62b9adf415f787565adced73fd8aaff38832
2018-10-12 02:42:09 +00:00
Chong Zhang
817027b055 Merge "add mediaswcodec service"
am: 9977e25411

Change-Id: Id64de9050f14d4f782dbdf6a9b695a52201e042e
2018-10-11 19:03:25 -07:00
Treehugger Robot
9977e25411 Merge "add mediaswcodec service" 2018-10-12 01:48:47 +00:00
Sooraj Sasindran
d09ac29451 Merge "Add ians service contexts"
am: 3158efd684

Change-Id: I1c01a879a6eeeecbaa0ecbaf211c61aa7cbec72a
2018-10-11 16:15:32 -07:00
Sooraj Sasindran
3158efd684 Merge "Add ians service contexts" 2018-10-11 22:58:32 +00:00
Chong Zhang
bdbfff1b00 add mediaswcodec service
Set up a new service for sw media codec services.

Bug: 111407413

Test: cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice
Change-Id: Ia1c6a9ef3f0c1d84b2be8756eb1853ffa0597f8e
2018-10-11 15:10:17 -07:00
Nick Kralevich
b8b512528c remove system_app proc_net_type access
am: 2e251461fc

Change-Id: I8bee9014a8b4debfff0b29c7178b6126a4aaa365
2018-10-11 12:59:38 -07:00
Nick Kralevich
2e251461fc remove system_app proc_net_type access
The auditallow added in 7a4af30b3 has not triggered. This is safe to
remove.

Test: device boots and no obvious problems.
Test: No audit messages seen since May 2018 on go/sedenials
Bug: 9496886
Bug: 68016944
Change-Id: I3861b462467e1fc31e67a263ad06716a4111dcb8
2018-10-11 10:20:19 -07:00
Tri Vo
7f5c49235f Merge "Constrain cgroups access."
am: 99f2477953

Change-Id: Ib2dd4f787fb6fb00234ee70d2a6e1569b3d96fd5
2018-10-11 09:44:01 -07:00
Tri Vo
f55c989d18 Constrain cgroups access.
What changed:
- Removed cgroup access from untrusted and priv apps.
- Settings app writes to /dev/stune/foreground/tasks, so system_app domain
retains access to cgroup.
- libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used
abundantly in native code. So added a blanket allow rule for (coredomain - apps)
to access cgroups.
- For now, only audit cgroup access from vendor domains. Ultimately, we want to
either constrain vendor access to individual domains or, even better, remove
vendor access and have platform manage cgroups exclusively.

Changes from original aosp/692189 which was reverted:
- There seem to be spurious denials from vendor-specific apps. So added
back access from { appdomain -all_untrusted_apps -priv_app } to cgroup.
Audit this access with intent to write explicit per-domain rules for it.

Bug: 110043362
Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates
/dev/memcg on a per app basis on a device that supports that.
Test: aosp_sailfish, wahoo boot without cgroup denials
This reverts commit cacea25ed0.
Change-Id: I05ab404f348a864e8409d811346c8a0bf49bc47a
2018-10-10 17:41:09 -07:00
Tri Vo
fc25373422 Merge "Label /data/asan/* libs as system_lib_file."
am: 9a06d551c6

Change-Id: Ib00c42dea5a1f89b9a45c01df80680ecf7a76381
2018-10-10 13:43:57 -07:00
Sooraj Sasindran
ffaf66d48b Add ians service contexts
Add ians service contexts

Bug: 113106744
Test: verified from service list that ianas is
      registered
Change-Id: Iea653416ffa45cba07a544826e0a2395d31cedca
Merged-In: Iea653416ffa45cba07a544826e0a2395d31cedca
2018-10-10 20:43:05 +00:00
Tri Vo
45d521a577 Label /data/asan/* libs as system_lib_file.
This patch gives global access to asan libraries. This is not ideal since the
labeling is not symmetric with standard locations, but this approach is easy to
maintain.

Fixes: 117555408
Test: processes on asan builds load /data/asan/* libs correctly
Change-Id: If54558c1808d8b16e06073c150c9f3eb358dda67
2018-10-10 11:23:00 -07:00
Nick Kralevich
d3d4fe8e8c Merge "Move to ioctl whitelisting for plain files / directories"
am: ae079b88bb

Change-Id: I334de5f9528e4b84fc656b95de2832b6e63502df
2018-10-10 08:55:52 -07:00
Nick Kralevich
6a4f72fecc Revert "Constrain cgroups access."
am: cacea25ed0

Change-Id: I501b64576a2f059ce5c56064777cad07251d72cb
2018-10-10 06:10:40 -07:00
Nick Kralevich
ebc3a1a34c Move to ioctl whitelisting for plain files / directories
Remove kernel attack surface associated with ioctls on plain files. In
particular, we want to ensure that the ioctls FS_IOC_ENABLE_VERITY and
FS_IOC_MEASURE_VERITY are not exposed outside a whitelisted set of
entities. However, it's straight forward enough to turn on ioctl
whitelisting for everything, so we choose to do so.

Test: policy compiles and device boots
Test: device boots with data wipe
Test: device boots without data wipe
Change-Id: I545ae76dddaa2193890eeb1d404db79d1ffa13c2
2018-10-10 13:02:57 +00:00
Nick Kralevich
cacea25ed0 Revert "Constrain cgroups access."
This reverts commit 9899568f6c.

Reason for revert: Reports of high numbers of SELinux denials
showing up on the SELinux dashboard.

Bug: 110043362
Change-Id: Id8fc260c47ffd269ac2f15ff7dab668c959e3ab0
2018-10-10 04:25:17 +00:00
Tri Vo
0b4e4f47f7 Constrain cgroups access.
am: 9899568f6c

Change-Id: I253a0b620daa55663eda04baecba2d2ffd925925
2018-10-09 16:52:32 -07:00
Tri Vo
9899568f6c Constrain cgroups access.
What changed:
- Removed cgroup access from untrusted and priv apps.
- Settings app writes to /dev/stune/foreground/tasks, so system_app domain
retains access to cgroup.
- libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used
abundantly in native code. So added a blanket allow rule for (coredomain - apps)
to access cgroups.
- For now, only audit cgroup access from vendor domains. Ultimately, we want to
either constrain vendor access to individual domains or, even better, remove
vendor access and have platform manage cgroups exclusively.

Bug: 110043362
Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates
/dev/memcg on a per app basis on a device that supports that.
Test: aosp_sailfish, wahoo boot without cgroup denials
Change-Id: I9e441b26792f1edb1663c660bcff422ec7a6332b
2018-10-09 23:42:06 +00:00
Igor Murashkin
9a88ef46a9 Merge "iorapd: Add new binder service iorapd."
am: 77e40fbd06

Change-Id: Ibf6517366094b6d47cc0e1551b2ed709c3b10937
2018-10-09 16:29:10 -07:00