Commit Graph

9436 Commits

Author SHA1 Message Date
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
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
Vishwath Mohan
ebe26cbb7c Merge "Refactor sanitized library on-disk layout - SELinux."
am: a2e9664cef

Change-Id: I184d353b6ca0c8e5b712da11b4de777e04a5b79f
2017-03-31 16:41:29 +00:00
Tom Cherry
6b92e26aec Merge "Grant vdc access to kmsg" 2017-03-31 16:41:02 +00:00
Treehugger Robot
a2e9664cef Merge "Refactor sanitized library on-disk layout - SELinux." 2017-03-31 16:35:53 +00:00
Dan Cashman
d444ebedac Add reverse-attribute mapping to sepolicy-analyze.
sepolicy-analyze allows users to see all types that have a given
attribute, but not the reverse case: all attributes of a given type.
Add a '--reverse' option which enables this, but keeps the previous
interface.

Usage: sepolicy-analyze sepolicy attribute -r init

Bug: 36508258
Test: Build and run against current policy.
Change-Id: Ice6893cf7aa2ec4706a7411645a8e0a8a3ad01eb
2017-03-31 08:40:26 -07:00
Jin Qian
f81e48b62f Merge "storaged: allow shell to call dumpsys storaged"
am: eca322517d

Change-Id: I22930eb5a18047b235b6d1028a3fc49e5a6b0989
2017-03-31 02:33:29 +00:00
Treehugger Robot
eca322517d Merge "storaged: allow shell to call dumpsys storaged" 2017-03-31 02:29:18 +00:00
Jin Qian
af3eaf0d20 storaged: allow shell to call dumpsys storaged
Test: adb kill-server && adb shell dumpsys storaged
Bug: 36492915
Change-Id: I3a1a2ad2f016ddd5770d585cae82c8be69001df9
2017-03-30 16:21:29 -07:00
Myles Watson
6f700ae546 Disallow HAL access to Bluetooth data files
am: 02d9d21dcb

Change-Id: I29861f9cc52001f2968c2313f48031dd01afe8c7
2017-03-30 20:17:03 +00:00
Tom Cherry
bc4d36305d Grant vdc access to kmsg
Init is no longer calling vdc with logwrapper, so it must take care of
logging to kmsg directly.

Change-Id: I529f5a95e19c08ef75e0da9a02bae1cb7187eec0
avc: denied { write } for pid=367 comm="vdc" name="kmsg" dev="tmpfs" ino=11056 scontext=u:r:vdc:s0 tcontext=u:object_r:kmsg_device:s0 tclass=chr_file permissive=0

Test: observe vdc logging in kmsg on boot and stderr on normal usage

Change-Id: Ie3678509d360f19b95cb03aeea75f29843728203
2017-03-30 11:02:29 -07:00
Myles Watson
02d9d21dcb Disallow HAL access to Bluetooth data files
Devices that store their BT MAC address in /data/misc/bluedroid/ need
to find another place for that file.

Bug: 36602160
Test: Restart Bluetooth, check for selinux denials/files in /data/misc
Change-Id: Ib8d610f201a8c35f95b464c24857c6639205bc66
Merged-In: Ib8d610f201a8c35f95b464c24857c6639205bc66
2017-03-30 17:59:32 +00:00
Vishwath Mohan
33ebdda80f Refactor sanitized library on-disk layout - SELinux.
This CL changes the policy for ASAN files on-disk to support the
changes made by the following CLs -
https://android-review.googlesource.com/#/c/359087/
https://android-review.googlesource.com/#/c/359389/

which refactor the on-disk layout of sanitized libraries in the following
manner -
/data/lib* --> /data/asan/system/lib*
/data/vendor/* --> /data/asan/vendor/*

There are a couple of advantages to this, including better isolation
from other components, and more transparent linker renaming and
SELinux policies.

Bug: 36574794
Bug: 36674745
Test: m -j40 && SANITIZE_TARGET="address" m -j40 and the device
boots. All sanitized libraries are correctly located in /data/asan/*,
and have the right SELinux permissions.

Change-Id: Ib08e360cecc8d77754a768a9af0f7db35d6921a9
2017-03-29 23:42:49 -07:00
Nathan Harold
eaa5e2984f Merge changes from topic 'ipsec-service'
am: 328153893f

Change-Id: Id6cc5e3c1dc6b098f893b566dcbf09fc29973162
2017-03-29 23:55:03 +00:00
Nathan Harold
75760e9d04 Update Common NetD SEPolicy to allow Netlink XFRM
am: 7eb3dd3b02

Change-Id: Iafaa3fd315533c4cb49847d927d2c7cbae71bb51
2017-03-29 23:54:58 +00:00
Treehugger Robot
328153893f Merge changes from topic 'ipsec-service'
* changes:
  Add IpSecService SEPolicy
  Update Common NetD SEPolicy to allow Netlink XFRM
2017-03-29 22:50:50 +00:00
Josh Gao
e2acb915ad Merge "Mark system_ndebug_socket as mlstrustedobject."
am: ad38a45cc3

Change-Id: I0d974996ee28e0cff0a5a59de66ce2247c1c254a
2017-03-28 00:32:22 +00:00
Treehugger Robot
ad38a45cc3 Merge "Mark system_ndebug_socket as mlstrustedobject." 2017-03-28 00:21:31 +00:00
Jeff Vander Stoep
2f4df755ae Merge "Create selinux_policy phony target"
am: 915c0070fa

Change-Id: I6899ca877d1ccf0a3d475fd34cfffc00eacdf23d
2017-03-27 20:06:54 +00:00
Treehugger Robot
915c0070fa Merge "Create selinux_policy phony target" 2017-03-27 20:03:04 +00:00
Steven Moreland
aa5feec9f3 Merge "adbd: use hal_client_domain"
am: 5a9410cf7a

Change-Id: I4cf02d403a045bce6da96939406a886197f5a1a5
2017-03-27 17:31:10 +00:00
Treehugger Robot
5a9410cf7a Merge "adbd: use hal_client_domain" 2017-03-27 17:28:38 +00:00
Jeff Sharkey
9222988479 Grant kernel access to new "virtual_disk" file.
am: 3f724c95a8

Change-Id: Ia390c3537b7efe897154380ee836dbb7ac0ed742
2017-03-26 23:43:58 +00:00
Jeff Sharkey
3f724c95a8 Grant kernel access to new "virtual_disk" file.
This is a special file that can be mounted as a loopback device to
exercise adoptable storage code on devices that don't have valid
physical media.  For example, they may only support storage media
through a USB OTG port that is being used for an adb connection.

avc: denied { read } for path="/data/misc/vold/virtual_disk" dev="sda35" ino=508695 scontext=u:r:kernel:s0 tcontext=u:object_r:vold_data_file:s0 tclass=file permissive=0

Bug: 34903607
Change-Id: I84721ec0e9495189a7d850461875df1839826212
2017-03-26 16:00:56 -06:00
Jeff Vander Stoep
d4a3e9dd48 Create selinux_policy phony target
Moves selinux policy build decisions to system/sepolicy/Android.mk.
This is done because the PRODUCT_FULL_TREBLE variable isn't available
in embedded.mk and TARGET_SANITIZE isn't available to dependencies of
init.

Test: Build/boot Bullhead PRODUCT_FULL_TREBLE=false
Test: Build/boot Marlin PRODUCT_FULL_TREBLE=true
Test: Build Marlin TARGET_SANITIZE=address. Verify asan rules are
      included in policy output.
Bug: 36138508
Change-Id: I20a25ffdfbe2b28e7e0f3e090a4df321e85e1235
2017-03-26 21:52:14 +00:00
Jeff Sharkey
a6152592cf Merge "Define policy for "loop-control" device."
am: 2224f30a24

Change-Id: I184272269fed360807e41a1cac1fe099477685e6
2017-03-26 20:33:18 +00:00
Jeff Sharkey
2224f30a24 Merge "Define policy for "loop-control" device." 2017-03-26 20:29:19 +00:00
Steven Moreland
5ebf197505 Merge "Allow system_server to dump stack traces for hals."
am: 133d529862

Change-Id: I934f58768bd30de9c62d33e83b6a1b60f0d0fb9b
2017-03-26 20:11:50 +00:00
Treehugger Robot
133d529862 Merge "Allow system_server to dump stack traces for hals." 2017-03-26 20:08:08 +00:00
Jeff Sharkey
a8e0f76c44 Define policy for "loop-control" device.
Per loop(4), this device is the preferred way of allocating new
loop devices since Linux 3.1.

avc: denied { read write } for name="loop-control" dev="tmpfs" ino=15221 scontext=u:r:vold:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=0

Bug: 34903607
Change-Id: I1f5f62cf0a1c24c6f6453100004812af4b8e1503
2017-03-25 21:39:03 -06:00
William Roberts
72bdc353ed build: stop generating $T/file_contexts
am: 5d0c2e417b

Change-Id: I30a0587f8bb4a99a97ddce7d989302f9a89a02af
2017-03-26 00:34:39 +00:00
William Roberts
5d0c2e417b build: stop generating $T/file_contexts
secilc is being used without -f which is causing a file_contexts
file to be generated in the root of the tree where the build tools
run:

$ stat $T/file_contexts
  File: 'file_contexts'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fc00h/64512d	Inode: 5508958     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/wcrobert)   Gid: ( 1000/wcrobert)
Access: 2017-03-23 11:23:41.691538047 -0700
Modify: 2017-03-23 11:23:41.691538047 -0700
Change: 2017-03-23 11:23:41.691538047 -0700

Test: remove $T/file_contexts, touch a policy file and make sepolicy,
      ensure file is not regenerated. Also, ensure hikey builds and
      boots.

Change-Id: I0d15338a540dba0194c65a1436647c7d38fe3c79
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2017-03-25 22:43:24 +00:00
Steven Moreland
7bd7d417bf adbd: use hal_client_domain
Bug: 36546152
Bug: 36278706

Test: `adb shell screencap ...` and pull and visually verify image.
Change-Id: Iab2ddcfc145cb7f55104cd8f1ce0d58286bca282
2017-03-24 18:55:56 -07:00
Alex Deymo
adabd898c5 Merge "Allow update_engine to kill postinstall process."
am: 987014c894

Change-Id: I97a2e56097ca2f4a23ae682afcb86c47d9fd8749
2017-03-25 01:46:19 +00:00
Alex Deymo
987014c894 Merge "Allow update_engine to kill postinstall process." 2017-03-25 01:43:45 +00:00
Steven Moreland
fac3144b12 Allow system_server to dump stack traces for hals.
Test: `adb shell am hang --allow-restart` -> Watchdog dumps
  hal traces (eventually)
Bug: 36414311

Change-Id: I57e6875998b1f06a7deec1b8774facb75148d2c1
2017-03-24 17:48:25 -07:00
Alex Klyubin
5d8fcf3bb0 Merge "Mark all clients of Allocator HAL"
am: 73a6f38b94

Change-Id: I24d9be712209ee22a33ae858001c4e38e0eb763a
2017-03-24 22:48:41 +00:00
Alex Klyubin
73a6f38b94 Merge "Mark all clients of Allocator HAL" 2017-03-24 22:42:35 +00:00
Alex Klyubin
e1742ef066 su and perfprofd are coredomain too
am: 6b558dcbea

Change-Id: I82c412038e43bb343dc355c9d1e56a11f6da6542
2017-03-24 22:35:41 +00:00
Alex Klyubin
7cda44f49f Mark all clients of Allocator HAL
This change associates all domains which are clients of Allocator HAL
with hal_allocator_client and the, required for all HAL client
domains, halclientdomain.

This enables this commit to remove the now unnecessary hwallocator_use
macro because its binder_call(..., hal_allocator_server) is covered by
binder_call(hal_allocator_client, hal_allocator_server) added in this
commit.

Unfortunately apps, except isolated app, are clients of Allocator HAL
as well. This makes it hard to use the hal_client_domain(...,
hal_allocator) macro because it translates into "typeattribute" which
currently does not support being provided with a set of types, such as
{ appdomain -isolated_app }. As a workaround, hopefully until
typeattribute is improved, this commit expresses the necessary
association operation in CIL. private/technical_debt.cil introduced by
this commit is appended into the platform policy CIL file, thus
ensuring that the hack has effect on the final monolithic policy.

P. S. This change also removes Allocator HAL access from isolated_app.
Isolated app shouldn't have access to this HAL anyway.

Test: Google Play Music plays back radios
Test: Google Camera records video with sound and that video is then
      successfully played back with sound
Test: YouTube app plays back clips with sound
Test: YouTube in Chrome plays back clips with sound
Bug: 34170079
Change-Id: Id00bba6fde83e7cf04fb58bc1c353c2f66333f92
2017-03-24 13:54:43 -07:00