Commit graph

173 commits

Author SHA1 Message Date
dcashman
cc39f63773 Split general policy into public and private components.
Divide policy into public and private components.  This is the first
step in splitting the policy creation for platform and non-platform
policies.  The policy in the public directory will be exported for use
in non-platform policy creation.  Backwards compatibility with it will
be achieved by converting the exported policy into attribute-based
policy when included as part of the non-platform policy and a mapping
file will be maintained to be included with the platform policy that
maps exported attributes of previous versions to the current platform
version.

Eventually we would like to create a clear interface between the
platform and non-platform device components so that the exported policy,
and the need for attributes is minimal.  For now, almost all types and
avrules are left in public.

Test: Tested by building policy and running on device.

Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
2016-10-06 13:09:06 -07:00
Amith Yamasani
aa2a33a209 Allow apps to read preloaded photos
(cherry picked from commit e01654f982)

For Retail Demo mode, we need to preload photos in
/data/preloads and allow regular apps to access the
photos returned by the media provider from the preloads
directory.

Bug: 29940807
Change-Id: Ic1061dac55ace1b125ae04b5b0c70aae9aa0c732
2016-09-12 15:44:04 -07:00
Jeff Vander Stoep
7ef80731f2 audit domain_deprecated perms for removal
Grant permissions observed.

Bug: 28760354
Change-Id: Ie63cda709319bbf635ef7bffbba3477c2cccc11b
2016-09-10 07:42:55 -07:00
Eric Bae
0f38c64250 allow policy to create a file by vfat (fs_type) for a case using sdcardfs
am: 362d6ff1b8

Change-Id: Ibe19ac1955bad48b5fa1db7ffada46aa78781781
2016-07-26 00:23:15 +00:00
Eric Bae
362d6ff1b8 allow policy to create a file by vfat (fs_type) for a case using sdcardfs
Change-Id: Ia938d73b1a49b9ba4acf906df37095d21edee22e
2016-07-22 13:34:31 -07:00
Daniel Rosenberg
c15090b315 sepolicy: Add policy for sdcardfs and configfs
Change-Id: I4c318efba76e61b6ab0be9491c352f281b1c2bff
Bug: 19160983
2016-07-22 13:34:23 -07:00
dcashman
e0585ca873 Grant untrusted_app dir access to asec_apk_file.
am: 83348b0b94

Change-Id: Ia19aeffe64e733deb695206dcbd8cb824c9db222
2016-07-15 17:21:38 +00:00
dcashman
83348b0b94 Grant untrusted_app dir access to asec_apk_file.
untrusted_app lost all of the domain_deprecated permissions in N,
including the ability to read asec_apk_file dirs.  This is used for
forward locked apps.

Addresses the following denials:
avc: denied { search } for name="asec" dev="tmpfs" ino=9298 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:asec_apk_file:s0 tclass=dir permissive=0
avc: denied { getattr } for path="/mnt/asec" dev="tmpfs" ino=9298 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:asec_apk_file:s0 tclass=dir permissive=0

(cherry-pick of internal commit: addd3c9fba)

Bug: 30082229
Change-Id: I87758f1daee19197d9299bca261f0324e01af5e0
2016-07-15 09:23:44 -07:00
Jeff Vander Stoep
a619ed8d82 Remove domain_deprecated from isolated_app am: 0b430aba22
am: bbc91a35ee

* commit 'bbc91a35eee6c39a042c505b7986706ae9f73b2d':
  Remove domain_deprecated from isolated_app

Change-Id: I3e96e3b1c12902eb42ef9426cec5275cd6c9443d
2016-05-12 21:35:16 +00:00
Jeff Vander Stoep
0b430aba22 Remove domain_deprecated from isolated_app
Address denials:
avc: denied { read } for name="meminfo" dev="proc" ino=4026544360 scontext=u:r:isolated_app:s0:c512,c768 tcontext=u:object_r:proc_meminfo:s0 tclass=file permissive=0

Bug: 28722489
Change-Id: I3c55bd95bb82ec54e88e9e9bc42d6392a216a936
2016-05-12 20:31:00 +00:00
Nick Kralevich
42982013eb Remove duplicate neverallow rules. am: 1f690c6
am: 51cdbab

* commit '51cdbab6e4420af5f5a84c0ab98bfe20e6db4e8a':
  Remove duplicate neverallow rules.

Change-Id: Ica55d9dcb3f4dc0c24bcca6cc1cff745e788754c
2016-04-23 19:15:25 +00:00
Nick Kralevich
1f690c6ac9 Remove duplicate neverallow rules.
These neverallow rules are exact duplicates of neverallow
rules which occur earlier in the file.

Change-Id: I75e3d84109f26374257741425f8de638a15f2741
2016-04-23 11:19:19 -07:00
Nick Kralevich
13e4528404 drop untrusted_app exec_type getattr am: bca54e3
am: ba1d13c

* commit 'ba1d13c876739d60e6139bc5951b58d3620d6787':
  drop untrusted_app exec_type getattr

Change-Id: I45c639a2413bd485b545d5ffd4cd56d499a29525
2016-04-17 02:33:38 +00:00
Nick Kralevich
bca54e3e39 drop untrusted_app exec_type getattr
SafetyNet is in the priv_app domain. Suppressing this
isn't necessary anymore.

Change-Id: Icbcb75d3b2ebde657bd16b336b252aaec4d0d252
2016-04-16 07:07:37 -07:00
Jeff Vander Stoep
6aaa61ca7c Merge "Further restrict socket ioctls available to apps" into nyc-dev
am: f77bc23

* commit 'f77bc233ad7d3c7d3792d58ae96da1a522aeb73b':
  Further restrict socket ioctls available to apps

Change-Id: I22e9e935d6cc4805e80f44de71aa7622a8f2bf1b
2016-04-15 23:24:49 +00:00
TreeHugger Robot
f77bc233ad Merge "Further restrict socket ioctls available to apps" into nyc-dev 2016-04-15 23:18:31 +00:00
Jeff Vander Stoep
3233353603 Further restrict socket ioctls available to apps
(cherry picked from commit 6ba383c575)

Restrict unix_dgram_socket and unix_stream_socket to a whitelist.
Disallow all ioctls for netlink_selinux_socket and netlink_route_socket.

Neverallow third party app use of all ioctls other than
unix_dgram_socket, unix_stream_socket, netlink_selinux_socket,
netlink_route_socket, tcp_socket, udp_socket and rawip_socket.

Bug: 28171804
Change-Id: Icfe3486a62fc2fc2d2abd8d4030a5fbdd0ab30ab
2016-04-15 21:55:43 +00:00
Nick Kralevich
0e61a7a96d neverallow /data/anr access for isolated/untrusted apps
Add a neverallow rule (compile time assertion + CTS test) that
isolated_apps and untrusted_apps can't do anything else but append
to /data/anr/traces.txt. In particular, assert that they can't
read from the file, or overwrite other data which may already be
in the file.

Bug: 18340553
Bug: 27853304

(cherry picked from commit 369cf8cde5)

Change-Id: Ib33e7ea0342ad28e5a89dfffdd9bc16fe54d8b3d
2016-04-14 22:00:40 -07:00
Nick Kralevich
bf008b1cbe neverallow /data/anr access for isolated/untrusted apps
am: 369cf8c

* commit '369cf8cde5f69e6d6b752e250edfba80289b9c83':
  neverallow /data/anr access for isolated/untrusted apps
2016-03-25 20:07:39 +00:00
Nick Kralevich
369cf8cde5 neverallow /data/anr access for isolated/untrusted apps
Add a neverallow rule (compile time assertion + CTS test) that
isolated_apps and untrusted_apps can't do anything else but append
to /data/anr/traces.txt. In particular, assert that they can't
read from the file, or overwrite other data which may already be
in the file.

Bug: 18340553
Bug: 27853304
Change-Id: I249fe2a46401b660efaa3f1102924a448ed750d5
2016-03-25 12:22:32 -07:00
Daniel Rosenberg
bc2f0e50f2 Merge "sepolicy: Add policy for sdcardfs and configfs" into nyc-dev
am: cf8719e

* commit 'cf8719e7bad53d6c38b2825b736c27c3f37dbf4e':
  sepolicy: Add policy for sdcardfs and configfs
2016-03-22 00:51:44 +00:00
Daniel Rosenberg
cf8719e7ba Merge "sepolicy: Add policy for sdcardfs and configfs" into nyc-dev 2016-03-22 00:46:48 +00:00
dcashman
5690980b5e Mark batteryproperties service as app_api_service.
am: 9ed71eff4b

* commit '9ed71eff4bed91653cba393ea6cb42f041d4e257':
  Mark batteryproperties service as app_api_service.
2016-03-14 23:10:27 +00:00
dcashman
027ec20696 Mark batteryproperties service as app_api_service.
Applications do not explicitly request handles to the batteryproperties
service, but the BatteryManager obtains a reference to it and uses it
for its underlying property queries.  Mark it as an app_api_service so
that all applications may use this API.  Also remove the batterypropreg
service label, as this does not appear to be used and may have been a
duplication of batteryproperties.  As a result, remove the
healthd_service type and replace it with a more specific
batteryproperties_service type.

(cherry-picked from commit: 9ed71eff4b)

Bug: 27442760
Change-Id: I537c17c09145b302728377bf856c1147e4cc37e9
2016-03-14 16:09:42 -07:00
dcashman
9ed71eff4b Mark batteryproperties service as app_api_service.
Applications do not explicitly request handles to the batteryproperties
service, but the BatteryManager obtains a reference to it and uses it
for its underlying property queries.  Mark it as an app_api_service so
that all applications may use this API.  Also remove the batterypropreg
service label, as this does not appear to be used and may have been a
duplication of batteryproperties.  As a result, remove the
healthd_service type and replace it with a more specific
batteryproperties_service type.

Bug: 27442760
Change-Id: I5c0f9d7992ff2ec64adaeef22356e88fd0e8169c
2016-03-14 12:44:14 -07:00
dcashman
f100b2c4e6 Create sysfs_hwrandom type.
HwRngTest needs access to the hwrandom sysfs files, but untrused_app
does not have access to sysfs.  Give these files their own label and
allow the needed read access.

(cherry-pick from internal commit: 85c0f8affa)

Bug: 27263241
Change-Id: If572ad0931a534d76e148b688b76687460e99af9
2016-03-14 10:27:33 -07:00
dcashman
7fa51de7f1 Merge "Create sysfs_hwrandom type." into nyc-dev
am: 9404522aeb

* commit '9404522aebd395d4a58bd3dfd0ac7d5a394af816':
  Create sysfs_hwrandom type.
2016-03-14 17:21:31 +00:00
dcashman
85c0f8affa Create sysfs_hwrandom type.
HwRngTest needs access to the hwrandom sysfs files, but untrused_app
does not have access to sysfs.  Give these files their own label and
allow the needed read access.

Bug: 27263241
Change-Id: I718ba485e9e6627bac6e579f746658d85134b24b
2016-03-11 15:44:44 -08:00
dcashman
f8b189dfc3 resolve merge conflicts of a57cff0679 to nyc-dev-plus-aosp
Change-Id: I52bc4ce1fba44ac910f46ec8084752fbc7b6d719
2016-03-09 09:55:59 -08:00
Daniel Rosenberg
47fb4b9fc4 sepolicy: Add policy for sdcardfs and configfs
Change-Id: I4c318efba76e61b6ab0be9491c352f281b1c2bff
Bug: 19160983
2016-03-07 11:57:08 -08:00
Nick Kralevich
0044bb7fd5 resolve merge conflicts of 6e4bcbe6da to nyc-dev-plus-aosp
Change-Id: I6631204c1a7dbabb672e1c4d634de54449e05267
2016-03-07 11:08:17 -08:00
dcashman
b64ea38366 Remove procfs file read perm from untrusted_app.
Bug: 26813932
Change-Id: I155087d28d9284d8c96554cc6739bb676272a00f
2016-03-07 10:24:14 -08:00
Nick Kralevich
6e4bcbe6da DO NOT MERGE: untrusted_app: drop /proc auditallow
It's unlikely we'll get /proc locked down for the N release, so
delete the auditallow to avoid spamming the logs. Mark this
commit as DO NOT MERGE so we can continue to make progress on this
for future Android releases.

Change-Id: Ibf27bc5cb1b23c21e123aae8a4f190560d0ac2dc
2016-03-07 09:00:34 -08:00
Calin Juravle
e3cc1356bc Add SElinux policies to allow foreign dex usage tracking.
am: 837bc42f5f

* commit '837bc42f5f52760c511140b5ae146898ea75cba8':
  Add SElinux policies to allow foreign dex usage tracking.
2016-03-02 02:28:28 +00:00
Calin Juravle
837bc42f5f Add SElinux policies to allow foreign dex usage tracking.
This is a special profile folder where apps will leave profile markers
for the dex files they load and don't own. System server will read the
markers and decide which apk should be fully compiled instead of
profile guide compiled.

Apps need only to be able to create (touch) files in this directory.
System server needs only to be able to check wheter or not a file with a
given name exists.

Bug: 27334750
Bug: 26080105

Change-Id: I2256e4aba1ec0e5117de6497123223b9a74f404e
2016-03-01 15:50:08 +00:00
Nick Kralevich
ba12da9572 Allow bluetooth access to the tun device.
Bluetooth uses the tun device for tethering. Allow access.

  STEPS TO REPRODUCE:
  0. Have two devices to test on, say Device A and Device B
  1. On Device A, Go to settings ->Bluetooth .
  2. Turn on the Bluetooth .
  3. Pair it with device B
  4. Tap on the paired device

  OBSERVED RESULTS:
  -Bluetooth share crash is observed with "Bluetooth share has stopped"
  error message
  -Unable to use Bluetooth tethering due to this issue

  EXPECTED RESULTS:
  No crash and Bluetooth devices should be able to connect for tethering

Addresses the following denial:

com.android.bluetooth: type=1400 audit(0.0:131): avc: denied { open }
for comm=425420536572766963652043616C6C path="/dev/tun" dev="tmpfs"
ino=12340 scontext=u:r:bluetooth:s0 tcontext=u:object_r:tun_device:s0
tclass=chr_file permissive=0

Bug: 27372573

(cherry picked from commit 9a1347eee6)

Change-Id: Ibd16e48c09fe80ebb4f3779214de3b4806c12497
2016-02-29 10:05:08 -08:00
Nick Kralevich
1d1e20789f Allow bluetooth access to the tun device. am: 9a1347eee6
am: 087601e071

* commit '087601e07160bfd3cd6ae3ab4ba1143df7a2040d':
  Allow bluetooth access to the tun device.
2016-02-29 18:01:29 +00:00
Nick Kralevich
9a1347eee6 Allow bluetooth access to the tun device.
Bluetooth uses the tun device for tethering. Allow access.

  STEPS TO REPRODUCE:
  0. Have two devices to test on, say Device A and Device B
  1. On Device A, Go to settings ->Bluetooth .
  2. Turn on the Bluetooth .
  3. Pair it with device B
  4. Tap on the paired device

  OBSERVED RESULTS:
  -Bluetooth share crash is observed with "Bluetooth share has stopped"
  error message
  -Unable to use Bluetooth tethering due to this issue

  EXPECTED RESULTS:
  No crash and Bluetooth devices should be able to connect for tethering

Addresses the following denial:

com.android.bluetooth: type=1400 audit(0.0:131): avc: denied { open }
for comm=425420536572766963652043616C6C path="/dev/tun" dev="tmpfs"
ino=12340 scontext=u:r:bluetooth:s0 tcontext=u:object_r:tun_device:s0
tclass=chr_file permissive=0

Bug: 27372573
Change-Id: I07724d8d68ffcdda691f1179787a4f40a0ab1c73
2016-02-29 09:22:27 -08:00
dcashman
bc8116b045 resolve merge conflicts of fff4bf792a to nyc-dev-plus-aosp
Change-Id: I2c8e8c3c2f1dcc5440cef1ce1c310957e8f20b4c
2016-02-24 08:57:49 -08:00
dcashman
f25ea5f9c0 Label /proc/meminfo.
Address the following denial:
m.chrome.canary: type=1400 audit(0.0:15): avc: granted { read open } for path="/proc/meminfo" dev="proc" ino=4026544360 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file

(cherry-pick of internal commit: 971aeeda21)

Bug: 22032619
Chromium Bug: 586021

Change-Id: I2dcb2d4800bbc92ea47c37d4fd7a10f827a0114c
2016-02-24 07:38:28 -08:00
dcashman
971aeeda21 Label /proc/meminfo.
Address the following denial:
m.chrome.canary: type=1400 audit(0.0:15): avc: granted { read open } for path="/proc/meminfo" dev="proc" ino=4026544360 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file

Bug: 22032619
Chromium Bug: 586021

Change-Id: I584345c84d870c313da69ec97a0b1e54c0eb9ee1
2016-02-23 17:18:17 -08:00
Calin Juravle
89625c9a64 Update permissions for the dedicated profile folders
Bug: 26719109
Bug: 26563023

Change-Id: Ie0ca764467c874c061752cbbc73e1bacead9b995
2016-02-19 13:40:33 +00:00
Jeff Tinker
0d5bac13e1 Add mediadrm service
Part of media security hardening

This is an intermediate step toward moving
mediadrm to a new service separate from mediaserver.
This first step allows mediadrmservice to run based
on the system property media.mediadrmservice.enable
so it can be selectively enabled on devices that
support using native_handles for secure buffers.

bug: 22990512
Change-Id: I2208c1e87a6bd8d5bfaed06b1fdcb0509c11cff2
2016-02-12 19:38:22 -08:00
dcashman
a8a1faae7b Auditallow untrusted_app procfs access.
Access to proc is being removed but there are still some consumers.  Add
an auditallow to identify them and adjust labels appropriately before
removal.

Change-Id: I853b79bf0f22a71ea5c6c48641422c2daf247df5
2016-02-10 17:05:23 -08:00
Marco Nelissen
d21987702e Merge "selinux rules for codec process" into nyc-dev 2016-02-10 05:46:34 +00:00
Marco Nelissen
c3ba2e5130 selinux rules for codec process
Bug: 22775369

Change-Id: Ic6abe3d0e18ba6f7554d027e0ec05fd19011709b
2016-02-09 14:13:13 -08:00
William Roberts
db664c9ed3 untrusted_app: confine filesystem creation to sandbox
untrusted_apps could be allowed to create/unlink files in world
accessible /data locations. These applications could create
files in a way that would need cap dac_override to remove from
the system when they are uninstalled and/or leave orphaned
data behind.

Keep untrusted_app file creation to sandbox, sdcard and media
locations.

Signed-off-by: William Roberts <william.c.roberts@intel.com>

(cherry picked from commit bd0768cc93)

Change-Id: Ideb275f696606882d8a5d8fdedb48545a34de887
2016-02-09 13:40:51 -08:00
William Roberts
bd0768cc93 untrusted_app: confine filesystem creation to sandbox
untrusted_apps could be allowed to create/unlink files in world
accessible /data locations. These applications could create
files in a way that would need cap dac_override to remove from
the system when they are uninstalled and/or leave orphaned
data behind.

Keep untrusted_app file creation to sandbox, sdcard and media
locations.

Change-Id: Ife680cb9425dad8223651f16b9be8a3179839ec3
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-02-09 13:32:58 -08:00
Marco Nelissen
b1bf83fd79 Revert "selinux rules for codec process"
This reverts commit 2afb217b68.

Change-Id: Ie2ba8d86f9c7078f970afbb06230f9573c28e0ed
2016-01-28 13:51:28 -08:00
Chien-Yu Chen
e0378303b5 selinux: Update policies for cameraserver
Update policies for cameraserver so it has the same permissions
as mediaserver.

Bug: 24511454
Change-Id: I1191e2ac36c00b942282f8dc3db9903551945adb
2016-01-27 11:29:11 -08:00