Commit graph

3344 commits

Author SHA1 Message Date
Yifan Hong
289132e355 Merge "update_engine: allow to r/w super partition metadata" 2018-09-28 23:03:47 +00:00
Treehugger Robot
21eed51185 Merge "Block access to xt_qtaguid proc files" 2018-09-28 18:35:47 +00:00
Chenbo Feng
16dbe82eaf Block access to xt_qtaguid proc files
In the next Android release, there will be devices that have no
xt_qtaguid module at all and framework and netd will decide which code
path it takes for trafficStats depending on the device setup. So all
apps and services should not depend on this device specific
implementation anymore and use public API for the data they need.

Bug: 114475331
Bug: 79938294
Test: QtaguidPermissionTest

Change-Id: I0d37b2df23782eefa2e8977c6cdbf9210db3e0d2
2018-09-28 01:33:02 +00:00
Wei Wang
da427a33c9 Allow traceur to call atrace HAL
Bug: 116783882
Bug: 111098596
Test: turn on/off system_tracing
Change-Id: I089851924bdb1a5cd71598a7014d17fedc87625a
2018-09-27 23:18:49 +00:00
Wei Wang
bc71a6109e Add atrace HAL 1.0 sepolicy
Bug: 111098596
Test: atrace/systrace

(cherry picked from commit 9ed5cf6e43)

Change-Id: I97772ff21754d03a0aea0d53b39e8da5312a17c0
2018-09-27 23:18:29 +00:00
Yifan Hong
37427dbce1 update_engine: allow to r/w super partition metadata
and (un)map on dev mapper.

Test: resize partitions during OTA
Bug: 110717529

Change-Id: Ia0b66a188232795cf7c649b48af985a583f3471d
2018-09-27 15:39:12 -07:00
Nick Kralevich
5e37271df8 Introduce system_file_type
system_file_type is a new attribute used to identify files which exist
on the /system partition. It's useful for allow rules in init, which are
based off of a blacklist of writable files. Additionally, it's useful
for constructing neverallow rules to prevent regressions.

Additionally, add commented out tests which enforce that all files on
the /system partition have the system_file_type attribute. These tests
will be uncommented in a future change after all the device-specific
policies are cleaned up.

Test: Device boots and no obvious problems.
Change-Id: Id9bae6625f042594c8eba74ca712abb09702c1e5
2018-09-27 12:52:09 -07:00
Nick Kralevich
ff1c765ff2 Label /system/usr/share/zoneinfo differently
/system/usr/share/zoneinfo is currently labeled zoneinfo_data_file,
a label shared with /data/misc/zoneinfo. However, each of these
directory locations has different security characteristics. In
particular, the files in /system/usr/share/zoneinfo must never be
writable, whereas /data/misc/zoneinfo may be written to by system_server.
Reusing the same label hides these different security characteristics.

Create a separate label for /system/usr/share/zoneinfo.

Test: Device boots and no obvious problems.
Change-Id: I8cf16ff038b06b38f77388e546d9b7a6865f7879
2018-09-27 10:18:40 -07:00
Nick Kralevich
dbddbe42d2 system_linker_exec: Remove exec_type
system/sepolicy/public/attributes defines exec_type as:

  # All types used for domain entry points.
  attribute exec_type;

The linker is not a standalone executable, but rather, used by other
executables to resolve shared libraries. It isn't, and must never be, an
allowed entrypoint for a domain.

Remove the exec_type attribute from system_linker_exec.

Test: Device compiles and boots, no obvious problems running the system.
Change-Id: I8f2f608bc1a642193524396f46b22933faac5468
2018-09-26 12:22:59 -07:00
Fan Xu
26fa914cb2 Update SELinux Policy for bufferhubd
Create a new service type buffer_hub_binder_service for
BufferHubBinderService and allow bufferhubd to publish the service.

Add the service to 26.0, 27.0 and 28.0 compat ignore files since the
service is not available in past versions.

Fixes: 116022258
Test: build passed

Change-Id: I5a21f00329ed474433d96c8d1ce32377f20cada3
2018-09-24 12:29:43 -07:00
Jeff Vander Stoep
0b67bb88e5 Further lock down app data
Assert that only apps and installd may open private app files.

Remove "open" permission for mediaserver/vold and remove their
neverallow exemption.

Test: verify no related audit messages in the logs.
Test: build
Fixes: 80300620
Fixes: 80418809
Bug: 80190017
Change-Id: If0c1862a273af1fedd8898f334c9b0aa6b9be728
2018-09-22 22:38:42 -07:00
Kevin Chyn
7087bf1256 Merge "Rename biometric_prompt_service to biometric_service" 2018-09-22 03:47:00 +00:00
Tri Vo
6816044271 Merge "More granular vendor access to /system files." 2018-09-22 01:30:25 +00:00
Kevin Chyn
75ded482df Rename biometric_prompt_service to biometric_service
Bug: 111461540
Bug: 112570477

Test: builds
Change-Id: Icc68720ebe931c2d917703b2d34aa0f4eec3f549
Merged-In: Icc68720ebe931c2d917703b2d34aa0f4eec3f549
2018-09-20 23:09:54 -07:00
Tri Vo
b4ef6e7333 Merge "Make dalvik.vm.boot-dex2oat-threads vendor-init-settable." 2018-09-21 00:23:46 +00:00
Tri Vo
260a275836 Make dalvik.vm.boot-dex2oat-threads vendor-init-settable.
Bug: 115741899
Test: m selinux_policy
Change-Id: I5d80a1d9bd5500a82ebf282fb02f0db3a0b0a4c1
2018-09-20 11:05:12 -07:00
Tianjie Xu
26605f4b20 Merge "Gives recovery-persist access to /cache/recovery" 2018-09-20 17:39:36 +00:00
Yifan Hong
1cef6a94eb health.filesystem HAL renamed to health.storage
...to reflect that the HAL operates on storage devices,
not filesystem.

Bug: 111655771
Test: compiles
Change-Id: Ibb0572cb1878359e5944aa6711331f0c7993ba6e
Merged-In: Ibb0572cb1878359e5944aa6711331f0c7993ba6e
2018-09-20 04:12:45 +00:00
Tri Vo
5c1fe61eaa More granular vendor access to /system files.
This change limits global access to /system files down to:
/system/bin/linker*
/system/lib[64]/*
/system/etc/ld.config*
/system/etc/seccomp_policy/*
/system/etc/security/cacerts/*
/system/usr/share/zoneinfo/*

Bug: 111243627
Test: boot device, browse internet without denials to system_* types.
Test: VtsHalDrmV1_{1, 0}TargetTest without denials
Change-Id: I69894b29733979c2bc944ac80229e84de5d519f4
2018-09-20 03:07:50 +00:00
Benjamin Gordon
342362ae3e sepolicy: grant dac_read_search to domains with dac_override
kernel commit 2a4c22426955d4fc04069811997b7390c0fb858e (fs: switch order
of CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH checks) swapped the order of
dac_override and dac_read_search checks.  Domains that have dac_override
will now generate spurious denials for dac_read_search unless they also
have that permission.  Since dac_override is a strict superset of
dac_read_search, grant dac_read_search to all domains that already have
dac_override to get rid of the denials.

Bug: 114280985
Bug: crbug.com/877588
Test: Booted on a device running 4.14.
Change-Id: I5c1c136b775cceeb7f170e139e8d4279e73267a4
2018-09-19 15:54:37 -06:00
Tri Vo
ca4217e211 system_writes_mnt_vendor_violators for device launched before P.
In cases when a device upgrades to system-as-root from O to P, it needs a mount
point for an already existing partition that is accessed by both system and
vendor.

Devices launching with P must not have /mnt/vendor accessible to system.

Bug: 78598545
Test: m selinx_policy
Change-Id: Ia7bcde44e2b8657a7ad9e0d9bae7a7259f40936f
2018-09-17 19:26:12 -07:00
Nick Kralevich
095fbea563 Strengthen ptrace neverallow rules
Add additional compile time constraints on the ability to ptrace various
sensitive domains.

llkd: remove some domains which llkd should never ptrace, even on
debuggable builds, such as kernel threads and init.

crash_dump neverallows: Remove the ptrace neverallow checks because
it duplicates other neverallow assertions spread throughout the policy.

Test: policy compiles and device boots
Change-Id: Ia4240d1ce7143b983bb048e046bb4729d0af5a6e
2018-09-14 18:32:20 +00:00
Tianjie Xu
8b3f4c5b6a Gives recovery-persist access to /cache/recovery
Recovery-persist now parses the file /cache/recovery/last_install; and
unlinks it after reporting metrics. Sets up the permission accordingly;
also grants access to /cache if it's a symlink (useful for a/b devices.)

Denials:
recovery-persis: type=1400 audit(0.0:7): avc: denied { write } for name="recovery"
dev="sda35" ino=5275650 scontext=u:r:recovery_persist:s0
tcontext=u:object_r:cache_recovery_file:s0 tclass=dir permissive=0
recovery-persis: type=1400 audit(0.0:7): avc: denied { search } for name="recovery"
dev="sda35" ino=5275650 scontext=u:r:recovery_persist:s0
tcontext=u:object_r:cache_recovery_file:s0 tclass=dir permissive=0
recovery-persis: type=1400 audit(0.0:8): avc: denied { search } for name="recovery"
dev="sda35" ino=5275650 scontext=u:r:recovery_persist:s0
tcontext=u:object_r:cache_recovery_file:s0 tclass=dir permissive=0
recovery-persis: type=1400 audit(0.0:8): avc: denied { read } for name="cache"
dev="dm-0" ino=2991 scontext=u:r:recovery_persist:s0
tcontext=u:object_r:cache_file:s0 tclass=lnk_file permissive=0

Bug: 114278989
Test: checks the metrics report on devices with /cache
Change-Id: Iacb5606710e26922a9fbb2d2abacf8333d6df084
2018-09-13 22:44:00 +00:00
Nick Kralevich
702fd0afac crash_dump: remove /system/bin/logcat execute permissions
Currently, crash_dump has the following line:

  read_logd(crash_dump)

which is a macro defined as:

  #####################################
  # read_logd(domain)
  # Ability to run logcat and read from android
  # log daemon via sockets
  define(`read_logd', `
  allow $1 logcat_exec:file rx_file_perms;
  unix_socket_connect($1, logdr, logd)
  ')

which grants both the ability to talk directly to a logd socket, as well
as the ability to execute the /system/bin/logcat command line tool.

This is unneeded (and problematic) for crash_dump. Crash_dump uses
standard, vndk approved libraries to talk directly to logd. It never
exec()s the (non-vndk approved) logcat command.

As crash_dump is a vndk approved component and executed by vendor code,
allowing this transitively makes /system/bin/logcat a vndk component
too, which we want to avoid.

Instead of using the read_logd() macro, just directly add the
unix_socket_connect() call. This allows talking directly to logd, but
blocks the use of the (unneeded) /system/bin/logcat executable.

Test: crasher binary still works when executed from adb shell
Change-Id: I1fe9d0f5f0234c96454a0d91338fa2656f083345
2018-09-13 14:26:14 -07:00
Treehugger Robot
58de4843b6 Merge "Allow stats_companion to register thermal throttling event listener." 2018-09-13 21:11:43 +00:00
Hridya Valsaraju
073efc34e7 Allow fastbootd to wipe metadata.
Metadata needs to be erased as part of fastboot flashall -w.

Test: fastboot erase metadata
Bug: 113648914
Change-Id: I38a0debd9face16cad9d9a13a48549f3f58652fa
2018-09-13 17:55:28 +00:00
Yangster
f8c2c14a07 Allow stats_companion to register thermal throttling event listener.
Test: manual test

BUG: b/112432890
Change-Id: If703cd25a2c0864ffd49bfdc83821fae291974b5
2018-09-13 09:18:33 -07:00
Treehugger Robot
7826a7879c Merge "add links to docs explaining motivations behind neverallow assertions." 2018-09-13 02:13:24 +00:00
Treehugger Robot
9ec48cef5b Merge "Link to documentation for different block device types" 2018-09-13 01:50:15 +00:00
Nick Kralevich
6cf9160e82 add links to docs explaining motivations behind neverallow assertions.
Test: comments only. Policy compiles.
Change-Id: Ic51533d37fff6c553950a122f33a48e3c119c67c
2018-09-12 15:53:48 -07:00
Nick Kralevich
4b26c91ae6 Link to documentation for different block device types
The number of block devices used in an Android device is too damn high
(insert meme here). Let's at least add some links to documentation to
help describe the partition layout expected on a typical Android device.

This builds on top of the work in making the bootloader information
accessible (b/28905584).

Test: only adding comments. Policy compiles.
Change-Id: I8976b855e46255f7e18fa2b807ba83e0db92a82d
2018-09-12 13:58:53 -07:00
Chong Zhang
8248d9b262 add a property to allow thumbnailer to use hw codecs
bug: 113609172
Change-Id: Ifff91630c3622661139ff27f25932258802cb082
2018-09-12 10:13:56 -07:00
Martijn Coenen
b115341dff Merge "Allow init to use binder." 2018-09-12 08:39:50 +00:00
Treehugger Robot
cb09ff080d Merge "Allow shared_relro to access PackageManager." 2018-09-11 23:09:56 +00:00
Tao Bao
703acc6acd Whitelist minui properties to be overridden by /vendor/default.prop.
These values will be read by platform module (/sbin/charger), and need
to be configurable by vendor init.

Bug: 113567255
Test: Build along with other CLs in the topic (for Makefile and
      libminui changes). Boot into charger mode.
Test: Boot into recovery. Run graphics test.
Change-Id: I5b272f345e2a5a255c2f660c59c1da3245aa1e03
2018-09-11 21:12:20 +00:00
Torne (Richard Coles)
0f326f3c47 Allow shared_relro to access PackageManager.
Allow the shared_relro creation process to make calls to PackageManager,
so that it can create a classloader corresponding to the current WebView
implementation. This avoids needing to pass an absolute path to the
native library to the process, which required that the calling code
duplicate existing logic in the framework to find the library and
resulted in bugs and inconsistencies.

Bug: 110790153
Test: WebView-related CTS and GTS tests
Change-Id: I9902bb0400e2a800021dac06278151c8541d458f
2018-09-11 16:26:56 -04:00
Treehugger Robot
dc60253988 Merge "Ensure taking a bugreport generates no denials." 2018-09-11 16:12:21 +00:00
Martijn Coenen
a720d3d00a Allow init to use binder.
But in a very restricted form:
1) Nobody can initiate calls into init
2) Nobody can transfer binder objects into init, except servicemanager

Bug: 112684055
Test: device boots
Change-Id: Icfb218f2871e234284c74e096eccd7a2e786cf94
2018-09-11 07:28:59 +00:00
Treehugger Robot
7706f51fd3 Merge "Recovery does not need permission to start adbd anymore" 2018-09-11 01:49:57 +00:00
Joel Galenson
e9ee9d86d0 Ensure taking a bugreport generates no denials.
Allow dumpstate to get information about sockets and dontaudit
accessing vendor files when running df.

Bug: 112440280
Test: cts-tradefed run cts -m CtsSecurityHostTestCases -t android.security.cts.SELinuxHostTest#testNoBugreportDenials
Change-Id: Ide3cb2f3ce3f079bf30b3bd46810f9b55e105b2b
2018-09-10 15:48:34 -07:00
Tri Vo
34e98082ff Merge "ro.crypto.{allow_encrypt_override filenames_mode} vendor-init-settable." 2018-09-09 20:37:09 +00:00
Tri Vo
fe72cb70d7 ro.crypto.{allow_encrypt_override filenames_mode} vendor-init-settable.
Bug: 114017832
Test: m selinux_policy
Change-Id: I1dcb09c76b3e49888d278a154d79add6c6a6c977
2018-09-08 14:42:51 -07:00
Hridya Valsaraju
187d6e2280 Recovery does not need permission to start adbd anymore
adbd is started by an init trigger now when sys.usb.config is set
to adb.

Test: adb sideload works in user/userdebug builds
Bug: 113563995
Change-Id: I23db4074cd49cf0ba6c4eb27510e3a5caad5681b
2018-09-07 14:57:36 -07:00
Treehugger Robot
8d7d5b42b5 Merge "Fastbootd does not require read access to system and boot partitions" 2018-09-07 17:04:38 +00:00
Marcin Oczeretko
fb947d0c36 Merge "Add looper_stats_service to SE policy." 2018-09-07 09:51:33 +00:00
Hridya Valsaraju
e9fcce5642 Fastbootd does not require read access to system and boot partitions
Bug: 78793464
Test: fastboot flashall

Change-Id: I5b65b818dc43a01f90a38202e3a1b810fef70ca8
2018-09-07 00:09:34 +00:00
Treehugger Robot
bedc4f170c Merge "tombstoned: clean up TODO on anr writes" 2018-09-06 22:45:45 +00:00
Treehugger Robot
ac45700478 Merge "dumpstate: remove JIT and /data execute" 2018-09-06 22:41:19 +00:00
Treehugger Robot
36c7f741c1 Merge "Allow fastbootd to wipe userdata." 2018-09-06 21:12:07 +00:00
Marcin Oczeretko
56ab6be0d4 Add looper_stats_service to SE policy.
Test: Built and flashed an image.
Bug: 113651685
Change-Id: Ide239432ea8a5701d91c00edd06ad3e52560a3f7
2018-09-06 21:07:13 +00:00