Commit Graph

16904 Commits

Author SHA1 Message Date
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
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
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
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
Treehugger Robot
5faae3ae87 Merge "apexd_prop is defined for PRODUCT_COMPATIBLE_PROPERTY = false case" 2018-11-08 16:16:34 +00:00
Florian Mayer
f270aea66a Allow adbd to read perfetto_traces_data_file.
This allows to use adb pull on Perfetto traces on user.

Bug: 118747482

Change-Id: Ie4deed90597b412ccb0e9e6512ffed2acead82d8
2018-11-08 16:13:55 +00:00
Martijn Coenen
6a62606115 Merge changes Ie0396d59,I75b2bade
* changes:
  Allow apexd to configure /sys/block/dm-
  Allow the kernel to access apexd file descriptors.
2018-11-08 15:28:53 +00:00
Martijn Coenen
341476d455 Allow apexd to configure /sys/block/dm-
To configure readahead for APEX dm-verity devices.

Bug: 117823094
Test: apexd can change readahead
Change-Id: Ie0396d59ef758ad55f499f65957697d26a48aae9
2018-11-08 13:58:41 +01:00
Martijn Coenen
ac2b2d44b3 Allow the kernel to access apexd file descriptors.
In earlier kernel versions (<4.0), the loopback driver issues
requests from a kernel thread. Therefore, the kernel needs access
to APEX file descriptors and data files (which are loopback
mounted).

Bug: 119220815
Test: mounting works on sailfish
Change-Id: I75b2bade41c64cf6fa6040d9c2f5489a206e04c6
2018-11-08 11:22:48 +01:00
Jiyong Park
b14c1a9674 apexd_prop is defined for PRODUCT_COMPATIBLE_PROPERTY = false case
apexd_prop is also defined in private/propery_contexts in order to make
the type to exist even when PRODUCT_COMPATIBLE_PROPERTY is false (i.e.,
Pixel 1).

Bug: 119220815
Test: m plat_property_contexts for sailfish
the built plat_property_contexts has apexd_prop defined

Change-Id: I9ef71410533c1f64fc6a3112cfcb199d23aaf3db
2018-11-08 11:29:01 +09:00
Mustafa Yigit Bilgen
1cffee68b2 Use LOCAL_ADDITIONAL_M4DEFS for file_contexts
Pass LOCAL_ADDITIONAL_M4DEFS to m4 when building vendor_file_contexts
and odm_file_contexts. The build command attempts to use
PRIVATE_ADDITIONAL_M4DEFS - but this is not set in the target-specific
variables.

This allows using custom M4 macros when building non-platform
file_contexts.

Change-Id: I5fa8d9ec91f1a97bee1dd735ba85af93eef91252
2018-11-07 18:03:31 -08:00
Kevin Chyn
52261e78c0 Add placeholder sepolicy for iris and face
See aosp/660242 and aosp/608396

Fixes: 116530289

Test: builds
Change-Id: I220ece0d6751839fe764ff91fd7bd20c50104f8f
2018-11-07 14:11:56 -08:00
Fan Xu
1e58323f94 Allow bufferhub service to allocate buffer
Test: build passed.
Bug: 118614333
Change-Id: I3b33d73a2cc7e78119de8b0913b4e2d0ac4a3235
2018-11-07 13:57:55 -08:00
Fan Xu
05668e4071 Merge "Remove buffer_hub_service compat mapping" 2018-11-07 18:27:05 +00:00
Yabin Cui
ffa2b61330 Add runas_app domain to allow running app data file via run-as.
Calling execve() on files in an app's home directory isn't allowed
for targetApi >=29. But this is needed by simpleperf to profile
a debuggable app via run-as.
So workaround it by adding runas_app domain, which allows running
app data file. And add a rule in seapp_contexts to use runas_app
domain for setcontext requests from run-as.

Bug: 118737210
Test: boot marlin and run CtsSimpleperfTestCases.
Change-Id: I5c3b54c95337d6d8192861757b858708174ebfd5
2018-11-07 18:11:40 +00:00
Yabin Cui
5dc2c8c740 Revert "Revert "Enforce execve() restrictions for API > 28""
This reverts commit 15d1a12f7f.

Bug: 118737210
Bug: 112357170
Test: boot marlin
Change-Id: Idcfab04b48f843eead4efa9f58a1337c6685c6ca
2018-11-07 18:07:18 +00:00
Tri Vo
2bb0085dbd Merge "Don't label /dev/{ akm8973.* accelerometer } from system sepolicy" 2018-11-06 22:43:49 +00:00
Tri Vo
fe39ed33dc Don't label /dev/{ akm8973.* accelerometer } from system sepolicy
These /dev nodes are device-specific and should be labeled from device
policy. Moreover, pixels don't have these /dev nodes.

Bug: 110962171
Test: boot pixel 3
Change-Id: I37ca9a956130eb4763c75f5e8a0decbd4f7b97a7
2018-11-06 10:20:50 -08:00
Fan Xu
2d74a45f76 Remove buffer_hub_service compat mapping
As b/116344577 is fixed, we no longer need the compatbility mapping any
more.

Test: build passed. Boot succeeded.
Change-Id: I0d7f02c59853d34bdabaad6841d87e9ca1ee25d7
2018-11-06 10:11:47 -08:00