Commit graph

6236 commits

Author SHA1 Message Date
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
Jeff Sharkey
0cbedfdfbf Merge "Cached ringtone files should be mlstrustedobject." into nyc-dev 2016-03-06 01:30:43 +00:00
Jeff Sharkey
2f829dcd55 Cached ringtone files should be mlstrustedobject.
Both appdomain and priv_app can set the default ringtones, so the
cache files need to be mlstrustedobject.

avc: denied { write } for path="/data/system_de/0/ringtones/ringtone_cache" dev="mmcblk0p44" ino=1602501 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:ringtone_file:s0 tclass=file permissive=0

Bug: 27366059
Change-Id: Ib362f58b180a62bd46800083d6c538426f955b10
2016-03-05 16:59:29 -07:00
Alex Deymo
a52b561859 New postinstall domain and rules to run post-install program.
When using the A/B updater, a device specific hook is sometimes needed
to run after the new partitions are updated but before rebooting into
the new image. This hook is referred to throughout the code as the
"postinstall" step.

This patch creates a new execution domain "postinstall" which
update_engine will use to run said hook. Since the hook needs to run
from the new image (namelly, slot "B"), update_engine needs to
temporarly mount this B partition into /postinstall and then run a
program from there.

Since the new program in B runs from the old execution context in A, we
can't rely on the labels set in the xattr in the new filesystem to
enforce the policies baked into the old running image. Instead, when
temporarily mounting the new filesystem in update_engine, we override
all the new file attributes with the new postinstall_file type by
passing "context=u:object_r:postinstall_file:s0" to the mount syscall.
This allows us to set new rules specific to the postinstall environment
that are consistent with the rules in the old system.

Bug: 27177071
TEST=Deployed a payload with a trivial postinstall script to edison-eng.

(cherry picked from commit 6cb2c893b1)

Change-Id: I49a529eecf1ef0524819470876ef7c8c2659c7ef
2016-03-04 15:49:15 -08:00
Stephen Smalley
423fd19d91 Update netlink socket classes.
Define new netlink socket security classes introduced by upstream kernel commit
6c6d2e9bde1c1c87a7ead806f8f5e2181d41a652 ("selinux: update netlink socket
classes").  This was merged in Linux 4.2 and is therefore only required
for Android kernels based on 4.2 or newer (e.g. the android-4.4 branch
of the kernel/common tree).

Add the new socket classes to socket_class_set.
Add an initial set of allow rules although further refinement
will likely be necessary.  Any allow rule previously written
on :netlink_socket may need to be rewritten or duplicated for
one or more of the more specific classes.  For now, we retain
the existing :netlink_socket rules for compatibility on older kernels.

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>

(cherry picked from commit 01d95c23ab)

Change-Id: Ic00a0d474730cda91ba3bc387e0cc14482f82114
2016-03-03 13:37:40 -08:00
Tao Bao
acf4e09999 Merge "Add /dev/socket/uncrypt." into nyc-dev 2016-03-03 19:52:46 +00:00
Andreas Gampe
ff755159f4 Merge "Sepolicy: Give Otapreopt right to write A/B artifacts in /data" into nyc-dev 2016-03-03 17:19:16 +00:00
Andreas Gampe
c83614b632 Sepolicy: Give Otapreopt right to write A/B artifacts in /data
For apps installed /data (vs the system image), Otapreopt puts
A/B artifacts alongside the regular oat location with a "b" suffix.

Give Otapreopt the right to create and write such files.

Bug: 25612095
Change-Id: Idf3f0959816f49407036cea9b8e684b26c510e80
2016-03-02 18:37:30 -08:00
Nick Kralevich
b6480a5e3b Merge "delete obsolete aliases" into nyc-dev 2016-03-02 23:35:58 +00:00
Tao Bao
c285cad1a6 Add /dev/socket/uncrypt.
system_server used to communicate with uncrypt via files (e.g.
/cache/recovery/command and /cache/recovery/uncrypt_status). Since A/B
devices may not have /cache partitions anymore, we switch to communicate
via /dev/socket/uncrypt to allow things like factory reset to keep
working.

Bug: 27176738
Change-Id: I73b6d6f1ecdf16fd4f3600b5e524da06f35b5bca
2016-03-02 10:51:13 -08:00
Fyodor Kupolov
79bb5d8f00 Merge "Add NetworkTimeUpdateService" into nyc-dev 2016-03-02 18:18:37 +00:00
Nick Kralevich
c321186e1e delete obsolete aliases
no longer used nor desired.

Change-Id: Iac447fb2291371caa4a8ec255db114d9f7ccdddb
2016-03-02 10:10:21 -08:00
Lorenzo Colitti
5f376c1fed Allow netd to check permissions.
Bug: 27239233
Change-Id: I82e3451542f08de67ad950223be90e37a2d3e899
2016-03-02 23:07:12 +09:00
Lorenzo Colitti
9119f12ee3 Revert "Revert "netd: restrict netd binder access to system_server""
This reverts commit b5594c2781.

Bug: 27239233
Change-Id: I407a2f3a313f3de801080f9bae46f6bac1a803c2
2016-03-02 22:59:09 +09:00
Lorenzo Colitti
f723f5f986 Merge "Revert "netd: restrict netd binder access to system_server"" into nyc-dev 2016-03-02 12:45:59 +00:00
Lorenzo Colitti
b5594c2781 Revert "netd: restrict netd binder access to system_server"
This reverts commit 544579597e.

Change-Id: Idfa0254e66f9517cc26af3c37441b47cbb984bca
2016-03-02 07:53:54 +00:00
Jeff Sharkey
8c09b65d8f Allow Phone to write cached ringtones.
avc: denied { write } for path="/data/system_de/0/ringtones/ringtone_cache" dev="mmcblk0p44" ino=1602501 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:ringtone_file:s0 tclass=file permissive=0

Bug: 27366059
Change-Id: I120a69ac4f58c64db6f169ae4f9942ce357b0b1f
2016-03-01 18:02:03 -07: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
Marco Nelissen
50bcd14846 Merge "mediacodec: grant access to surfaceflinger" into nyc-dev 2016-02-28 17:14:56 +00:00
Marco Nelissen
6c53b23da8 mediacodec: grant access to surfaceflinger
avc:  denied  { find } for service=SurfaceFlinger scontext=u:r:mediacodec:s0
tcontext=u:object_r:surfaceflinger_service:s0 tclass=service_manager

Bug: 26990688
Change-Id: Ie7c5f6d879c286375eb52ef4c6b84726aa4f1ba2
2016-02-27 21:27:07 -08:00
Nick Kralevich
3df1fda5e3 Don't allow permissive SELinux domains on user builds.
It's a CTS requirement that all SELinux domains be in
enforcing mode. Add the same assertion to the build system
when targeting user builds.

In particular, this avoids a situation where device integrity
checking is enabled on user builds, but permissive denials
are being generated, causing the device to unexpectedly reboot
into safe mode.

A developer wanting to put an SELinux domain into permissive
mode for userdebug/eng purposes can write the following
in their policy:

  userdebug_or_eng(`
    permissive foo;
  ')

Bug: 26902605
Bug: 27313768

(cherry picked from commit bca98efa57)

Change-Id: If6abe1fa70c79a1fccdbdd9ff273d92de7565a73
2016-02-26 20:50:42 -08:00
Jeff Tinker
a395f87587 Merge "Allow mediadrmserver to access media files" into nyc-dev 2016-02-27 02:06:00 +00:00
Jeff Tinker
05aa151c41 Allow mediadrmserver to access media files
bug: 26782004
Change-Id: Ie3d9289d15446efa160550185a2d565e3be2980f
2016-02-26 17:34:35 -08:00
Fyodor Kupolov
3d564e52ef Add NetworkTimeUpdateService
NetworkTimeUpdateService has been registered as a system service, so that
its dump state can be included into bugreports.

Bug: 23983739
Change-Id: I0d364009ba4630dcfd1d22c647195e33eedaa4e0
2016-02-26 17:21:47 -08:00
Jeff Vander Stoep
3872ee3968 cameraserver: flip to enforcing mode
Bug: 26982110
Change-Id: I551f8cc926886de0feaf065da46d3cf5bdf5cfb5
2016-02-26 15:33:54 -08:00
Jeffrey Vander Stoep
47f8e1f040 Merge "netd: restrict netd binder access to system_server" into nyc-dev 2016-02-25 15:27:04 +00:00
Marco Nelissen
e0323c63dc Merge "Add missing selinux permissions for mediacodec" into nyc-dev 2016-02-24 18:25:34 +00:00
Marco Nelissen
ebf79f88e4 Add missing selinux permissions for mediacodec
Bug: 27305063
Change-Id: Ie9ac3fb971dbb989d7b26421e076139d3f48a916
2016-02-24 10:04:38 -08:00
Jeff Vander Stoep
544579597e netd: restrict netd binder access to system_server
neverallow access to other domains.

Bug: 27239233
Change-Id: I503d1be7308d0229db1cbe52cd511f7f40afa987
2016-02-24 09:25:05 -08:00
Glenn Kasten
a33fbb3cf8 Merge "Restore audio tee sink" into nyc-dev 2016-02-24 16:50:23 +00:00
Jeffrey Vander Stoep
bb7154da6d Merge "audioserver: Build up least privileged policy" into nyc-dev 2016-02-24 16:48:49 +00:00
Daniel Cashman
edbe1a984a Merge "Label /proc/meminfo." into nyc-dev 2016-02-24 15:36:47 +00:00
Lorenzo Colitti
84cc52c588 Merge "Rename the netd service from "android.net.INetd" to "netd"." into nyc-dev 2016-02-24 03:26:13 +00: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
Glenn Kasten
962e3a6a05 Restore audio tee sink
Bug: 27323882
Change-Id: Idf3977d74817c4f90f9e993d2e1e5302cc56f41d
2016-02-23 16:16:16 -08:00
Jeff Vander Stoep
23eef195db audioserver: Build up least privileged policy
Remove all permissions not observed during testing.

Remove domain_deprecated

Bug: 27064332
Change-Id: Ie154af70aaf255721b46d29357e48d5337020b4b
2016-02-23 15:41:31 -08:00
Yabin Cui
91fc66320f Merge "Enable recovery to read batteryinfo." into nyc-dev 2016-02-23 21:28:31 +00:00
Jeff Sharkey
6fb97cd547 Merge "Offer to cache ringtones in system DE storage." into nyc-dev 2016-02-23 20:57:46 +00:00
Jeff Sharkey
62bb52c4d4 Offer to cache ringtones in system DE storage.
Ringtones often live on shared media, which is now encrypted with CE
keys and not available until after the user is unlocked.  To improve
the user experience while locked, cache the default ringtone,
notification sound, and alarm sound in a DE storage area.

Also fix bug where wallpaper_file wasn't getting data_file_type.

Bug: 26730753
Change-Id: Ib1f08d03eb734c3dce91daab41601d3ed14f4f0d
2016-02-23 13:45:29 -07:00
Daniel Sandler
0a5f3d4626 Merge "Allow access to the daydream ("dreams") service." into nyc-dev 2016-02-23 19:12:39 +00:00
Yabin Cui
1ca0670c77 Enable recovery to read batteryinfo.
Bug: 26879394

Change-Id: I09ac9027ca343e00488dedab8df1687fd32bb255
(cherry picked from commit 6b843bcff0)
2016-02-23 10:41:34 -08:00
Dan Sandler
00004ba1ff Allow access to the daydream ("dreams") service.
Bug: 26804329
Change-Id: I7b789c6fe8411e3a4a718da86d442a0f48c5c310
2016-02-23 13:19:14 -05:00
Lorenzo Colitti
62343fe229 Rename the netd service from "android.net.INetd" to "netd".
Bug: 27239233
Change-Id: Icc9d14008d2ff6334a8ec66805f7289aedd5d97d
2016-02-23 22:23:01 +09:00
Lorenzo Colitti
a92c7fe3fb Merge "Allow the framework to communicate with netd via a binder service" into nyc-dev 2016-02-23 08:39:02 +00:00
Erik Kline
12aac02185 Merge "Permit bluetooth to run DhcpClient" into nyc-dev 2016-02-23 00:05:09 +00:00
Sami Tolvanen
f40afcb1b4 Allow logd.auditd to reboot to safe mode
Bug: 26902605
Change-Id: Ica825cf2af74f5624cf4091544bd24bb5482dbe7
(cherry picked from commit 9c168711d5)
2016-02-22 13:57:59 -08:00
Jeffrey Vander Stoep
60185758dd Merge "ioctls: move commonly used tty ioctls to macro" into nyc-dev 2016-02-22 20:47:18 +00:00
Jeff Vander Stoep
8d9eb644dc ioctls: move commonly used tty ioctls to macro
Remove from unpriv_socket_ioctls but grant each user of unpriv_socket_ioctls
use of unpriv_tty_ioctls

Bug: 26990688
Change-Id: I998e09091de5a7234ad0049758d5dad0b35722f7
2016-02-22 12:31:57 -08:00
Tao Bao
11727c9912 Merge "Add recovery service." into nyc-dev 2016-02-22 19:24:25 +00:00