Commit graph

6997 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
Andreas Gampe
f1eabc5683 Sepolicy: Ignore otapreopt_chroot setsched denial
Ignore, as it's a side effect of mounting /vendor.

Bug: 31116514
Change-Id: If94a27a26181e40de5c5e60f5446de9ce2ccdba0
(cherry picked from commit 0f81e06630)
2016-10-06 10:19:51 -07:00
Treehugger Robot
da3c86ffb8 Merge "Create unique labels for /dev/snd/{seq,timer}" 2016-10-05 18:47:49 +00:00
Jeff Vander Stoep
c7e6074c0d Create unique labels for /dev/snd/{seq,timer}
No core android component needs access to /dev/snd/{seq,timer}, but
currently audioserver, bootanim, init, system_server and ueventd have
access. Seq and timer have been the source of many bugs in the past
[1]. Giving these files new labels without explicitly granting access
removes access from audioserver, bootanim, and system_server.
Init and ueventd still require access for /dev setup.

TODO: Explore unsetting CONFIG_SND_TIMER device kernels.

[1] https://github.com/google/syzkaller/wiki/Found-Bugs

Test: media CTS "cts-tradefed run cts -m CtsMediaTestCases" on Bullhead
and Dragon completed with no denials.

Bug: 29045223
(cherry picked from commit db4510d87a)
Change-Id: I2d069920e792ce8eef70c7b4a038b9e7000f39f5
2016-10-05 10:32:03 -07:00
Janis Danisevskis
639ae65d1b Merge changes from topic 'strict_service_lookup'
* changes:
  fix lax service context lookup (II)
  fix lax service context lookup
2016-10-05 14:43:08 +00:00
Jeff Vander Stoep
96a85d12c8 app: audit usage of ion ioctls
Test: builds and boots on Bullhead with no selinux audit messages.

Bug: 29795149
Bug: 30400942
Change-Id: I93295424a03488234b233d5e2f86d3bf329e53fd
2016-10-02 21:32:52 -07:00
Treehugger Robot
cd623e3459 Merge "gatekeeperd: remove domain_deprecated attribute" 2016-10-02 06:57:06 +00:00
Jeff Vander Stoep
24ad514367 gatekeeperd: remove domain_deprecated attribute
Test: builds/boots on Angler. No "granted" messages for the removed
permissions observed in three months of log audits.

Bug: 28760354
Change-Id: I0a6363f094c41392469f438c4399c93ed53fb5ac
2016-10-01 20:47:01 -07:00
Treehugger Robot
6e41791bdb Merge "mediaserver drmserver: remove domain_deprecated attribute" 2016-10-01 14:49:03 +00:00
Jeff Vander Stoep
3a0721a38f mediaserver drmserver: remove domain_deprecated attribute
avc: granted { use } for pid=3067 comm="SoundPoolThread"
scontext=u:r:drmserver:s0 tcontext=u:r:system_server:s0 tclass=fd

Test: builds/boots on Angler. Adds permissions for all "granted" avc
messages observed in three months of log auditing.

Bug: 28760354
Change-Id: I51f13d7c7d40f479b1241dfcd5d925d28f74926b
2016-10-01 05:43:58 -07:00
Janis Danisevskis
d6033b4158 fix lax service context lookup (II)
As fallout from the corresponding fix in libselinux,
this patch adds the missing services without changing
semantics.

Test: bullhead builds and boots

Bug: 31353148
Change-Id: I21026c9435ffef956a59d61c4903174ac7b1ef95
2016-09-30 10:18:39 +01:00
Janis Danisevskis
3e4632943d fix lax service context lookup
Inform checkfc about new service label backend.

Test: bullhead builds

Bug: 31353148
Change-Id: I499da36108e67483a4f9a18fd8cc7c8f13419abd
2016-09-30 10:18:00 +01:00
Iliyan Malchev
b8df90a273 add policy for android.hardware.nfc@1.0-service
android.hardware.nfc@1.0-service is the generic binderized
HIDL package implementation of android.hardware.nfc@1.0

Denials:
avc: denied { read write } for pid=432 comm="android.hardwar"
name="pn548" dev="tmpfs" ino=10228
scontext=u:r:android_hardware_nfc_1_0_service:s0
tcontext=u:object_r:nfc_device:s0 tclass=chr_file

avc: denied { search } for pid=443 comm="Binder:430_1" name="nfc"
dev="dm-0" ino=670433 scontext=u:r:android_hardware_nfc_1_0_service:s0
tcontext=u:object_r:nfc_data_file:s0 tclass=dir

Test: pass

Change-Id: Id022b8d1706253ef65a37406c74ff883e12415b2
Signed-off-by: Iliyan Malchev <malchev@google.com>
2016-09-28 13:45:00 -07:00
Treehugger Robot
6552138b94 Merge "Audit access to libart" 2016-09-27 23:33:28 +00:00
Jeff Vander Stoep
88cef4dfef Audit access to libart
Grant access to all processes and audit access. The end goal is to
whitelist all access to the interpreter. Several processes including
dex2oat, apps, and zygote were observed using libart, so omit them
from auditing and explicitly grant them access.

Test: Angler builds and boots

Bug: 29795519
Change-Id: I9b93c7dbef5c49b95a18fd26307955d05a1c8e88
2016-09-27 15:09:30 -07:00
Treehugger Robot
915a1c258a Merge "logd: remove domain_deprecated attribute" 2016-09-27 21:43:53 +00:00
Lorenzo Colitti
a8239c61b8 Don't allow dumpstate to call ioctl on netlink_tcpdiag_socket.
This fixes the build error:

=====
libsepol.report_assertion_extended_permissions: neverallowxperm on line 166 of system/sepolicy/domain.te (or line 9201 of policy.conf) violated by
allow dumpstate dumpstate:netlink_tcpdiag_socket { ioctl };
libsepol.check_assertions: 1 neverallow failures occurred
=====

Which is caused, in AOSP and downstream branches, by
I123e5d40955358665800fe3b86cd5f8dbaeb8717.

Test: builds.
Change-Id: I925dec63df7c3a0f731b18093a8ac5c70167c970
2016-09-27 23:30:35 +09:00
Lorenzo Colitti
bb9b4dd895 Allow dumpstate to run ss.
(cherry picked from commit 63c7ad6efb)

Bug: 23113288
Test: see http://ag/1476096
Change-Id: I3beb21f1af092c93eceb3d5115f823c1b993727d
2016-09-27 23:29:54 +09:00
Iliyan Malchev
96031a8357 sepolicy: allow hwservicemanager to set properties
Allow hwservicemanager to set properties starting with the prefix
"hwservicemanager."

b/31458381
b/31240290
Test: passing build and runtime tests

Change-Id: Id92e2170f52893bbf236987ee59383df2264952f
Signed-off-by: Iliyan Malchev <malchev@google.com>
2016-09-26 14:48:26 -07:00
Treehugger Robot
c5ee21d420 Merge "Clean up LOCAL_C_INCLUDES" 2016-09-26 08:51:49 +00:00
Jeff Vander Stoep
5c4435af89 logd: remove domain_deprecated attribute
Test: builds/boots on Angler. No "granted" messages for the removed
permissions observed in three months of log audits.

Bug: 28760354
Change-Id: I76c2752f806b83a6c21fcb17b6f445368936f61b
2016-09-24 14:36:39 -07:00
Ajay Panicker
2a57e77f2f Add btsnoop_hci.log to bugreport zip (2/2)
Bug: 28672558
Test: Manual
Change-Id: Ibee6e7e52eb6ee285b9ca0a5507d515eb3c54c0e
2016-09-23 11:12:00 -07:00
Treehugger Robot
10960aec9d Merge "Add selinux policy for legacy Wifi HAL" 2016-09-23 16:27:41 +00:00
bowgotsai
a6c215bcaf Clean up LOCAL_C_INCLUDES
It should be specified by LOCAL_EXPORT_C_INCLUDE_DIRS from the imported
libraries.

Change-Id: I5b01ac24763a75984227d77671def6561325b7cc
2016-09-23 09:21:25 +08:00
Treehugger Robot
60c436cb76 Merge "Let system_server writes to dumpstate.options property." 2016-09-22 04:54:33 +00:00
Felipe Leme
a5a8072f3c Let system_server writes to dumpstate.options property.
Currently, we define 4 hardcoded init services to launch dumpstate with
different command-line options (since dumpstate must be launched by
root):

- bugreport
- bugreportplus
- bugreportwear
- bugreportremote

This approach does not scale well; a better option is to have just one
service, and let the framework pass the extra arguments through a system
property.

BUG: 31649719
Test: manual

Change-Id: I7ebbb7ce6a0fd3588baca6fd76653f87367ed0e5
2016-09-21 14:19:29 -07:00
Michal Karpinski
59afa2414d Change name in the rules after renaming dns_listener -> netd_listener
Change-Id: I4737a087f2d00e1028d1cb43d9eda814a008dbe8
2016-09-21 12:47:49 +09:00
Svet Ganov
3286fca7db Move device serial behing a permission - selinux
Build serial is non-user resettable freely available device
identifier. It can be used by ad-netowrks to track the user
across apps which violates the user's privacy.

This change deprecates Build.SERIAL and adds a new Build.getSerial()
API which requires holding the read_phone_state permission.
The Build.SERIAL value is set to "undefined" for apps targeting
high enough SDK and for legacy app the value is still available.

bug:31402365

Change-Id: I6309aa58c8993b3db4fea7b55aae05592408b6e4
2016-09-19 15:59:58 -07:00
Mitchell Wills
a18b41e752 Add selinux policy for legacy Wifi HAL
avc: denied { call } for scontext=u:r:wificond:s0 tcontext=u:r:hwservicemanager:s0 tclass=binder permissive=1
avc: denied { call } for scontext=u:r:wificond:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=binder permissive=1

avc: denied { bind } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=netlink_socket permissive=1
avc: denied { call } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:hwservicemanager:s0 tclass=binder permissive=1
avc: denied { create } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=netlink_socket permissive=1
avc: denied { create } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=udp_socket permissive=1
avc: denied { getattr } for path="/proc/4355/net/psched" dev="proc" ino=4026535370 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:object_r:proc_net:s0 tclass=file permissive=1
avc: denied { getattr } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=netlink_socket permissive=1
avc: denied { ioctl } for path="socket:[28193]" dev="sockfs" ino=28193 ioctlcmd=8933 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=udp_socket permissive=1
avc: denied { ioctl } for path="socket:[34821]" dev="sockfs" ino=34821 ioctlcmd=8933 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=udp_socket permissive=1
avc: denied { net_admin } for capability=12 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=capability permissive=1
avc: denied { net_raw } for capability=13 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=capability permissive=1
avc: denied { open } for path="/proc/2754/net/psched" dev="proc" ino=4026535377 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:object_r:proc_net:s0 tclass=file permissive=1
avc: denied { open } for path="/sys/class/net" dev="sysfs" ino=10488 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=1
avc: denied { read } for name="net" dev="sysfs" ino=10488 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=1
avc: denied { read } for name="psched" dev="proc" ino=4026535370 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:object_r:proc_net:s0 tclass=file permissive=1
avc: denied { read } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=netlink_socket permissive=1
avc: denied { setopt } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=netlink_socket permissive=1
avc: denied { transfer } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:hwservicemanager:s0 tclass=binder permissive=1
avc: denied { write } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=netlink_socket permissive=1
avc: denied { create } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=netlink_socket permissive=0
avc: denied { net_admin } for capability=12 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=capability permissive=0
avc: denied { read } for name="net" dev="sysfs" ino=9862 scontext=u:r:wifi_hal_legacy:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
avc: denied { create } for scontext=u:r:wifi_hal_legacy:s0 tcontext=u:r:wifi_hal_legacy:s0 tclass=udp_socket permissive=0

Bug: 31352200
Test: can boot angler & bullhead and start/stop HAL repeatedly
Change-Id: Ide93730d362fb93602742fc10b22fff6e7d56f6b
2016-09-19 14:45:36 -07:00
Ajay Panicker
a45672614d Allow bluetooth service to access bluetooth directory and add /logs (6/6)
Bug: 31466840
Change-Id: I3984754034349e6c41de6ae9cccbaab95ca5a918
2016-09-16 20:20:31 +00:00
Treehugger Robot
f23299c547 Merge "Allow system_server to delete directories in preloads" 2016-09-15 18:18:24 +00:00
Fyodor Kupolov
3189945192 Allow system_server to delete directories in preloads
(cherry picked from commit 028ed753b5)

avc: denied { rmdir } for name="apps" scontext=u:r:system_server:s0 tcontext=u:object_r:preloads_data_file:s0 tclass=dir permissive=0
avc: denied { rmdir } for name="demo" scontext=u:r:system_server:s0 tcontext=u:object_r:preloads_data_file:s0 tclass=dir permissive=0

Bug: 28855287
Change-Id: Ia470f94d1d960cc4ebe68cb364b8425418acdbd4
2016-09-15 09:31:05 -07:00
Janis Danisevskis
071b935d0b Allow debuggerd execmem on debuggable domains
In anticipation of fixing a loophole in the Linux kernel that allows
circumventing the execmem permission by using the ptrace interface,
this patch grants execmem permission on debuggable domains to
debuggerd. This will be required for setting software break points
once the kernel has been fixed.

Bug: 31000401
Change-Id: I9b8d5853b643d24b94d36e2adbcb135dbaef8b1e
2016-09-15 15:11:31 +01:00
Treehugger Robot
1a640f327d Merge "Allow keystore to access KeyAttestationApplicationIDProviderService" 2016-09-14 21:11:00 +00:00
Treehugger Robot
52c8adb34a Merge "nfc: allow access to drmserver_service" 2016-09-14 19:59:19 +00:00
Treehugger Robot
0dc5d020ac Merge "selinux: Update policies for mediadrmserver" 2016-09-14 19:36:45 +00:00
Tianjie Xu
59379d8b48 Add sepolicy for update_verifier
(cherry picked from commit 5d8d2dc9f9)

Grant update_verifier the permissions to read /data/ota_package/
and the blocks on system partition.

The denial messages:
update_verifier: type=1400 audit(0.0:29): avc: denied { read }
scontext=u:r:update_verifier:s0 tcontext=u:object_r:ota_package_file:s0 tclass=file permissive=1

update_verifier: type=1400 audit(0.0:30): avc: denied { open }
scontext=u:r:update_verifier:s0 tcontext=u:object_r:ota_package_file:s0 tclass=file permissive=1

update_verifier: type=1400 audit(0.0:31): avc: denied { read } dev="tmpfs"
scontext=u:r:update_verifier:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=1

update_verifier: type=1400 audit(0.0:32): avc: denied { open } dev="tmpfs"
scontext=u:r:update_verifier:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=1

Test: On device, update_verifier reads the blocks successfully during boot time.
Bug: 30020920

Change-Id: I10777c1e6ba649b82c4a73171124742edeb05997
2016-09-14 19:31:22 +00:00
Tao Bao
1e17dafc6d update_verifier: Allow searching /dev/block.
update_verifier calls bootcontrol HAL to mark the currently booting slot
as successfully booted.

avc: denied { search } for name="block" dev="tmpfs" scontext=u:r:update_verifier:s0 tcontext=u:object_r:block_device:s0 tclass=dir permissive=0
avc: denied { search } for name="block" dev="tmpfs" scontext=u:r:update_verifier:s0 tcontext=u:object_r:block_device:s0 tclass=dir permissive=0

Bug: 29569601
Test: Device boots up with no update_verifier denials and 'bootctl is-slot-marked-successful 0' returns 0.
Change-Id: I1baa7819bc829e3c4b83d7168008a5b06b01cc9f
2016-09-14 19:29:06 +00:00
Janis Danisevskis
61e5ccae9e Allow keystore to access KeyAttestationApplicationIDProviderService
(cherry picked from commit 58b079a259)

Bug: 22914603
Change-Id: I8ae1a786702694ca2bb8707a4c142b8a233042ee
2016-09-14 19:24:48 +00:00
Treehugger Robot
2c1b02eba6 Merge "allow system_server to set bootanim scheduling priority" 2016-09-14 19:22:48 +00:00
Treehugger Robot
ed06b57b77 Merge "New service name for IpConnectivity metrics" 2016-09-14 19:04:10 +00:00
Jeff Vander Stoep
2a00c64a4f nfc: allow access to drmserver_service
(cherry picked from commit 24ad5862bd)

avc:  denied  { find } for service=drm.drmManager pid=4320 uid=1027 scontext=u:r:nfc:s0 tcontext=u:object_r:drmserver_service:s0 tclass=service_manager

Arrange in alphabetical order.

Bug: 30112127
Change-Id: I6592497a937c6a6d2c7c3d444beba3db333f4852
2016-09-14 17:53:27 +00:00
Takahiro Aizawa
ec7508546b selinux: Update policies for mediadrmserver
(cherry picked from commit 23a276a295)

DRM 3rd party application with platform signature
requires the permission.

Bug: 30352348
Change-Id: Idd673506764ae435db1be8cc8c13658541ffa687
2016-09-14 10:32:56 -07:00
Hugo Benichi
c1c82606f1 New service name for IpConnectivity metrics
(cherry picked from commit f412cc623f)

Bug: 31254800
Change-Id: If8708c8a4e0ea7655f31028881248a14cf2ba5f7
2016-09-14 10:19:02 -07:00
Wei Wang
88323b2e6d allow system_server to set bootanim scheduling priority
(cherry picked from commit 1617c0ce89)

Addresses the following denial:
     avc: denied { setsched } for pid=1405 comm="Binder:1094_3" scontext=u:r:system_server:s0 tcontext=u:r:bootanim:s0 tclass=process permissive=0

Maybe fix bug 30118894.

Bug: 30118894
Change-Id: I29be26c68094c253778edc8e4fef2ef1a238ee2e
2016-09-14 10:15:15 -07:00
Martijn Coenen
50ab0b1ace Allow the NFC process to access hwservicemanager.
Add a macro to make this easier for other processes
as well.

Change-Id: I489d0ce042fe5ef88dc767a6fbdb9b795be91601
(cherry picked from commit c2b9c1561e4bd7ac86d78b44ca7927994e781da0)
2016-09-14 16:47:09 +00:00
Martijn Coenen
6b952393f6 Initial hardware servicemanager sepolicy.
Change-Id: I07d188e4dd8801a539db1e9f3edf82a1d662648e
(cherry picked from commit 61a082a55dbc2798d50d0d4b766151d69334729a)
2016-09-14 16:35:34 +00:00
Treehugger Robot
36e260f772 Merge "Fix SELinux denials for protected content playback" 2016-09-14 02:35:37 +00:00
Andreas Gampe
f9c741b860 sepolicy: give otapreopt getattr
(cherry picked from commit 88c5146585)

Allow the otapreopt rename script to read file attributes. This is
being used to print the aggregate artifact size for diagnostic
purposes.

Bug: 30832951
Change-Id: Iee410adf59dcbb74fa4b49edb27d028025cd8bf9
2016-09-13 20:45:47 +00:00
Andreas Gampe
a3a0bb446b Sepolicy: Add otapreopt_slot
(cherry picked from commit eb717421b1)

The new A/B OTA artifact naming scheme includes the target slot so
that the system is robust with respect to unexpected reboots. This
complicates the renaming code after reboot, so it is moved from the
zygote into a simple script (otapreopt_slot) that is hooked into
the startup sequence in init.

Give the script the subset of the rights that the zygote had so that
it can move the artifacts from /data/ota into /data/dalvik-cache.
Relabeling will be done in the init rc component, so relabeling
rights can be completely removed.

Bug: 25612095
Bug: 28069686
Change-Id: Iad56dc3d78ac759f4f2cce65633cdaf1cab7631b
2016-09-13 20:45:39 +00:00