Commit Graph

17020 Commits

Author SHA1 Message Date
Jiyong Park
b23f71d97d Set filecontext for the test apex
Label the surfaceflinger binary as surfaceflinger_exec

Test: m apex.test; m; device is bootable

Change-Id: I22297ba514f7ba298a1d0d4b476a447f26e48078
2018-11-16 21:10:38 +09:00
Nick Kralevich
a194d3757a Tighten up handling of new classes
1b1d133be5 added the process2 class but
forgot to suppress SELinux denials associated with these permissions
for the su domain. Suppress them.

Ensure xdp_socket is in socket_class_set, so the existing dontaudit rule
in su.te is relevant. Inspired by
66a337eec6

Add xdp_socket to various other neverallow rules.

Test: policy compiles.
Change-Id: If5422ecfa0cc864a51dd69559a51d759e078c8e7
2018-11-16 03:10:14 -08:00
Nick Kralevich
598a75c11d Further protect app private data files
Remove the special case that allowed init to relabel app_data_file and
privapp_data_file. The auditallow added in
ab82125fc8 has never triggered.

Bug: 80190017
Test: policy compiles
Test: no SELinux denials collected for the auditallow rule
Change-Id: Ide7c31e1a0628464ec2fcf041e8975087c39166d
2018-11-16 01:03:11 -08:00
Treehugger Robot
e00ca14cbb Merge "Delete get_prop(su, ...) rules" 2018-11-16 06:16:30 +00:00
Treehugger Robot
118a106c63 Merge "Add placeholder iris and face policy for vold data directory" 2018-11-16 04:15:35 +00:00
Treehugger Robot
2924f6e7e9 Merge "Move coredomains rules from private/domain.te to private/coredomain.te" 2018-11-16 03:28:17 +00:00
Nick Kralevich
40d4b0b6cc Delete get_prop(su, ...) rules
It is unnecessary to use get_prop() rules for the su domain. The
su domain is always in permissive mode [1] and not subject to SELinux
enforcement. It's also possible these rules were added to avoid SELinux
denial log spam from showing up, however, there are already dontaudit
rules in place [2] to prevent this.

Delete the unnecessary rules.

[1] 96b62a60c2/private/su.te (19)
[2] 96b62a60c2/public/su.te (42)

Test: policy compiles
Change-Id: I5913f360738725bf915f0606d381029b9ba4318f
2018-11-15 19:01:19 -08:00
Treehugger Robot
96b62a60c2 Merge "Rename APEX file_contexts as <name>-file_context" 2018-11-16 02:24:59 +00:00
Kevin Chyn
92bde4b941 Add placeholder iris and face policy for vold data directory
Test: vold is able to create directories, ag/5534962

Bug: 116528212

Change-Id: I61dd8802c13b1c42d334a80b678ca6a877848fc2
2018-11-15 17:32:03 -08:00
Tri Vo
a289d523ea Move coredomains rules from private/domain.te to private/coredomain.te
We lose git history with this, but imo the rules being moved don't have
much reference material. Also, as we write more neverallow rules for
CKI, I'd like to consolidate them in private/coredomain.te

Test: m selinux_policy
Change-Id: I6d0c3d2af0c4dfe7dd3cb1d8836b4b5e00db37a4
2018-11-15 15:15:53 -08:00
Treehugger Robot
cf7f20cfb4 Merge "racoon: allow ioctl TUNSETIFF" 2018-11-15 21:48:22 +00:00
Treehugger Robot
3868557d0c Merge "Incidentd gets statsd incident section" 2018-11-15 21:44:27 +00:00
Tri Vo
c7f56cdc83 Remove kmem_device selinux type.
kmem_device was used to label /dev/mem and /dev/kmem. We already have
multiple layers of protection against those /dev nodes being present on
devices.

CTS checks that /dev/mem and /dev/kmem don't exist:
https://android.googlesource.com/platform/cts/+/master/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java#233

VTS enforces our base kernel configs, which have CONFIG_DEVKMEM and
CONFIG_DEVMEM disabled:
https://android.googlesource.com/kernel/configs/+/master/android-4.9/android-base.config#2

Bug: 110962171
Test: m selinux_policy
Change-Id: I246740684218dee0cddf81dabf84d4763a753cde
2018-11-15 21:31:56 +00:00
Treehugger Robot
fb79404e3a Merge "allow apps tun_device ioctl TUNGETIFF;" 2018-11-15 21:06:26 +00:00
Yifan Hong
77fd9dbda4 Merge "Allow BLKIOMIN and BLKALIGNOFF to super device in update_engine." 2018-11-15 18:56:10 +00:00
Nick Kralevich
3ddaa63bde racoon: allow ioctl TUNSETIFF
Used by
bf16586a33/main.c (116)

Addresses the following denial:

audit(0.0:8126): avc: denied { ioctl } for comm="racoon" path="/dev/tun" dev="tmpfs" ino=25329 ioctlcmd=0x54ca scontext=u:r:racoon:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file permissive=0

Test: policy compiles.
Change-Id: Ia26077d4a9e810c7006d4b979d6b7e9ca154b485
2018-11-15 10:32:45 -08:00
Treehugger Robot
46522131db Merge "Allow dumpstate to call gpuservice over binder" 2018-11-15 15:54:41 +00:00
Mårten Kongstad
f62362da52 Add idmap2 and idmap2d
Bug: 78815803
Test: builds, boots
Test: manual: adb shell idmap2 create ...
Test: manual: adb shell ps | grep -e idmap2d
Change-Id: I60852e15d99329896ff9de6559d1e7cd1c67e33d
2018-11-15 14:42:10 +00:00
Nick Kralevich
3b2df198d1 allow apps tun_device ioctl TUNGETIFF;
Commit 619c1ef2ac ("tun_device: enforce
ioctl restrictions") completely removed the ability of untrusted apps to
issue ioctl calls to tun_device. It turns out that this was too
aggressive. Wireshark apparently uses the TUNGETIFF ioctl.

Fixes the following denial:

audit(0.0:384744): avc: denied { ioctl } for comm=4173796E635461736B202332 path="/dev/tun" dev="tmpfs" ino=19560 ioctlcmd=54d2 scontext=u:r:untrusted_app:s0:c51,c257,c512,c768 tcontext=u:object_r:tun_device:s0 tclass=chr_file permissive=1 app=com.wireguard.android

Test: policy compiles.
Change-Id: I71bb494036ea692781c00af37580748ab39d1332
2018-11-15 06:14:07 -08:00
Yifan Hong
8d32223bdc Allow BLKIOMIN and BLKALIGNOFF to super device in update_engine.
These ioctls are similar to BLKGETSIZE64; they return benign information
about the partition's alignment, and are used by liblp to optimally
align dynamic partition extents.

The system_block_device is included here because on retrofit devices,
the "super" partition is mapped to the system partition.

Test: manual OTA on retrofit device
Bug: 118506262
Change-Id: I3dd3c99d86d63f97bcd393cff374e27f5ed2da2e
2018-11-14 16:16:11 -08:00
Treehugger Robot
7ef01c34ed Merge "Allow iw to be run at init phase." 2018-11-14 23:09:33 +00:00
Treehugger Robot
920232be30 Merge "vold: allow ioctls BLKDISCARD and BLKGETSIZE" 2018-11-14 22:40:40 +00:00
Treehugger Robot
5791e6eeeb Merge "Fix the bound size and the variable name" 2018-11-14 21:13:02 +00:00
Nick Kralevich
fefc887eda vold: allow ioctls BLKDISCARD and BLKGETSIZE
BLKDISCARD is used by vold while wiping block devices
b2455747a9/Utils.cpp (619)

BLKGETSIZE is used to determine the size of the block device. Ideally
code should not be using this ioctl, as it fails for devices >= 2T in
size. Vold indirectly uses this when executing /system/bin/newfs_msdos.
Arguably this is a bug in newfs_msdos, as BLKGETSIZE64 should be used
instead.
Code: 0c7e133c7f/mkfs_msdos.c (845)

Addresses the following denials:

audit(0.0:24): avc: denied { ioctl } for comm="Binder:588_2" path="/dev/block/vold/public:7,9" dev="tmpfs" ino=106407 ioctlcmd=1277 scontext=u:r:vold:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0
audit(0.0:25): avc: denied { ioctl } for comm="newfs_msdos" path="/dev/block/vold/public:7,9" dev="tmpfs" ino=106407 ioctlcmd=1260 scontext=u:r:vold:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0

Test: policy compiles.
Bug: 119562530
Change-Id: Ib7198daf150d6f2578545a6a402e0313069ea2b4
2018-11-14 13:01:00 -08:00
Tomasz Wasilczyk
2e23af5e28 Allow iw to be run at init phase.
This enables native wireless interface configuration at boot.

Bug: 36120314
Test: adb shell ifconfig -a | grep wlan
Change-Id: I797c0c8a8645d690d311f42cec3998b2f4cee77b
2018-11-14 19:10:12 +00:00
Florian Mayer
a8dd89f80f Merge "Add userdebug selinux config for heapprofd." 2018-11-14 10:14:46 +00:00
Treehugger Robot
b32113e106 Merge "Added system property (dumpstate.unroot) to run dumpstate as shell." 2018-11-14 09:50:08 +00:00
Florian Mayer
45f4847c21 Add userdebug selinux config for heapprofd.
Test: m
Test: flash sailfish
Test: profile system_server

Change-Id: I577793af655146ee91be86bb286fcf9d6e6d081d
2018-11-14 09:22:07 +00:00
liwugang
57d66ef1c2 Fix the bound size and the variable name
It will not end when other words appeared because of the wrong bound and variable,
rule_map->length will exceed the actual length in the rule_map_new function,
it will lead to crash in the rule_map_validate function because of strcmp(NULL, str).

Test: 1.add "user=shell doman=system_app" to private/seapp_contexts
      2.exec "checkseapp private/seapp_contexts" and it will not be crashed

Change-Id: I600206448b38cf2c9b61f9141b40f920b05696c8
Signed-off-by: liwugang <liwugang@xiaomi.com>
2018-11-14 16:39:39 +08:00
Treehugger Robot
f0dc093667 Merge "SELinux changes for AppFuse" 2018-11-14 07:27:38 +00:00
Jiyong Park
a4767dd116 Rename APEX file_contexts as <name>-file_context
It was <name>_file_context before. Changing for better readability.

Bug: 119034475
Test: m apex.test com.android.tzdata com.android.runtime
Change-Id: Ic9d6479dfed56ac474c574343a38b5f73dde3c05
2018-11-14 13:56:56 +09:00
Jiyong Park
6a9a852dbd Merge "Move file_contexts for APEXes to under /system/sepolicy" 2018-11-14 03:57:28 +00:00
Risan
0c1848b170 SELinux changes for AppFuse
We are moving AppFuse mount from system_server's mount namespace to
vold. Hence, we could reduce the SELinux permissions given to
system_server, in the expense of adding allow rules to vold and
letting appdomain have access to vold's fd.

Bug: 110379912
Test: testOpenProxyFileDescriptor passes (after vold and
system_server code changes)

Change-Id: I827a108bd118090542354360a8c90b295e6a0fef
2018-11-13 22:45:51 +00:00
Jiyong Park
03ccac0e75 Move file_contexts for APEXes to under /system/sepolicy
For centralized development of sepolices, file_contexts files for APEXes
are all moved to under /system/seplicy.

Bug: 119034475
Bug: 113373927
Test: m apex.test com.android.tzdata com.android.runtime com.android.media
Change-Id: I9bf4874793db4dbdb75cbd759ae95f72d7281007
2018-11-13 14:22:38 -08:00
Joel Galenson
7c275a6b9d Allow dumpstate to call gpuservice over binder
This prevents denials while taking a bugreport.

Bug: 116711254
Test: cts-tradefed run cts -m CtsSecurityHostTestCases -t
android.security.cts.SELinuxHostTest#testNoBugreportDenials

Change-Id: I65dffda9806e0d627978ffdd392e3deb625149b7
2018-11-13 12:36:30 -08:00
Bookatz
d2f3d18fcd Incidentd gets statsd incident section
There is now an incident section for statsd output data. These selinux
changes must be made for incident to call dump on statsd to get the
data.

Bug: 115678461
Test: adb shell incident -b 3023
and confirm that a valid statsd section is obtained

Change-Id: I761389c160ab3ab6c24556813a1a31088c0f5137
2018-11-13 09:18:34 -08:00
Nick Kralevich
a106218c50 OWNERS: add cbrubaker
He's already listed as an authorized +2er in
https://android-review.googlesource.com/admin/groups/810,members

Test: none
Change-Id: Ifff6b3f8353d562b3386d0c2e3b575154f173e23
2018-11-13 08:11:38 -08:00
Tri Vo
ced1751e45 Remove mtd_device type.
mtd_device does not label any /dev node present on walleye, and the only
permission to that type is:
allow hal_telephony_server mtd_device:dir search;
I suspect there is no need to keep mtd_device around.

Bug: 110962171
Test: boot aosp_walleye
Change-Id: If74b1258b21edeca38c8b7dc07a3a10b751a7e85
2018-11-12 23:11:03 +00:00
Treehugger Robot
ca5b01b0a6 Merge "Remove dead *_device types from system sepolicy." 2018-11-12 22:29:32 +00:00
Eugene Susla
c496db327e Add SELinux service for RoleManagerService
Test: ensure no build failures;
add RoleManagerService as a boot phase
ensure no SecurityException in logcat on boot
Change-Id: Ia0803c0fb084fe2b12f5c20f5e46354d0dd1aedf
2018-11-12 17:10:59 +00:00
Nick Kralevich
049c03d8c5 bluetooth: allow TUNGETIFF TUNSETIFF
system/sepolicy commit 619c1ef2ac started
enforcing ioctl whitelisting requirements for /dev/tun. Bluetooth needs
the ability to issue TUNSETIFF on /dev/tun, so allow access. We also
allow access to TUNGETIFF for good measure.

Addresses the following denial:

avc: denied { ioctl } for comm=425420536572766963652043616C6C path="/dev/tun" dev="tmpfs" ino=20047 ioctlcmd=0x54ca scontext=u:r:bluetooth:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file permissive=0

Test: policy compiles
Change-Id: Ie4c138fc774373cec266c59de6663db147d60423
2018-11-10 09:03:10 -08:00
Tri Vo
b805adaa16 Remove dead *_device types from system sepolicy.
No coredomain domain has access to these types and corresponding /dev
nodes don't exist on the device:

audio_seq_device
audio_timer_device
full_device
i2c_device
vcs_device

Bug: 110962171
Test: m selinux_policy
Test: boot walleye
Change-Id: I89ad4755e6760aa166cb22e2655567e5905dc672
2018-11-09 15:45:59 -08:00
Tri Vo
3e8f7bcda5 Merge "Use LOCAL_ADDITIONAL_M4DEFS for file_contexts" 2018-11-09 21:53:31 +00:00
Hongyi Zhang
b965e3c5f9 Sepolicies for server configural flags reset
Test: m -j succeeded and manual tested on device

Change-Id: I3415c58335361a9da4ef2368e61bc4e0250a91bb
2018-11-09 18:55:55 +00:00
Mårten Kongstad
f40942ffd8 Add rules for /product{,_services}/overlay
These rules mirror those for /vendor/overlay and /odm/overlay, including
the possilibity of a symlink like /system/vendor -> /vendor.

Test: builds, boots
Change-Id: I323e48fcc13c4ac7779902506539c2600708cc88
2018-11-09 15:49:55 +00:00
Peiyong Lin
7924dc6054 [SEPolicy] Configure policy for gpu service.
Historically GPU service lives in SurfaceFlinger as a convenient hack.
Howerver, SurfaceFlinger doesn't need to know about anything specific about GPU
capability, and shouldn't know about anything about GPU. This patch moves GPU
service out of SurfaceFlinger.

GPU service is a service that accesses to GPU driver, queries GPU capabilities
and reports back. Currently we use this information in CTS and some benchmarks.

BUG: 118347356
Test: Build, flash and boot, use `adb shell cmd gpu vkjson` to verify
Change-Id: I007989e0f3f73b5caf80277979986820dd127c32
2018-11-08 12:31:11 -08:00
Treehugger Robot
ac6352d818 Merge "Allow bufferhub service to allocate buffer" 2018-11-08 19:41:54 +00:00
Treehugger Robot
e3c52b6934 Merge "Allow adbd to read perfetto_traces_data_file." 2018-11-08 18:29:30 +00:00
Yabin Cui
e7f1354c58 Merge changes from topic "runas_exec"
* changes:
  Add runas_app domain to allow running app data file via run-as.
  Revert "Revert "Enforce execve() restrictions for API > 28""
2018-11-08 17:55:30 +00:00
Felipe Leme
da54e5f2dd Added system property (dumpstate.unroot) to run dumpstate as shell.
This is useful to test how it would behave on devices with user builds.

Bug: 117980186
Test: adb shell setprop dumpstate.unroot true && \
      adb shell cmd activity bug-report --progress

Change-Id: If9094bbe0c29e8180f1b35d2b4ac95343a1bd0eb
2018-11-08 08:25:32 -08:00