Commit Graph

9474 Commits

Author SHA1 Message Date
Treehugger Robot
7f4b2ad584 Merge "fc_sort: Fix leaks" 2017-05-01 23:30:26 +00:00
Treehugger Robot
9e0d6aeb4f Merge "Sepolicy: Disable leak sanitizer for checkpolicy" 2017-05-01 16:33:28 +00:00
Andreas Gampe
ac4cf8e3ea Sepolicy: Disable leak sanitizer for checkpolicy
Temporary workaround.

Bug: 37755687
Test: ASAN_OPTIONS= SANITIZE_HOST=address m
Merged-In: I001a42ea6463a1e137e1f5328755596f986323de
Change-Id: I001a42ea6463a1e137e1f5328755596f986323de
2017-05-01 14:42:49 +00:00
Joel Scherpelz
edd4126125 Merge "Allow dumpstate to acquire xtables.lock" 2017-05-01 06:31:49 +00:00
Andreas Gampe
c32d7bae15 fc_sort: Fix leaks
Use the getline API correctly: keep a single buffer as long as
possible, and let the callee handle re-allocation. Move the final
free out of the loop.

Release the head of the linked list.

Bug: 37757586
Test: ASAN_OPTIONS= SANITIZE_HOST=address mmma system/sepolicy
Change-Id: I42424acba7cd68c1b9a7a43e916a421ac3e253f7
2017-04-28 10:37:55 -07:00
Andreas Gampe
ee8b67dfd9 Sepolicy-Analyze: Plug leak
Destroy the policy before exiting (for successful = expected runs).

Bug: 37757759
Test: ASAN_OPTIONS= SANITIZE_HOST=address m
Change-Id: I67e35fbede696ec020a53b69a6cef9f374fae167
2017-04-27 18:16:26 -07:00
Treehugger Robot
608969b33f Merge "Remove access to sock_file for hal_nfc" 2017-04-27 07:34:59 +00:00
Nick Kralevich
db5962cef5 Add untrusted_v2_app to all_untrusted_apps
This was accidentally omitted from all_untrusted_app

While I'm here, split across mutiple lines and alphabetize.

Test: policy compiles.
Change-Id: I7fe1d1d0a4ef2ed3ab010931ee2ba15637c2be51
2017-04-26 16:19:47 -07:00
Jerry Zhang
224b4eace9 Merge "Add drm and kernel permissions to mediaprovider" 2017-04-26 20:52:15 +00:00
Jerry Zhang
6f9ac6e4cc Add drm and kernel permissions to mediaprovider
These were missing when the sepolicy was migrated.

Addresses denials:

E SELinux : avc:  denied  { find } for service=drm.drmManager pid=11769
uid=10018 scontext=u:r:mediaprovider:s0:c512,c768
tcontext=u:object_r:drmserver_service:s0 tclass=service_manager

W kworker/u16:2: type=1400 audit(0.0:1667): avc: denied { use } for
path="/storage/emulated/0/DCIM/Camera/IMG_20170425_124723.jpg"
dev="sdcardfs" ino=1032250 scontext=u:r:kernel:s0
tcontext=u:r:mediaprovider:s0:c512,c768 tclass=fd permissive=0

Bug: 37685394
Bug: 37686255
Test: Sync files
Test: Open downloaded file

Change-Id: Ibb02d233720b8510c3eec0463b8909fcc5bbb73d
2017-04-26 11:15:44 -07:00
Philip Cuadra
2e8b000467 Merge "Allow Bluetooth sys_nice and system_server setsched for Bluetooth HAL" 2017-04-26 16:56:00 +00:00
Ruchi Kandoi
ad41fa8dc3 Remove access to sock_file for hal_nfc
Test: manual
Bug: 37640900
Change-Id: I6987d60c1eb1578134b51f4e7417700fd462ba4d
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2017-04-25 14:57:33 -07:00
Joel Scherpelz
5e901bbe89 Allow dumpstate to acquire xtables.lock
iptables recently changed its behavior to strictly require xtables.lock.
dumpstate selinux policy must be updated to allow access.

Bug: 37648320
Test: dumpstate succeeds with no avc: denied ... xtables.lock messages
Change-Id: Ic7e243739f375a60fa14fe67fac910d31d978ffd
(cherry picked from commit ca0979792f)
2017-04-25 16:22:11 +09:00
nharold
327d7cb910 Merge "Allow UDP Sockets to be returned from IpSecService" 2017-04-25 03:45:35 +00:00
Philip Cuadra
6eee6eb2c0 Allow Bluetooth sys_nice and system_server setsched for Bluetooth HAL
Bluetooth needs the capability to set audio-related threads to be RT
scheduled.  Grant it sys_nice.

system_server needs to set priority for the Bluetooth HAL.  Allow it.

Bug 37518404
Test:  Play Bluetooth audio, confirm RT scheduling with systrace
Change-Id: Iaf7b85a11a51883744d72a50addfd320b6fbbc2f
2017-04-24 17:57:59 -07:00
Treehugger Robot
35fd321234 Merge "Only the bluetooth app may run in the bluetooth domain" 2017-04-20 23:42:38 +00:00
Jeff Vander Stoep
67b4037879 Only the bluetooth app may run in the bluetooth domain
Remove neverallow exemption allowing other processes to run in
the bluetooth app's selinux domain.

The bluetooth domain is intended to host the zygote spawned
bluetooth app. It is not intended to host other bluetooth related
processes. Please define new domains for these processes.

Test: build Marlin
Change-Id: I1fd3dd0fe85f73457d77b63a65b4307821cbd41c
2017-04-20 07:46:47 -07:00
Neil Fuller
5684f61fe2 Allow the shell user to run tzdatacheck
Allow the shell user to run tzdatacheck, which is required
to enable a new host side test.

This change also adds some additional checks to
tzdatacheck.te to ensure that OEMs opening up permissions
further don't accidentally create a security hole.

Bug: 31008728
Test: Ran CTS
Change-Id: I6ebfb467526b6b2ea08f891420eea24c81ed1e36
2017-04-20 09:31:36 +00:00
Treehugger Robot
47061e5910 Merge "Add dex2oat permissions to open and read the tmp apk." 2017-04-19 17:13:13 +00:00
Jack He
a61f7f60ef Allow Bluetooth process to access /dev/uhid in SELinux Policy
Bug: 37476041
Test: make, pair and connect to HID device
Change-Id: Ic7e81382994769e3f3a91255dcf3624edeaf6bfd
2017-04-18 18:23:26 -07:00
Jeff Hao
661910644f Add dex2oat permissions to open and read the tmp apk.
The PackageManager now passes previous code paths to dex2oat as shared
libraries. dex2oat needs extra permissions in order to access and open
the oat files of these libraries (if they were compiled).

Part of a multi-project change.

Bug: 34169257
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t android.appsecurity.cts.SplitTests

Merged-In: I7b9cfd7f3c3509f3e41f0590ab650bd85faab340
(cherry-picked from commit 1103f963a7)

Change-Id: I6d69d463af7a0a93391dd4b7edd5b700012ba58c
2017-04-18 17:12:19 -07:00
Dan Cashman
9d46f9b4f0 sepolicy-analyze: Add ability to list all attributes.
This could be useful in diffs between policy versions.

Bug: 37357742
Test: sepolicy-analyze lists all attributes in precompiled_policy.
Change-Id: I6532a93d4102cf9cb12b73ee8ed86ece368f9131
2017-04-18 11:08:43 -07:00
Jerry Zhang
9f152d98ea Split mediaprovider as a separate domain from priv_app
MediaProvider requires permissions that diverge from those
of a typical priv_app. This create a new domain and removes
Mtp related permissions from priv_app.

Bug: 33574909
Test: Connect with MTP, download apps and files, select ringtones
Test: DownloadProvider instrument tests, CtsProviderTestCases

Change-Id: I950dc11f21048c34af639cb3ab81873d2a6730a9
2017-04-17 15:30:35 -07:00
Treehugger Robot
5ab5cfbae4 Merge "Allow recovery to read thermal info on sailfish" 2017-04-15 00:51:31 +00:00
Tianjie Xu
b4e4565d58 Allow recovery to read thermal info on sailfish
Encountered more denials on sailfish:

avc:  denied  { read } for  pid=439 comm="recovery" name="thermal"
dev="sysfs" ino=28516 scontext=u:r:recovery:s0
tcontext=u:object_r:sysfs_thermal:s0 tclass=dir permissive=0

avc:  denied  { read } for  pid=441 comm="recovery"
name="thermal_zone9" dev="sysfs" ino=40364 scontext=u:r:recovery:s0
tcontext=u:object_r:sysfs_thermal:s0 tclass=lnk_file permissive=0

Bug: 36920500
Test: sideload a package in sailfish
Change-Id: Ib4e89ba48cdc383318e5f3b7b15f542434e43564
2017-04-14 14:39:40 -07:00
Treehugger Robot
e453801d66 Merge "bluetooth: Remove domain_deprecated" 2017-04-14 01:23:58 +00:00
Jeff Vander Stoep
ff1e018499 bluetooth: Remove domain_deprecated
Remove domain_deprecated from bluetooth. This removes some unnecessarily
permissive rules.

Bug: 25433265
Test: All of the permissions being removed were being audited. Verify
      that no audited (granted) avc messages for bluetooth exist in
      in the logs.

Change-Id: Ifa12a0f1533edcb623bbb9631f88f1ff1d6d7085
2017-04-13 10:43:49 -07:00
Jerry Zhang
f3b5bd6415 Add configfs file permissions to init.
These were previously in device specific sepolicies.
They should be in core sepolicy to reflect their
use by a core init file, init.usb.configfs.rc.

Addresses denial:

init    : type=1400 audit(0.0:135): avc: denied { unlink } for name="f1"
dev="configfs" ino=10923 scontext=u:r:init:s0
tcontext=u:object_r:configfs:s0 tclass=lnk_file permissive=0

Test: denial addressed
Change-Id: I869892f9d0c311b727462fb380f4160feb986215
2017-04-13 17:37:36 +00:00
Nathan Harold
0f75a62e2c Allow UDP Sockets to be returned from IpSecService
These permissions allow the system server to create and
bind a UDP socket such that it gains the SOCK_BINDPORT_LOCK.
(ref: af_inet.c - inet_bind()) This prevents the user from
disconnecting the socket, which would create a security
vulnerability. The user may then use the provided socket,
which is always IPv4/UDP, for IKE negotiation. Thus, an
un-trusted user app must be able to use the socket for
communication.

-ALLOW: read, write, connect, sendto, and recvfrom.
-NEVERALLOW: anything else

Bug: 30984788
Test: CTS tested via IpSecManagerTest:testUdpEncapsulationSocket

Change-Id: I045ba941797ac12fd14a0cce42efdd2abc4d67e0
2017-04-12 11:32:18 -07:00
Treehugger Robot
20fe64e73d Merge "Add PLATFORM_SEPOLICY_VERSION." 2017-04-12 17:31:13 +00:00
Treehugger Robot
f6eb2ad6ed Merge "remove /dev/log" 2017-04-12 07:58:33 +00:00
Treehugger Robot
d16d039f12 Merge "system_server: Report dalvikcache_data_file execute violations." 2017-04-12 03:37:37 +00:00
Tom Cherry
8c60f74dcc remove /dev/log
This was marked deprecated in 2014 and removed in 2015, let's remove
the sepolicy now too.

Test: see that logging still works on bullhead

Change-Id: I4caa0dbf77956fcbc61a07897242b951c275b502
2017-04-11 21:35:32 +00:00
Jorge Lucangeli Obes
665128fac3 system_server: Report dalvikcache_data_file execute violations.
With build/core eaa9d88cf, system_server should not be loading code
from /data. Add an auditallow rule to report violations.

Bug: 37214733
Test: Boot marlin, no SELinux audit lines for system_server.
Change-Id: I2e25eb144503274025bd4fc9bb519555851f6521
2017-04-11 13:39:25 -04:00
Dan Cashman
bec5e57ec9 Add PLATFORM_SEPOLICY_VERSION.
Create PLATFORM_SEPOLICY_VERSION, which is a version string to represent
the platform sepolicy of the form "NN.m" where "NN" mirrors the
PLATFORM_SDK_VERSION and "m" is a policy-based minor version that is
incremented with every policy change that requires a new backward-compatible
mapping file to be added to allow for future-proofing vendor policy against
future platform policy.

(cherry-pick of commit 6f14f6b7d9)

Bug: 36783775
Test: Device boots when sha256 doesn't match and compilation is forced.
Change-Id: I4edb29824f2050a5a6e1bc078c100cf42e45c303
2017-04-11 10:19:42 -07:00
Sandeep Patil
9a3a6a81df sepolicy_version: change current version to NN.m format
The sepolicy version takes SDK_INT.<minor> format. Make sure our
'current' policy version reflects the format and make it '100000.0'.
This ensures any vendor.img compiled with this will never work with
a production framework image either.

Make version_policy replace the '.' in version by '_' so secilc is
happy too.

This unblocks libvintf from giving out a runtme API to check vendor's
sepolicy version. The PLAT_PUBLIC_SEPOLICY_CURRENT_VERSION will
eventually be picked up from the build system.

(cherry-pick of commit 42f95984b5)

Bug: 35217573
Test: Build and boot sailfish.
      Boot sailfish with sepolicy compilation on device.
Signed-off-by: Sandeep Patil <sspatil@google.com>

Change-Id: Ic8b6687c4e71227bf9090018999149cd9e11d63b
2017-04-11 10:16:24 -07:00
Josh Gao
b7cb45f0d2 Merge "Add /dev/kmsg_debug." 2017-04-10 20:51:59 +00:00
Tianjie Xu
462cf398a0 Merge "Allow recovery to read thermal info" 2017-04-07 18:16:53 +00:00
Dan Cashman
04ef57bfac Move mapping_sepolicy.cil to /system partition.
This is a necessary first step to finalizing the SELinux policy build
process.  The mapping_sepolicy.cil file is required to provide backward
compatibility with the indicated vendor-targeted version.

This still needs to be extended to provide N mapping files and corresponding
SHA256 outputs, one for each of the N previous platform versions with which
we're backward-compatible.

(cherry-pick of commit: 0e9c47c0af)

Bug: 36783775
Test: boot device with matching sha256 and non-matching and verify that
device boots and uses either precompiled or compiled policy as needed. Also
verify that mapping_sepolicy.cil has moved.

Change-Id: I5692fb87c7ec0f3ae9ca611f76847ccff9182375
2017-04-06 15:45:16 -07:00
Josh Gao
a015186fab Add /dev/kmsg_debug.
Add /dev/kmsg_debug on userdebug devices, to allow crash_dump to log
crashes to dmesg when logd isn't up yet (or is the one crashing).

Bug: http://b/36574794
Test: stop tombstoned; crasher; dmesg
Change-Id: I249e11291c58fee77098dec3fd3271ea23363ac9
2017-04-06 14:07:02 -07:00
Tianjie Xu
3da2f21fbf Allow recovery to read thermal info
We want to track temperature metrics during an OTA update.

denial message:
denied  { search } for  pid=349 comm="recovery" name="thermal"
dev="sysfs" ino=18029 scontext=u:r:recovery:s0
tcontext=u:object_r:sysfs_thermal:s0 tclass=dir permissive=0

denied  { read } for  pid=326 comm="recovery" name="temp"
dev="sysfs" ino=18479 scontext=u:r:recovery:s0
tcontext=u:object_r:sysfs_thermal:s0 tclass=file permissive=0

Bug: 36920500
Bug: 32518487
Test: temperature logs on angler
Change-Id: Ib70c1c7b4e05f91a6360ff134a11c80537d6015e
2017-04-06 00:22:54 -07:00
Treehugger Robot
b5b6e0c5c0 Merge "logcatd: introduce logcatd executable" 2017-04-04 21:48:23 +00:00
Tianjie Xu
fde87a96c6 Merge "Allow update_verifier to reboot the device" 2017-04-04 20:48:29 +00:00
Treehugger Robot
1871fc0a88 Merge "Remove hal_binderization_prop" 2017-04-04 19:49:52 +00:00
Tianjie Xu
1a60998ac0 Allow update_verifier to reboot the device
Currently update_verifier only verifies the blocks when dm-verity is in
'enforcing' mode; and dm-verity will reboot the device upon detection of
errors. However, sometimes the verity mode is not guaranteed to be
correct. When mode is 'eio' for example, dm-verity will not trigger
a reboot but rather fail the read. So update_verifier need to take the
responsibility to reboot the device. Otherwise the device will continue
to boot without setting the flag "isSlotMarkedSuccessful".

Denial message:
update_verifier: type=1400 audit(0.0:18): avc: denied { write } for
name="property_service" dev="tmpfs" ino=14678 scontext=u:r:update_verifier:s0
tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0

Bug: 36260064
Test: powerctl property sets successfully
Change-Id: I7431f87e2d61be1425397732aebb369d4ad4c26c
2017-04-04 19:44:06 +00:00
Steven Moreland
d40474ec55 Remove hal_binderization_prop
Test: works on internal marlin
Bug: 34274385
Change-Id: Idd35e5cdccb595b4e5994eb1d78fdeece0aec0a6
2017-04-04 09:46:45 -07:00
Mark Salyzyn
88cdd71d7e logcatd: introduce logcatd executable
logcatd is the same as logcat, except that the -L flag, if supplied,
runs once, then the command re-runs itself without the -L flag with
the same argument set.  By introducing a logcatd daemon executable
we can solve the problem of the longish reads from pstore that
sometimes occur when the system is excessively busy spinning in a
foreground task starving this daemon as we absorb the delay in
an init service, rather than in an init exec.  This would not have
been efficiently possible without the introduction of liblogcat.

Test: gTest logcat-unit-tests
Test: Manual check logpersist operations
Bug: 28788401
Bug: 30041146
Bug: 30612424
Bug: 35326290
Change-Id: I3454bad666c66663f59ae03bcd72e0fe8426bb0a
2017-04-03 14:53:53 -07:00
Daniel Cashman
22b00be748 Merge "Add reverse-attribute mapping to sepolicy-analyze."
am: cb6f8f0277

Change-Id: I47b6a0362f268ba1a599ab2354f72357fc7b79cc
2017-03-31 20:35:29 +00:00
Daniel Cashman
cb6f8f0277 Merge "Add reverse-attribute mapping to sepolicy-analyze." 2017-03-31 20:32:17 +00:00
Tom Cherry
58cb5787d4 Merge "Grant vdc access to kmsg"
am: 6b92e26aec

Change-Id: Ie76aa1f95e72b6183c13be4f9dc86481a2d63077
2017-03-31 16:42:55 +00:00