Commit graph

10587 commits

Author SHA1 Message Date
Sandeep Patil
bb24f3abe1 mac_permissions: explicitly label all mac_permissions files
*mac_permissions.xml files need to be explicitly labeled as they are now split
cross system and vendor and won't have the generic world readable
'system_file' or 'rootfs' label.

Bug: 36003167
Test: no new 'mac_perms_file' denials at boot complete on sailfish
Test: successfully booted into recovery without denials and sideloaded
      OTA update.
Test: Launch 'chrome' and succesfully load a website.
Test: Launch Camera and take a picture.
Test: Launch Camera and record a video, succesfully playback recorded
      video

Change-Id: I1c882872bb78d1242ba273756ef0dc27487f58fc
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-03-29 10:24:20 -07:00
Sandeep Patil
136caa1b65 sepolicy: explicitly label all sepolicy files
sepolicy files need to be explicitly labeled as they are now split
cross system and vendor and won't have the generic world readable
'system_file' or 'rootfs' label.

Bug: 36527360
Test: no new 'sepolicy_file' denials at boot complete on sailfish
Test: successfully booted into recovery without denials and sideloaded
      OTA update.
Test: Launch 'chrome' and succesfully load a website.
Test: Launch Camera and take a picture.
Test: Launch Camera and record a video, succesfully playback recorded
      video

Change-Id: I6fe8ba31588c2d75521c6e2b0bf7e6d6eaf80a19
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-03-29 10:23:01 -07:00
Sandeep Patil
1e149967a2 seapp_context: explicitly label all seapp context files
seapp_context files need to be explicitly labeled as they are now split
cross system and vendor and won't have the generic world readable
'system_file' label.

Bug: 36002414
Test: no new 'seapp_context' denials at boot complete on sailfish
Test: successfully booted into recovery without denials and sideloaded
      OTA update.
Test: ./cts-tradefed run singleCommand cts --skip-device-info \
      --skip-preconditions --skip-connectivity-check --abi \
      arm64-v8a --module CtsSecurityHostTestCases -t \
      android.security.cts.SELinuxHostTest#testAospSeappContexts
Test: Launch 'chrome' and succesfully load a website.
Test: Launch Camera and take a picture.
Test: Launch Camera and record a video, succesfully playback recorded
      video

Change-Id: I19b3e50c6a7c292713d3e56ef0448acf6e4270f7
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-03-29 10:20:11 -07:00
Sandeep Patil
c9cf7361c1 file_context: explicitly label all file context files
file_context files need to be explicitly labeled as they are now split
across system and vendor and won't have the generic world readable
'system_file' label.

Bug: 36002414
Test: no new 'file_context' denials at boot complete on sailfish
Test: successfully booted into recovery without denials and sideloaded
OTA update.
Test: ./cts-tradefed run singleCommand cts --skip-device-info \
       --skip-preconditions --skip-connectivity-check --abi \
       arm64-v8a --module CtsSecurityHostTestCases -t \
       android.security.cts.SELinuxHostTest#testAospFileContexts

Change-Id: I603157e9fa7d1de3679d41e343de397631666273
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-03-29 10:17:21 -07:00
Sandeep Patil
939d16b59f service_contexts: label service_contexts explicitly
The label applies to all service_contexts regardless of their location.
This also lets us track the service_contexts usage and limit access to
the files for the corresponding object manager alone.

Bug: 36002427
Test: Boot sailfish and observe no denials for 'serice_contexts'
Test: cts-tradefed run singleCommand cts --skip-device-info \
          --skip-preconditions --skip-connectivity-check \
          --abi arm64-v8a --module CtsSecurityHostTestCases \
          -t android.security.cts.SELinuxHostTest#testAospServiceContexts

Change-Id: I97fc8b24bc99ca5c00d010fb522cd39a35572858
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-03-29 10:13:34 -07:00
Sandeep Patil
54a4200134 prop_context: correctly label all property_context files
split property context file in vendor and sytem were left untouched by
the recent changes. This was working accidentally because they were
still accessible to all domains as 'system_file'.

Bug: 36002573
Test: Boot sailfish to observe no new denials.
Test: 'adb sideload' OTA on sailfish successfully

Change-Id: I5bec058b59db83d2a431e9f7e91c5a09af7d2942
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-03-29 10:10:32 -07:00
Alex Klyubin
edc53291d7 Fix warnings
Unescaped apostrophe is not permitted inside macros.

Test: mmm system/sepolicy -- no warnings
Bug: 34980020
Change-Id: I893a41508d8b62975771967fd6e40e50d188c7c1
2017-03-29 09:07:02 -07:00
Jeff Vander Stoep
4a478c47f4 Ban vendor components access to core data types
Vendor and system components are only allowed to share files by
passing open FDs over HIDL. Ban all directory access and all file
accesses other than what can be applied to an open file:
stat/read/write/append.

This commit marks core data types as core_data_file_type and bans
access to non-core domains with an exemption for apps. A temporary
exemption is also granted to domains that currently rely on
access with TODOs and bug number for each exemption.

Bug: 34980020
Test: Build and boot Marlin. Make phone call, watch youtube video.
      No new denials observed.
Change-Id: I320dd30f9f0a5bf2f9bb218776b4bccdb529b197
2017-03-28 15:44:39 -07:00
TreeHugger Robot
e3531f6397 Merge "Allow violators of "no Binder in vendor" access to /dev/binder" 2017-03-28 02:50:06 +00:00
Josh Gao
3dcc37f3c1 Merge "Mark system_ndebug_socket as mlstrustedobject." am: ad38a45cc3 am: e2acb915ad
am: 53047f6d7e

Change-Id: I6e4dac9c891dae5318651a8a44fd7da34e86964c
2017-03-28 00:41:31 +00:00
Josh Gao
53047f6d7e Merge "Mark system_ndebug_socket as mlstrustedobject." am: ad38a45cc3
am: e2acb915ad

Change-Id: I86368e4febe04d7dddc718316c1788c46f6ecb74
2017-03-28 00:35:55 +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
TreeHugger Robot
467650bd79 Merge "Ban socket connections between core and vendor" 2017-03-28 00:04:54 +00:00
Alex Klyubin
2ab99a1389 Allow violators of "no Binder in vendor" access to /dev/binder
In f5446eb148 I forgot to let violators
of "no Binder in vendor" rule keep their access to /dev/binder. This
commit fixes the issue.

Test: mmm system/sepolicy
Bug: 35870313
Bug: 36657020
Change-Id: I3fc68df1d78e2a2da94ac9bf036a51923e3a9aae
2017-03-27 15:46:58 -07:00
Kevin Schoedel
378c43131b Merge "Allow vrmanager to connect to vr_window_manager." 2017-03-27 21:34:05 +00:00
Jeff Vander Stoep
531ce53618 Merge "Create selinux_policy phony target" am: 915c0070fa am: 2f4df755ae
am: ab1fad17ff

Change-Id: I4c7ea7e2bd41950d5203660af7058895b83870ab
2017-03-27 20:12:25 +00:00
Jeff Vander Stoep
ab1fad17ff Merge "Create selinux_policy phony target" am: 915c0070fa
am: 2f4df755ae

Change-Id: I4a273520e7a5a92f5739f413d8773ddb3c6a259a
2017-03-27 20:09:55 +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
3c1a95d683 Merge "adbd: use hal_client_domain" am: 5a9410cf7a am: aa5feec9f3
am: d34c7eefda

Change-Id: Ieb708734a6578e9f7bc43731e6b297704f8f3937
2017-03-27 17:37:40 +00:00
Steven Moreland
d34c7eefda Merge "adbd: use hal_client_domain" am: 5a9410cf7a
am: aa5feec9f3

Change-Id: I3ba818c67e9134161dfd9c74d9fdb52f0bd51bef
2017-03-27 17:34:08 +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
Alex Klyubin
2746ae6822 Ban socket connections between core and vendor
On PRODUCT_FULL_TREBLE devices, non-vendor domains (coredomain) and
vendor domain are not permitted to connect to each other's sockets.
There are two main exceptions: (1) apps are permitted to talk to other
apps over Unix domain sockets (this is public API in Android
framework), and (2) domains with network access (netdomain) are
permitted to connect to netd.

This commit thus:
* adds neverallow rules restricting socket connection establishment,
* temporarily exempts the domains which are currently violating this
  rule from this restriction. These domains are grouped using the new
  "socket_between_core_and_vendor_violators" attribute. The attribute
  is needed because the types corresponding to violators are not
  exposed to the public policy where the neverallow rules are.

Test: mmm system/sepolicy
Bug: 36613996
Change-Id: I458f5a09a964b06ad2bddb52538ec3a15758b003
2017-03-27 08:49:13 -07:00
Jeff Sharkey
b16aaef36f Grant kernel access to new "virtual_disk" file. am: 3f724c95a8 am: 9222988479
am: a4960ef90f

Change-Id: Ia6fbb2aae4d5c66e868e43b279748a7a96ae3bf7
2017-03-26 23:49:29 +00:00
Jeff Sharkey
a4960ef90f Grant kernel access to new "virtual_disk" file. am: 3f724c95a8
am: 9222988479

Change-Id: Idd03a8f1a6b3a315ee6be221ea7d91b06be9477e
2017-03-26 23:46:29 +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
581bd5446b Merge "Define policy for "loop-control" device." am: 2224f30a24 am: a6152592cf
am: d33a51c3fd

Change-Id: Ife99cd6fc85b77ea77ca1edc9a8c741ee0d204ee
2017-03-26 20:38:48 +00:00
Jeff Sharkey
d33a51c3fd Merge "Define policy for "loop-control" device." am: 2224f30a24
am: a6152592cf

Change-Id: I7f1ad41abd96abaef416d4cb3352fa475cffff5d
2017-03-26 20:36:18 +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
0f40a5dc30 Merge "Allow system_server to dump stack traces for hals." am: 133d529862 am: 5ebf197505
am: 518e14e610

Change-Id: I2b9c58cf3e7f583d8a099545696f06e741e7d2b2
2017-03-26 20:16:47 +00:00
Steven Moreland
518e14e610 Merge "Allow system_server to dump stack traces for hals." am: 133d529862
am: 5ebf197505

Change-Id: I1033e791b718bd1c374885f3a16b176994bb957f
2017-03-26 20:14:18 +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
5f71c06bac build: stop generating $T/file_contexts am: 5d0c2e417b am: 72bdc353ed
am: 453537370c

Change-Id: Ifbd0f8bc238fe7ec49299b20dec36b0a07a580df
2017-03-26 00:39:40 +00:00
William Roberts
453537370c build: stop generating $T/file_contexts am: 5d0c2e417b
am: 72bdc353ed

Change-Id: I461829999d3413254a837ffb4612316d9d992acd
2017-03-26 00:37:09 +00:00
William Roberts
72bdc353ed build: stop generating $T/file_contexts
am: 5d0c2e417b

Change-Id: I30a0587f8bb4a99a97ddce7d989302f9a89a02af
2017-03-26 00:34:39 +00:00
TreeHugger Robot
e3c42d76a6 Merge "mediacodec violates "no Binder in vendor" rule" 2017-03-26 00:31:38 +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
bb0d3c50fb Merge "Allow update_engine to kill postinstall process." am: 987014c894 am: adabd898c5
am: 81e48f9724

Change-Id: I0f30763ac163bb5032d296097b346eec10ed2dc2
2017-03-25 01:50:51 +00:00
Alex Deymo
81e48f9724 Merge "Allow update_engine to kill postinstall process." am: 987014c894
am: adabd898c5

Change-Id: I1eb82bf76bfef80bbb51e636d166e55a30b234bf
2017-03-25 01:48:49 +00: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