Commit graph

16848 commits

Author SHA1 Message Date
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
Treehugger Robot
247f061a65 Merge "Allow input config to be under /vendor/odm" 2018-10-17 00:19:34 +00:00
Tri Vo
708be5e19e Reland "Treat input files as public API."
am: 888b92135c

Change-Id: I11b5fcd8a8ff1429b8454c87bab3c4a3b7b39372
2018-10-16 16:50:09 -07:00
Tri Vo
888b92135c Reland "Treat input files as public API."
Input files are public API:
https://source.android.com/devices/input/input-device-configuration-files
Now that they have labels from core policy (aosp/782082), we can tighten
up our neverallows.

Bug: 37168747
Test: m selinux_policy
Change-Id: Ifaf9547993eb8c701fb63b7ee41971ea4e3f7cf9
2018-10-16 18:02:00 +00:00
Nick Kralevich
2e7ac24b58 add map permission to rw_socket_perms
am: 9c22895c85

Change-Id: Icf1b28c653ed40e827ad087dec13bcd02b9ba484
2018-10-16 09:15:51 -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
Nick Kralevich
9c22895c85 add map permission to rw_socket_perms
Kernel commit 3ba4bf5f1e2c ("selinux: add a map permission check for
mmap") added a map permission check on mmap so that we can
distinguish memory mapped access (since it has different implications
for revocation).  The purpose of a separate map permission check on
mmap(2) is to permit policy to prohibit memory mapping of specific
files for which we need to ensure that every access is revalidated,
particularly useful for scenarios where we expect the file to be
relabeled at runtime in order to reflect state changes (e.g.
cross-domain solution, assured pipeline without data copying).

system/sepolicy commit 4397f08288 added
the map permission to common file macros, to ensure that file access
would continue working even in the presence of a newer kernel. However,
that change did not affect socket access.

Certain socket classes, such as AF_NETLINK and AF_PACKET, also support
mmap operations. This change adds the map permission to rw_socket_perms,
to ensure continued support for newer kernels.

This technically allows mmap even in cases where the socket family
doesn't support it (such as TCP and UDP sockets), but granting it
is harmless in those cases.

In particular, this fixes a bug in clatd, where the following error
would occur:

  10-01 13:59:03.182 7129 7129 I clatd : Starting clat version 1.4 on rmnet0 netid=100 mark=0xf0064
  10-01 13:59:03.195 7129 7129 I auditd : type=1400 audit(0.0:18): avc: denied { map } for comm="clatd" path="socket:[52802]" dev="sockfs" ino=52802 scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=packet_socket permissive=0
  10-01 13:59:03.195 7129 7129 W clatd : type=1400 audit(0.0:18): avc: denied { map } for path="socket:[52802]" dev="sockfs" ino=52802 scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=packet_socket permissive=0
  10-01 13:59:03.199 7129 7129 F clatd : mmap 1048576 failed: Permission denied

Test: policy compiles
Bug: 117791876
Change-Id: I39f286d577b4a2160037ef271517ae8a3839b49b
2018-10-15 21:34:49 -07:00
Chong Zhang
c601d9e5a9 add media.codec.update service
am: 52fb3edbb6

Change-Id: I106c471e9251ec7a4f43b13103c429c3b4fc2476
2018-10-15 17:15:08 -07:00
Tri Vo
9d12ca6f8e tcpdump: allow vendor access on userdebug builds.
am: 3a3a77d4e1

Change-Id: I49563399168c20e574e5603551a3ac23153c48e5
2018-10-15 14:22:46 -07:00
David Anderson
e71ebaa343 Merge "Revert "Treat input files as public API.""
am: a9f9a3a816

Change-Id: Idb5f98a8516fa849d1ed0d502fe99ae826ba2919
2018-10-15 14:22:28 -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
Tri Vo
3a3a77d4e1 tcpdump: allow vendor access on userdebug builds.
Bug: 111243627
Test: m selinux_policy
Change-Id: I0bab79d1a3b7a8b5bf5d12ba2dc5ce46abea5332
2018-10-15 21:00:21 +00:00
David Anderson
a9f9a3a816 Merge "Revert "Treat input files as public API."" 2018-10-15 20:59:27 +00:00
Treehugger Robot
d5c62bfb41 Merge "Add heapprofd selinux config." 2018-10-15 20:53:13 +00:00
David Anderson
c5b504da6b Revert "Treat input files as public API."
This reverts commit 7a560eb4d7.

Reason for revert: build bustage

Change-Id: Iba0ba7a899dca865129a9c715c5f60f8a6edcc2f
2018-10-15 20:51:06 +00:00
Tri Vo
e34172edf6 Finalize cgroup permissions.
am: 235d48600b

Change-Id: If4d53deebca0c4ecba7bc1f2441defa1663cb019
2018-10-15 12:43:06 -07:00
Tri Vo
235d48600b Finalize cgroup permissions.
Policy w.r.t to apps:
- cgroup access from untrusted apps and priv app is neverallow'ed.
- other apps (e.g. vendor apps) need to explicitly declare appropriate
access rules to cgroups.

Policy w.r.t native domains:
- libcutils exports API to /dev/{cpuset, stune}/*. This API is used
abundantly in native vendor code. So we are not going to limit non-app
access to cgroup.

Bug: 110043362
Bug: 117666318
Test: m selinux_policy, boot device
Change-Id: I83aee21ca3e8941725c70706769ea9dbdc76b9c5
2018-10-15 19:34:10 +00:00
Nick Kralevich
8551db901e Merge "vold: allow FS_IOC_FIEMAP"
am: b7d365210e

Change-Id: Iae9439196695c23d255161731b6c9cb4fb9dd958
2018-10-15 11:03:40 -07:00
Tri Vo
c141949f35 Treat input files as public API.
am: 7a560eb4d7

Change-Id: I7f5f061ef4e91bad9a8585ff669a7b4e2b0e6f2d
2018-10-15 11:01:58 -07:00
Treehugger Robot
b7d365210e Merge "vold: allow FS_IOC_FIEMAP" 2018-10-15 17:43:55 +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
Nick Kralevich
877b086097 vold: allow FS_IOC_FIEMAP
This is needed to find the file on the raw block device, so it can be
securely deleted.

Addresses the following denials:

  type=1400 audit(0.0:492): avc: denied { ioctl } for comm="secdiscard" path="/data/misc/vold/user_keys/ce/10/current/encrypted_key" dev="dm-3" ino=9984 ioctlcmd=0x660b scontext=u:r:vold:s0 tcontext=u:object_r:vold_data_file:s0 tclass=file permissive=0
  type=1400 audit(0.0:517): avc: denied { ioctl } for comm="secdiscard" path="/data/misc/vold/user_keys/ce/11/current/secdiscardable" dev="dm-3" ino=9581 ioctlcmd=0x660b scontext=u:r:vold:s0 tcontext=u:object_r:vold_data_file:s0 tclass=file permissive=0
  type=1400 audit(0.0:694): avc: denied { ioctl } for comm="secdiscard" path="/data/misc/vold/user_keys/ce/0/current/keymaster_key_blob" dev="dm-3" ino=9903 ioctlcmd=0x660b scontext=u:r:vold:s0 tcontext=u:object_r:vold_data_file:s0 tclass=file permissive=0

Test: policy compiles and device boots
Change-Id: I1adf21b7fa92b1f92ce76532f4d9337a4d58a2e5
2018-10-15 06:14:08 -07:00
Tri Vo
7a560eb4d7 Treat input files as public API.
Input files are public API:
https://source.android.com/devices/input/input-device-configuration-files
Now that they have labels from core policy (aosp/782082), we can tighten
up our neverallows.

Bug: 37168747
Test: m selinux_policy
Change-Id: I7545b190f35b6b2c86c5dc42c0814f7bccbf1281
2018-10-13 21:22:19 +00: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
af9251539a Merge "Add type for /system/bin/tcpdump." 2018-10-13 05:26:33 +00:00
Nick Kralevich
2116488095 Merge "Allow more file ioctls"
am: 03453d0a95

Change-Id: I1aca888b640da537e22cdc1400349308e3c46552
2018-10-12 22:12:32 -07:00
Treehugger Robot
03453d0a95 Merge "Allow more file ioctls" 2018-10-13 04:59:21 +00:00
Hridya Valsaraju
d65b124af5 Merge "Allow fastbootd to read endpoint descriptor for fastboot usb device"
am: a5b14e89db

Change-Id: I30c25680447d3849be7c59fc5695765150f44fb7
2018-10-12 16:43:05 -07:00
Treehugger Robot
a5b14e89db Merge "Allow fastbootd to read endpoint descriptor for fastboot usb device" 2018-10-12 23:31:46 +00:00
Nick Kralevich
3dae261101 move cgroup auditallow into userdebug_or_eng block
am: 186466e955

Change-Id: I1fdfaf3d86511ced2f1c56b2bfbe42261a332ceb
2018-10-12 15:16:20 -07:00
Nick Kralevich
6586fe3110 Allow more file ioctls
The shell script interpreter checks if file descriptors are ttys, which
causes a bunch of denials. Allow the benign ioctl TCGETS. Addresses the
following denials:

  type=1400 audit(0.0:321): avc: denied { ioctl } for comm="sh"
  path="/data/misc/perfprofd/perferr.txt" dev="sda13" ino=6817306
  ioctlcmd=5401 scontext=u:r:perfprofd:s0
  tcontext=u:object_r:perfprofd_data_file:s0 tclass=file permissive=0

  type=1400 audit(0.0:3189): avc: denied { ioctl } for comm="ps"
  path="/data/user_de/0/com.android.shell/files/bugreports/bugreport-XXXXXXXXX-MASTER-2018-10-11-16-52-40.tmp"
  dev="dm-2" ino=25546 ioctlcmd=0x5401 scontext=u:r:dumpstate:s0
  tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0

  type=1400 audit(0.0:3004): avc: denied { ioctl } for comm="top"
  path="/data/user_de/0/com.android.shell/files/bugreports/bugreport-XXXXXXXXX-MASTER-2018-10-11-16-52-40.tmp"
  dev="dm-2" ino=25546 ioctlcmd=0x5401 scontext=u:r:dumpstate:s0
  tcontext=u:object_r:shell_data_file:s0 tclass=file permissive=0

Include the virtual sdcard when allowing F2FS specific sqlite ioctls,
since apps write sqlite files to the virtual sdcard. Addresses the
following denials:

  type=1400 audit(0.0:324): avc: denied { ioctl } for comm="amapLocManagerT"
  path="/storage/emulated/0/amap/openamaplocationsdk/alsn20170807.db"
  dev="sdcardfs" ino=3546650 ioctlcmd=f50c
  scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:sdcardfs:s0
  tclass=file permissive=0 app=com.xiaomi.hm.health

Test: policy compiles.
Change-Id: I7fc570f2bbf69485b1ee6e6b2d9a421639d29123
2018-10-12 22:07:25 +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
Hridya Valsaraju
2e645853ce Allow fastbootd to read endpoint descriptor for fastboot usb device
Test: fastboot flashall
Bug: 78793464
Change-Id: I8e1e982e3a9e356738944df5bfa1e802794a6a25
2018-10-12 13:33:42 -07:00
Nick Kralevich
186466e955 move cgroup auditallow into userdebug_or_eng block
By convention, auditallow statements are typically put into
userdebug_or_eng blocks, to ensure we don't accidentally ship
unnecessary audit rules. Let's do the same here.

Test: policy compiles.
Change-Id: Ib3eac94284eea3c1ae2f3dacddcb2eaeca95230e
2018-10-12 13:26:40 -07: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
Nick Kralevich
dc2389bc5c installd: add fsverity ioctls
am: 0045ecb0c4

Change-Id: I18a456e47a00e58b353340cc843b8e7a6ef853ed
2018-10-12 13:14:34 -07:00
Treehugger Robot
25b4eb217c Merge "Allow system_server to read vendor_file" 2018-10-12 20:04:22 +00:00
Nick Kralevich
0045ecb0c4 installd: add fsverity ioctls
installd calls fsverity ioctls FS_IOC_ENABLE_VERITY and
FS_IOC_SET_VERITY_MEASUREMENT on APKs in /data/app. Allow it.

Addresses the following denials:

  type=1400 audit(0.0:13): avc: denied { ioctl } for comm="Binder:912_1"
  path="/data/app/com.android.vending-QZXfga9NZzHdv31lJzPTdQ==/base.apk"
  dev="dm-3" ino=43887 ioctlcmd=0x6686 scontext=u:r:installd:s0
  tcontext=u:object_r:apk_data_file:s0 tclass=file permissive=0

  type=1400 audit(0.0:40): avc: denied { ioctl } for comm="Binder:876_1"
  path="/data/app/com.android.settings-0xUwDcuYseP40L3WMUTGIw==/base.apk"
  dev="dm-0" ino=6855 ioctlcmd=0x6685 scontext=u:r:installd:s0
  tcontext=u:object_r:apk_data_file:s0 tclass=file permissive=0

Test: policy compiles and device boots
Bug: 30972906
Change-Id: Ifc88ae6909971c2f2bb24479f5e748fc7900447d
2018-10-12 08:56:48 -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