Commit graph

10587 commits

Author SHA1 Message Date
TreeHugger Robot
b36c9bcd05 Merge "Add keystore_key:attest_unique_id to priv_app." into oc-dev 2017-04-13 14:38:15 +00:00
Martijn Coenen
f6daa78a82 Merge "Add hwservice_contexts and support for querying it." into oc-dev 2017-04-13 03:34:48 +00:00
Martijn Coenen
3ea47b9249 Add hwservice_contexts and support for querying it.
hwservicemanager can check hwservice_contexts files
both from the framework and vendor partitions.

Initially, have a wildcard '*' in hwservice_contexts
that maps to a label that can be added/found from
domain. This needs to be removed when the proper policy
is in place.

Also, grant su/shell access to hwservicemanager list
operations, so tools like 'lshal' continue to work.

Bug: 34454312
Test: Marlin boots
Change-Id: I3a02d97a82458692b528d85c1b8e78b6f82ea1bc
2017-04-12 18:07:12 -07:00
Dan Cashman
4d24a77551 Fix build part 2. Always create platform_mapping_file.
commit 552fb53712 fixed an undefined
module error by removing the module when not defined (on non-treble
devices), but the sepolicy build on non-treble devices was changed
to rely on the split treble files, even though the split is not used.
Change this so that the file is always present, to allow policy
compilation.

Test: policy fully builds.
Change-Id: Ia0934c739336cea54228bbff8d6644aa3ae501e5
2017-04-12 14:28:34 -07:00
Dan Cashman
552fb53712 Fix build: encase $(platform_mapping_file) module in treble block.
Specifying an empty module causes a build error, so make sure that
if there is no $(platform_mapping_file) the MODULE is not included.

Test: Makefiles parsed without error.
Change-Id: Ie99e6534c388a3d42bf90cdfef5ee64d5c640fa0
2017-04-12 14:06:30 -07:00
Daniel Cashman
7aad3b3b92 Merge "Remove BOARD_SEPOLICY_VERS_DIR build variable." into oc-dev 2017-04-12 20:40:52 +00:00
Daniel Cashman
11620416b2 Merge "Change recovery to static platform-only compilation." into oc-dev 2017-04-12 20:39:46 +00:00
Daniel Cashman
d090db9de8 Merge "Change mapping file name to reflect its platform version." into oc-dev 2017-04-12 20:38:18 +00:00
Phil Burk
29ec5d42d9 Merge "service_contexts: add aaudio service" into oc-dev 2017-04-12 20:04:06 +00:00
TreeHugger Robot
17d2594235 Merge "system_server: Report dalvikcache_data_file execute violations." into oc-dev 2017-04-12 19:40:31 +00:00
Sandeep Patil
c01a7e193f Merge "sepolicy: make exec_types in /vendor a subset of vendor_file_type" into oc-dev 2017-04-12 19:25:12 +00:00
Phil Burk
16a2cfe302 service_contexts: add aaudio service
Test: test_aaudio.cpp
Bug: 33398120
Change-Id: I0712f60c898136154d729ceb1103ee021cc6ab82
Signed-off-by: Phil Burk <philburk@google.com>
(cherry picked from commit 8b9d93f245)
2017-04-12 18:24:22 +00:00
Dan Cashman
6bf50e5c14 Remove BOARD_SEPOLICY_VERS_DIR build variable.
The original purpose of BOARD_SEPOLICY_VERS_DIR was to allow the
specification of an alternate platform public policy, primarily for
testing purposes.  This should not be a part of the released platform,
since the only public policy and corresponding mapping file construction
should be based on the current public platform policy, with compatibility
with vendor policy targeting previous versions provided by static mapping
files.  Its continued presence muddles the generation of mapping files by
potentially introducing a situation in which an incorrect mapping file is
generated.  Remove it.

Bug: 36783775
Test: Device boots with compiled SELinux policy (SHA256s don't match for
precompiled policy).

Change-Id: I9e2100a7d709c9c0949f4e556229623961291a32
2017-04-12 11:12:17 -07:00
Dan Cashman
c8d4535cc2 Change recovery to static platform-only compilation.
Recovery is not meant to be versioned in the treble model, but rather
provided as part of the platform/framework component and self-sufficient.
Simplify its compilation by removing the attribute versioning steps, but
maintain device-specific policy, which is currently required for full
functionality.

Bug: 37240781
Bug: 36783775
Test: recovery boots and is able to select commands.  Also tried:
reboot system, boot to bootloader, factory reset, sideload, view logs,
run graphics test, and power off.

Change-Id: I637819844d9a8ea5b315404f4abd03e8f923303a
2017-04-12 11:01:00 -07:00
TreeHugger Robot
35d2a46ad3 Merge "sepolicy: Allow postinstall_dexopt /vendor/app access" into oc-dev 2017-04-12 17:49:16 +00:00
Dan Cashman
4f9a648e90 Change mapping file name to reflect its platform version.
As the platform progresses in the split SELinux world, the platform
will need to maintain mapping files back to previous platform versions
to maintain backwards compatibility with vendor images which have SELinux
policy written based on the older versions.  This requires shipping multiple
mapping files with the system image so that the right one can be selected.
Change the name and location of the mapping file to reflect this.  Also add
a file to the vendor partition indicating which version is being targeted that
the platform can use to determine which mapping file to choose.

Bug: 36783775
Test: Force compilation of sepolicy on-device with mapping file changed
to new location and name, using the value reported on /vendor.

Change-Id: I93ab3e52c2c80c493719dc3825bc731867ea76d4
2017-04-12 09:16:51 -07:00
Jorge Lucangeli Obes
62a1b2366b system_server: Report dalvikcache_data_file execute violations.
With build/core eaa9d88cf, system_server should not be loading code
from /data. Add an auditallow rule to report violations.

Bug: 37214733
Test: Boot marlin, no SELinux audit lines for system_server.
Change-Id: I2e25eb144503274025bd4fc9bb519555851f6521
(cherry picked from commit 665128fac3)
2017-04-12 10:50:40 -04:00
Shawn Willden
a0c7f01299 Add keystore_key:attest_unique_id to priv_app.
Only privileged apps are supposed to be able to get unique IDs from
attestation.

Test: CTS test verifies the negative condition, manual the positive
Bug: 34671471
Change-Id: I9ab3f71b1e11ed1d7866ff933feece73152d2578
2017-04-12 06:39:14 -06:00
TreeHugger Robot
976fb16bc1 Merge "Add sepolicy for tv.cec" into oc-dev 2017-04-12 08:13:40 +00:00
Andreas Gampe
e843044cc1 sepolicy: Allow postinstall_dexopt /vendor/app access
Follow-up to commit 1b5f81a2d2.

Bug: 36681210
Bug: 37158297
Test: lunch sailfish-userdebug && m
Test: Manually run OTA
Change-Id: Ifb4808c9255842a51a660c07ffd924cef52024c5
2017-04-11 20:39:47 -07:00
Sandeep Patil
2ee66e7d14 sepolicy: make exec_types in /vendor a subset of vendor_file_type
We install all default hal implementations in /vendor/bin/hw along with
a few domains that are defined in vendor policy and installed in
/vendor. These files MUST be a subset of the global 'vendor_file_type'
which is used to address *all files installed in /vendor* throughout the
policy.

Bug: 36463595
Test: Boot sailfish without any new denials

Change-Id: I3d26778f9a26f9095f49d8ecc12f2ec9d2f4cb41
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-04-11 17:20:36 +00:00
TreeHugger Robot
c051300e5e Merge "Add PLATFORM_SEPOLICY_VERSION." into oc-dev 2017-04-11 14:16:26 +00:00
Jaesoo Lee
8b87947e24 Merge changes from topic 'modprobe_fix' into oc-dev
* changes:
  allow to load kernel modules from vendor partition
  SELinux changes for Treble Loadable Kernel Module
2017-04-11 05:39:13 +00:00
TreeHugger Robot
4966f2b578 Merge "Revert "Remove unnecessary adbd permissions."" into oc-dev 2017-04-11 04:36:35 +00:00
Jaesoo Lee
a6ac1147c3 allow to load kernel modules from vendor partition
The kernel  modules under /vendor partition has been relabeled to vendor_file.
This CL allows for the modprobe to load modules labeled vendor_file.

Kernel modules are loaded in init.rc with following commands:
    exec u:r:modprobe:s0 -- /system/bin/modprobe -d /vendor/lib/modules MODULE

Bug: 35653245
Test: tested on sailfish
Change-Id: I2132ca4de01c5c60476dad8496e98266de5a1bb7
2017-04-11 12:45:12 +09:00
TreeHugger Robot
fa35da096a Merge "Allow zygote to access dir/file under /vendor/overlay" into oc-dev 2017-04-11 00:56:21 +00:00
Steven Moreland
26ce838838 Revert "Remove unnecessary adbd permissions."
This reverts commit 97848f0516.

Reason for revert: b/37218817

Change-Id: I3280be8873d60d66852b4f01f4af4eeaee6b5502
2017-04-11 00:07:04 +00:00
Alex Klyubin
2efc00cc98 Merge "Grant audioserver access to /system/lib64/hw" into oc-dev 2017-04-10 22:17:32 +00:00
Alex Klyubin
93b97da89f Merge "Apostrophe not permitted in macro parameters" into oc-dev 2017-04-10 19:34:25 +00:00
Tianjie Xu
c2239df3b3 Merge "Allow recovery to read thermal info" into oc-dev 2017-04-10 19:11:55 +00:00
Alex Klyubin
2d704464b7 Grant audioserver access to /system/lib64/hw
audioserver uses an always-passthrough Allocator HAL (ashmem / mapper)
whose .so is loaded from /system/lib64/hw.

Test: Modify hal_client_domain macro to not associate client of X HAL
      with hal_x attribute. Play Google Play Movies move -- no denials
      and AV playback works.
Bug: 37160141

Change-Id: I7b88b222aba5361a6c7f0f6bb89705503255a4b1
2017-04-10 11:40:53 -07:00
Alex Klyubin
d84f20b200 Apostrophe not permitted in macro parameters
Test: mmm system/sepolicy -- no warnings
Bug: 3716915
Change-Id: I76886c2d09a70cbe6dc707dd0599217407bb63f7
2017-04-10 11:39:27 -07:00
TreeHugger Robot
b28ef52688 Merge "sepolicy: Fix renderscript driver lookup" into oc-dev 2017-04-10 17:45:54 +00:00
Dan Cashman
6f14f6b7d9 Add PLATFORM_SEPOLICY_VERSION.
Create PLATFORM_SEPOLICY_VERSION, which is a version string to represent
the platform sepolicy of the form "NN.m" where "NN" mirrors the
PLATFORM_SDK_VERSION and "m" is a policy-based minor version that is
incremented with every policy change that requires a new backward-compatible
mapping file to be added to allow for future-proofing vendor policy against
future platform policy.

Bug: 36783775
Test: Device boots when sha256 doesn't match and compilation is forced.
Change-Id: I4edb29824f2050a5a6e1bc078c100cf42e45c303
2017-04-10 09:59:19 -07:00
Sandeep Patil
3af3a13b31 sepolicy: Fix renderscript driver lookup
Renderscript drivers are loaded from /vendor/lib64 by following the
/system/vendor symlink. This change fixes a couple of things.
- Allows all domains access to follow the symlink
- Restores app domain permissions for /vendor for non-treble devices
- Allow app domains to peek into /vendor/lib64, but NOT grant 'execute'
  permissions for everything. Since RS drivers can be loaded into any
  process, their vendor implementation and dependencies have been
  marked as 'same process HALs' already.

Bug: 37169158
Test: Tested on sailfish (Treble) & Angler (non-treble)
      ./cts-tradefed run cts -m CtsRenderscriptTestCases \
      --skip-device-info --skip-preconditions --skip-connectivity-check \
      --abi arm64-v8a
      Result: Tests Passed: 743 Tests Failed: 0

Change-Id: I36f5523381428629126fc196f615063fc7a50b8e
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-04-10 08:45:20 -07:00
Howard Chen
f69311300f SELinux changes for Treble Loadable Kernel Module
This change extends the recovery mode modprobe sepolicy
to support loadable kernel module in normal mode by using
statement below in init.rc:

exec u:r:modprobe:s0 -- /system/bin/modprobe \
    -d /vendor/lib/modules mod

Bug: b/35653245
Test: sailfish  with local built kernel and LKM enabled
Change-Id: I827e2ce387c899db3e0e179da92e79c75d61f5ae
(cherry picked from commit b638d9493f)
2017-04-10 20:15:51 +09:00
Jiyong Park
ba23c8fa96 Rename vndk-stable to vndk-sp (SP=Same-process)
The concept of VNDK-stable set is gone because they no longer need to be
stable across several Android releases. Instead, they are just small set
of system libraries (other than Low-Level NDK) that can be used by
same-process HALs. They need to be stable only during an Android release
as other VNDK libraries. However, since they are eligible for double
loading, we still need to distinguish those libs from other VNDK
libraries. So we give them a name vndk-sp, which means VNDK designed for
same-process HALs.

Bug: 37139956
Test: booting successful with vndk-sp libs in /vendor/lib(64)?/vndk-sp
Change-Id: I892c4514deb3c6c8006e3659bed1ad3363420732
2017-04-10 14:30:48 +09:00
Jaekyun Seok
e360791d37 Allow zygote to access dir/file under /vendor/overlay
http://ag/2070347 doesn't allow zygote to read vendor_overlay_file:file
anymore.
But zygote isn't transitioned into idmap when executing idmap_exec. So
we need to allow zygote to access dir/file under /vendor/overlay to
enable idmap_exec run by zygote to read static RRO.

Test: building succeeded and tested a static RRO on sailfish device.
Bug: 37173452
Change-Id: Iec8a6b31d24c225f7819eeb885305f78da73b8e0
2017-04-08 17:36:22 +09:00
Andreas Gampe
d0e9cb0553 Sepolicy: Give otapreopt_slot read on A/B artifact links
Add read rights for du.

Bug: 30832951
Test: m
Change-Id: I1186ff995684844e9c6092b5ae65c19172fefbbe
2017-04-07 20:19:41 -07:00
TreeHugger Robot
8612307083 Merge "sepolicy_version: change current version to NN.m format" into oc-dev 2017-04-07 23:14:06 +00:00
Sandeep Patil
72126e1bea Merge "sepolicy: allow access to vndk-stable libs" into oc-dev 2017-04-07 22:03:08 +00:00
Sandeep Patil
42f95984b5 sepolicy_version: change current version to NN.m format
The sepolicy version takes SDK_INT.<minor> format. Make sure our
'current' policy version reflects the format and make it '100000.0'.
This ensures any vendor.img compiled with this will never work with
a production framework image either.

Make version_policy replace the '.' in version by '_' so secilc is
happy too.

This unblocks libvintf from giving out a runtme API to check vendor's
sepolicy version. The PLAT_PUBLIC_SEPOLICY_CURRENT_VERSION will
eventually be picked up from the build system.

Bug: 35217573
Test: Build and boot sailfish.
      Boot sailfish with sepolicy compilation on device.
Signed-off-by: Sandeep Patil <sspatil@google.com>

Change-Id: Ic8b6687c4e71227bf9090018999149cd9e11d63b
2017-04-07 14:18:48 -07:00
Alex Klyubin
df72094196 Merge "Preserve treble-only flag for CTS neverallows" into oc-dev 2017-04-07 20:09:22 +00:00
Alex Klyubin
446279a6b9 Preserve treble-only flag for CTS neverallows
CTS includes general_sepolicy.conf built from this project. CTS then
tests this file's neverallow rules against the policy of the device
under test. Prior to this commit, neverallow rules which must be
enforced only for Treble devices we not included into
general_sepolicy.conf. As a result, these rules were not enforced for
Treble devices.

This commit fixes the issue as follows. Because CTS includes only one
policy, the policy now contains also the rules which are only for
Treble devices. To enable CTS to distinguish rules needed for all
devices from rules needed only on Treble devices, the latter rules are
contained in sections delimited with BEGIN_TREBLE_ONLY and
END_TREBLE_ONLY comments.

This commit also removes the unnecessary sepolicy.general target. This
target is not used anywhere and is causing trouble because it is
verifying neverallows of the policy meant to be used by CTS. This
policy can no longer be verified with checkpolicy without
conditionally including or excluding Treble-only neverallows.

Test: mmm system/sepolicy
Test: Device boots -- no new denials
Bug: 37082262
Change-Id: I15172a7efd9374543ba521e17aead1bdda7451bf
2017-04-07 12:22:10 -07:00
TreeHugger Robot
b9bd670819 Merge "allow access to vendor_framework_file to dex2oat and appdomain" into oc-dev 2017-04-07 18:36:15 +00:00
Tianjie Xu
15bf1b524e Allow recovery to read thermal info
We want to track temperature metrics during an OTA update.

denial message:
denied  { search } for  pid=349 comm="recovery" name="thermal"
dev="sysfs" ino=18029 scontext=u:r:recovery:s0
tcontext=u:object_r:sysfs_thermal:s0 tclass=dir permissive=0

denied  { read } for  pid=326 comm="recovery" name="temp"
dev="sysfs" ino=18479 scontext=u:r:recovery:s0
tcontext=u:object_r:sysfs_thermal:s0 tclass=file permissive=0

Bug: 36920500
Bug: 32518487
Test: temperature logs on angler
Change-Id: Ib70c1c7b4e05f91a6360ff134a11c80537d6015e
(cherry picked from commit 3da2f21fbf)
2017-04-07 11:23:36 -07:00
Martijn Coenen
ee97662f17 Fix checkfc options order.
darwin's getopt() doesn't like putting arguments
in the wrong order.

Test: Mac/Linux builds
Change-Id: If632e9077c1b5714f91c5adaa04afb4963d9b0f5
2017-04-07 10:08:55 -07:00
Jaesoo Lee
5377be6563 allow access to vendor_framework_file to dex2oat and appdomain
We should give appdomain the access to the /vendor/framework directory
since the jar in the directory is not dexopt-ed.AFAIK, jars which are
not in the bootclasspath are not dexopt-ed by default.

Bug: b/37129319
Test: built and confirmed that embms.apk not crashed

Change-Id: Ic2b1eef472f2fba53e26403dde8ad9ede8105a03
2017-04-07 09:16:05 -07:00
TreeHugger Robot
f497d0b7f4 Merge changes from topic 'vnd-sepol' into oc-dev
* changes:
  Allow 'su' domain access to vndbinder.
  Modify checkfc to check (vnd|hw)service_manager_type.
2017-04-07 16:02:12 +00:00
Jiyong Park
a4768fa8b5 sepolicy: allow access to vndk-stable libs
Vndk-stable libs are system libs that are used by same process HALs.
Since same process HALs can be loaded to any process, so are vndk-stable
libs.

Bug: 37138502
Test: none, because the directory is currently empty and thus this is
no-op. sailfish builds and boots.

Change-Id: I67a2c8c2e4c3517aa30b4a97dc80dc2800e47b5a
2017-04-07 21:16:19 +09:00