Commit graph

2161 commits

Author SHA1 Message Date
Nick Kralevich
dde428a978 Merge "More recovery rules" 2014-06-04 19:54:49 +00:00
Nick Kralevich
3d2eb27ded Merge "Make racoon enforcing." 2014-06-04 19:53:41 +00:00
Nick Kralevich
b386f0be6e am 5eaa0afb: Merge "Allow system_server access to /data/media files passed via Binder."
* commit '5eaa0afbc7b6aae4c68273cf07ce6d60ebb409ea':
  Allow system_server access to /data/media files passed via Binder.
2014-06-04 18:26:42 +00:00
Stephen Smalley
e2efee3751 am d2622fda: Allow installd to stat asec files and /data/media files.
* commit 'd2622fda569d2a8decc0b4e013979a40a24a799d':
  Allow installd to stat asec files and /data/media files.
2014-06-04 18:26:42 +00:00
Nick Kralevich
03dbf07a47 More recovery rules
Better refine the rules surrounding the recovery SELinux
domain, and get rid of dmesg log spam.

Recovery is still in permissive_or_unconfined(), so no expected
change in behavior.

Change-Id: Ie5a86f8f5d7581547879c476ebcfdb8c0876263c
2014-06-04 11:09:15 -07:00
Nick Kralevich
5eaa0afbc7 Merge "Allow system_server access to /data/media files passed via Binder." 2014-06-04 18:07:00 +00:00
Stephen Smalley
d2622fda56 Allow installd to stat asec files and /data/media files.
Addresses denials such as:
avc: denied { getattr } for comm="installd" path="/data/app-asec/com.vectorunit.red-1.asec" dev="dm-0" ino=578229 scontext=u:r:installd:s0 tcontext=u:object_r:asec_image_file:s0 tclass=file

avc:  denied  { getattr } for  pid=262 comm="installd" path="/data/media/0/Android/data/com.google.android.apps.maps/cache/cache_vts_tran_base_GMM.m" dev="dm-0" ino=124930 scontext=u:r:installd:s0 tcontext=u:object_r:media_rw_data_file:s0 tclass=file

Change-Id: I406f1bea32736e2277adae1629a879fac0d714b6
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-06-04 13:56:22 -04:00
Stephen Smalley
2cc6d63d5d Allow system_server access to /data/media files passed via Binder.
Addresses denials such as:
 avc: denied { read } for comm="Binder_6" path="/data/media/0/zedge/ringtone/love_tone_2014-ringtone-1665292.mp3" dev="mmcblk0p28" ino=1534267 scontext=u:r:system_server:s0 tcontext=u:object_r:media_rw_data_file:s0 tclass=file
 avc: denied { getattr } for comm="Binder_9" path="/data/media/0/zedge/ringtone/love_tone_2014-ringtone-1665292.mp3" dev="mmcblk0p28" ino=1534267 scontext=u:r:system_server:s0 tcontext=u:object_r:media_rw_data_file:s0 tclass=file

Change-Id: I5e5744eecf2cbd4fc584db8584be4e9101bcb60c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-06-04 13:36:48 -04:00
Nick Kralevich
4e37402ba3 am 84ed890a: Merge adf_device into graphics_device
* commit '84ed890aebce5235018b846fac734b47833ee364':
  Merge adf_device into graphics_device
2014-06-04 13:57:59 +00:00
Nick Kralevich
84ed890aeb Merge adf_device into graphics_device
As of sepolicy commit a16a59e2c7
(https://android-review.googlesource.com/94580), adf_device
and graphics_device have the exact same security properties.

Merge them into one type to avoid a proliferation of SELinux
types.

Change-Id: Ib1a24f5d880798600e103b9e14934e41abb1ef95
2014-06-03 17:01:10 -07:00
Stephen Smalley
cb23ca92f3 Remove domain unlabeled access.
https://android-review.googlesource.com/#/c/95900/ added
allow rules for unlabeled access as needed to all confined
domains.  Therefore we can remove it from domain.  The only
other domain that truly needs unlabeled access is init, which
presently inherits it from unconfineddomain.

Also prevent rules that would permit any confined domain from
creating new unlabeled files on the system.

Change-Id: I31c6478b42fbf60e3b7893b9578b6ad50170def6
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-06-03 19:16:44 +00:00
Christopher Tate
519aab84e3 am 6f6c4255: Adjust rules around /data/app entities
* commit '6f6c425563f4faa4e1e12bf430c32d0b81a78f64':
  Adjust rules around /data/app entities
2014-06-03 18:36:12 +00:00
Christopher Tate
6f6c425563 Adjust rules around /data/app entities
This is to accomodate migration to (and ongoing support of) a
new installed-app file topology, in which APK files are placed
in /data/app/$PACKAGE-rev/, there is a canonical-path symlink
/data/app/$PACKAGE/ -> /data/app/$PACKAGE-rev/, and the native
libraries exist not under a top-level /data/app-lib/$PACKAGE-rev
hard directory, but rather under /data/app/$PACKAGE/lib (when
referenced by canonical path).

Change-Id: I4f60257f8923c64266d98aa247bffa912e204fb0
2014-06-03 18:16:06 +00:00
Nick Kralevich
78743ab5be am 86b05c47: Merge "Remove obsolete vdc rule."
* commit '86b05c47d4f92482f448a7cbaf4240ecce1118a8':
  Remove obsolete vdc rule.
2014-06-03 15:56:37 +00:00
Nick Kralevich
86b05c47d4 Merge "Remove obsolete vdc rule." 2014-06-03 15:39:06 +00:00
Nick Kralevich
06413106b1 am 6399f40f: Merge "add execmod to various app domains"
* commit '6399f40faa36adc6a1745d37dbf9cc567e3ae6c5':
  add execmod to various app domains
2014-06-03 13:33:10 +00:00
Nick Kralevich
6399f40faa Merge "add execmod to various app domains" 2014-06-03 13:13:21 +00:00
Nick Kralevich
24b5622528 Remove obsolete vdc rule.
As of system/core commit 225459a5da21e9397ca49b0d9af7d5fe3462706b,
adbd no longer talks to vold. Remove the obsolete rule.

Bug: 12504045
Change-Id: I0a4f621afd8e5f8ab83219e7b0ff096c992d365f
2014-06-02 21:11:23 -07:00
JP Abgrall
278959b97a am dda7fb89: am bd0262c9: Add ocontext for F2FS
* commit 'dda7fb89cb25c7d467782ea985b40ae630872efc':
  Add ocontext for F2FS
2014-06-02 23:29:47 +00:00
JP Abgrall
dda7fb89cb am bd0262c9: Add ocontext for F2FS
* commit 'bd0262c996ce96ab910a06f5973d9d5ad851acca':
  Add ocontext for F2FS
2014-06-02 23:26:55 +00:00
JP Abgrall
bd0262c996 Add ocontext for F2FS
Without this, the "seclabel" mount option is unavailable to F2FS.

Bug: 15388455
Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
2014-06-02 16:08:19 -07:00
Nick Kralevich
78706f9ef6 add execmod to various app domains
NDK r8c and below induced text relocations into every NDK
compiled shared library. (https://code.google.com/p/android/issues/detail?id=23203).
For compatibility, we need to support shared libraries with text relocations
in them.

Addresses the following error / denial:

  06-02 13:28:59.495  3634  3634 W linker  : libCore.so has text relocations. This is wasting memory and prevents security hardening. Please fix.
  <4>[   57.430677] type=1400 audit(1401740939.756:13): avc: denied { execmod } for pid=3634 comm=".playandlearnhd" path="/data/app-lib/com.adobe.air-2/libCore.so" dev="mmcblk0p28" ino=32745 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=file

Steps to reproduce:
1) Install Adobe AIR (https://play.google.com/store/apps/details?id=com.adobe.air)
2) Install PBS Parents Play & Learn (https://play.google.com/store/apps/details?id=air.org.pbskids.playandlearnhd)
3) Attempt to run Play & Learn app

Expected:
  App runs

Actual:
  App crashes with error above.

Bug: 15388851
Change-Id: I88bfd72b2abf2407803da0209d2313c8210c6663
2014-06-02 15:56:44 -07:00
Nick Kralevich
21cdb76d6c am e541f30c: am 3957ae73: Merge "recovery: enable permissive_or_unconfined"
* commit 'e541f30cd9a6838feb4babfc2776860ca05729a5':
  recovery: enable permissive_or_unconfined
2014-06-02 17:52:27 +00:00
Nick Kralevich
e541f30cd9 am 3957ae73: Merge "recovery: enable permissive_or_unconfined"
* commit '3957ae733f1066efa5d0ae2b03604c0b11549430':
  recovery: enable permissive_or_unconfined
2014-06-02 17:48:53 +00:00
Nick Kralevich
3957ae733f Merge "recovery: enable permissive_or_unconfined" 2014-06-02 17:44:31 +00:00
Daniel Cashman
969f53a97f am f094e58f: am 715023eb: Merge "Changed unconfined process policy to a whitelist."
* commit 'f094e58fa3b2dda7b41ca988602285688e17c7a7':
  Changed unconfined process policy to a whitelist.
2014-06-02 17:36:38 +00:00
Daniel Cashman
f094e58fa3 am 715023eb: Merge "Changed unconfined process policy to a whitelist."
* commit '715023eba196cb5dd226df89181c17d9e0c6936f':
  Changed unconfined process policy to a whitelist.
2014-06-02 17:31:04 +00:00
Daniel Cashman
715023eba1 Merge "Changed unconfined process policy to a whitelist." 2014-06-02 17:28:44 +00:00
Riley Spahn
52dcc94deb Changed unconfined process policy to a whitelist.
Rewrote the process policy in external/sepolicy/unconfined.te
from a blacklist to a whitelist to be more easily understood.
There were previously 11 disallowed permissions and now there are
19 allowed permissions.

Change-Id: Ida4dc881c5fedc56980324774f40e09a9b8a830a
2014-06-02 09:18:55 -07:00
Nick Kralevich
4203981e8b recovery: enable permissive_or_unconfined
Switch from using unconfined_domain() to permissive_or_unconfined().
For user builds, or builds with FORCE_PERMISSIVE_TO_UNCONFINED=true,
this is a no-op. For userdebug / eng builds, this will allow us to
collect denials from /proc/last_kmsg.

Change-Id: I41e1a206b2a3b0eee34539bfebfc5deee9e18a42
2014-05-31 08:10:30 -07:00
Robert Craig
ec87ecb991 am 8571ed16: am 8b7545bf: Build the selinux_version file.
* commit '8571ed162e85c507ea93b06c6816cdf99019625a':
  Build the selinux_version file.
2014-05-31 08:49:29 +00:00
Robert Craig
8571ed162e am 8b7545bf: Build the selinux_version file.
* commit '8b7545bf5745e1e0aba55b0334de40d2334728b1':
  Build the selinux_version file.
2014-05-31 04:56:21 +00:00
Robert Craig
8b7545bf57 Build the selinux_version file.
The selinux_version file is used to perform policy
versioning checks by libselinux and SELinuxMMAC. When
loading policy a check is first performed to determine
if the policy out in /data/security/current should be
used to override the base policy shipped with the device.
The selinux_version file is used to make that choice. The
contents of the file simply contains the BUILD_FINGERPRINT
that the policy was built against. A simple string comparison
is then performed by libselinux and SELinuxMMAC.

Change-Id: I69d9d071743cfd46bb247c98f94a193396f8ebbd
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2014-05-30 20:24:18 +00:00
Stephen Smalley
fb2648191c am 7ac88000: am 3235f61a: Restrict /data/security and setprop selinux.reload_policy access.
* commit '7ac880005144b7444fb92595c2acea0b54955989':
  Restrict /data/security and setprop selinux.reload_policy access.
2014-05-30 20:10:08 +00:00
Stephen Smalley
7ac8800051 am 3235f61a: Restrict /data/security and setprop selinux.reload_policy access.
* commit '3235f61aa859af1d1c3d060eb55cf1929bc6914f':
  Restrict /data/security and setprop selinux.reload_policy access.
2014-05-30 20:06:23 +00:00
Stephen Smalley
ffdcb2eab9 Make racoon enforcing.
Change-Id: Id585191e1077c3a2d0e0a6a51e0dd98c48ea0291
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 14:40:07 -04:00
Stephen Smalley
3235f61aa8 Restrict /data/security and setprop selinux.reload_policy access.
Remove /data/security and setprop selinux.reload_policy access
from unconfineddomain, and only add back what is needed to
init (system_server already gets the required allow rules via
the selinux_manage_policy macro).

init (via init.rc post-fs-data) originally creates /data/security
and may later restorecon it.  init also sets the property (also from
init.rc post-fs-data) to trigger a reload once /data is mounted.
The system_server (SELinuxPolicyInstallReceiver in particular) creates
subdirectories under /data/security for updates, writes files to these
subdirectories, creates the /data/security/current symlink to the update
directory, and sets the property to trigger a reload when an update bundle
is received.

Add neverallow rules to ensure that we do not allow undesired access
to security_file or security_prop.

This is only truly meaningful if the support for /data/security policies
is restored, but is harmless otherwise.

Also drop the persist.mmac property_contexts entry; it was never used in
AOSP, only in our tree (for middleware MAC) and is obsolete.

Change-Id: I5ad5e3b6fc7abaafd314d31723f37b708d8fcf89
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 18:30:11 +00:00
Stephen Smalley
c664083bad am ffbba62e: am e60723ab: Create a separate recovery policy.
* commit 'ffbba62eafb759573aad4bcdc77d56026697ea00':
  Create a separate recovery policy.
2014-05-30 18:27:02 +00:00
Stephen Smalley
ffbba62eaf am e60723ab: Create a separate recovery policy.
* commit 'e60723ab59f48626c6a700ba645bfe5eac6f0fc3':
  Create a separate recovery policy.
2014-05-30 18:23:41 +00:00
Stephen Smalley
e60723ab59 Create a separate recovery policy.
Create a separate recovery policy and only include the
recovery domain allow rules in it.

Change-Id: I444107f9821eabf4164ba07a44d03bd71e719989
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 12:53:32 -04:00
Nick Kralevich
422d2e6ed9 am 7b601c31: am ac664270: Merge "Only auditallow unlabeled accesses not allowed elsewhere."
* commit '7b601c3105cf66c330f19a86eb8a74759277054d':
  Only auditallow unlabeled accesses not allowed elsewhere.
2014-05-30 16:00:45 +00:00
Stephen Smalley
f509c81c72 am 871b832c: am 73b0346a: Explictly allow init and kernel unlabeled access.
* commit '871b832cee49a14ca9265451a7c902d32585c603':
  Explictly allow init and kernel unlabeled access.
2014-05-30 16:00:44 +00:00
Nick Kralevich
7b601c3105 am ac664270: Merge "Only auditallow unlabeled accesses not allowed elsewhere."
* commit 'ac6642703f179f8d36b1cca4fe5bd261de65b4b4':
  Only auditallow unlabeled accesses not allowed elsewhere.
2014-05-30 15:56:35 +00:00
Stephen Smalley
871b832cee am 73b0346a: Explictly allow init and kernel unlabeled access.
* commit '73b0346a7d8c500c24731575c118b2fefb8075ea':
  Explictly allow init and kernel unlabeled access.
2014-05-30 15:56:34 +00:00
Nick Kralevich
ac6642703f Merge "Only auditallow unlabeled accesses not allowed elsewhere." 2014-05-30 15:54:30 +00:00
Stephen Smalley
73b0346a7d Explictly allow init and kernel unlabeled access.
These permissions are already allowed indirectly via unconfineddomain
and via domain, but ultimately we plan to remove them from those two
attributes.  Explicitly allow the ones we expect to be required,
matching the complement of the auditallow rules in domain.te.

Change-Id: I43edca89d59c159b97d49932239f8952a848031c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 09:53:00 -04:00
Stephen Smalley
2c8bf56f96 Only auditallow unlabeled accesses not allowed elsewhere.
https://android-review.googlesource.com/#/c/95900/ added further
unlabeled rules for installd and added explicit unlabeled rules for
vold and system_server.  Exclude these permissions from the auditallow
rules on unlabeled so that we only see the ones that would be denied if
we were to remove the allow domain rules here.

Change-Id: I2b9349ad6606bcb6a74a7e67343a8a9e5d70174c
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-30 09:42:01 -04:00
Stephen Smalley
9890c746b5 am e3a92d50: am f85c1fc2: Allow installd, vold, system_server unlabeled access.
* commit 'e3a92d5067e2c4b1801fc73b3b527c0dcbe940c5':
  Allow installd, vold, system_server unlabeled access.
2014-05-29 21:06:36 +00:00
Stephen Smalley
1915d0e94c am c0254385: am eb1bbf26: Clean up kernel, init, and recovery domains.
* commit 'c0254385eb5382aebb524132590098a0ac57e5b2':
  Clean up kernel, init, and recovery domains.
2014-05-29 21:06:26 +00:00
Stephen Smalley
e3a92d5067 am f85c1fc2: Allow installd, vold, system_server unlabeled access.
* commit 'f85c1fc293523db241c48d815b165067b8a0f471':
  Allow installd, vold, system_server unlabeled access.
2014-05-29 20:39:32 +00:00