Commit graph

10517 commits

Author SHA1 Message Date
Dan Cashman
0e9c47c0af 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.

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 10:00:42 -07:00
Alex Klyubin
7c3dbfeb69 Merge "Wifi Keystore HAL is not a HAL" into oc-dev 2017-04-06 04:02:04 +00:00
TreeHugger Robot
cfcffa9a5a Merge "hwservicemanager is not a HAL" into oc-dev 2017-04-06 03:36:20 +00:00
TreeHugger Robot
37792cecad Merge changes from topic 'vendor-ocdev-relabel' into oc-dev
* changes:
  sepolicy: relabel /vendor
  Sepolicy: Add ASAN-Extract
2017-04-06 03:17:07 +00:00
Nathan Harold
516c9abfcd Merge changes from topic 'ipsec-svc-pick' into oc-dev
* changes:
  Add IpSecService SEPolicy
  Update Common NetD SEPolicy to allow Netlink XFRM
2017-04-06 01:34:37 +00:00
Sandeep Patil
277a20ebec sepolicy: relabel /vendor
The CL splits /vendor labeling from /system. Which was allowing all
processes read, execute access to /vendor.

Following directories will remain world readable
 /vendor/etc
 /vendor/lib(64)/hw/

Following are currently world readable but their scope
will be minimized to platform processes that require access
 /vendor/app
 /vendor/framework/
 /vendor/overlay

Files labelled with 'same_process_hal_file' are allowed to be
read + executed from by the world. This is for Same process HALs and
their dependencies.

Bug: 36527360
Bug: 36832490
Bug: 36681210
Bug: 36680116
Bug: 36690845
Bug: 36697328
Bug: 36696623
Bug: 36806861
Bug: 36656392
Bug: 36696623
Bug: 36792803

All of the tests were done on sailfish, angler, bullhead, dragon
Test: Boot and connect to wifi
Test: Run chrome and load websites, play video in youtube, load maps w/
      current location, take pictures and record video in camera,
      playback recorded video.
Test: Connect to BT headset and ensure BT audio playback works.
Test: OTA sideload using recovery
Test: CTS SELinuxHostTest pass

Change-Id: I278435b72f7551a28f3c229f720ca608b77a7029
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-04-05 13:58:32 -07:00
Andreas Gampe
82071b6859 Sepolicy: Add ASAN-Extract
Add selinux policies for init script and shell script to unzip a tar
containing ASAN libraries on boot.

Bug: 36458146
Test: m && m SANITIZE_TARGET=address
Test: manual (build steps for tar missing)
Change-Id: I5c3cb233aae93ee9985431090af902b0e3c1b0a7
(cherry picked from commit 0b74305011)
Merged-In: I5c3cb233aae93ee9985431090af902b0e3c1b0a7
2017-04-05 13:09:29 -07:00
TreeHugger Robot
6821bb4079 Merge "Remove unnecessary adbd permissions." into oc-dev 2017-04-05 18:09:17 +00:00
Steven Moreland
97848f0516 Remove unnecessary adbd permissions.
Test: adbd_test (with and without adb root)
  Note: one test fails without root with and without this change
        because of an unrelated shell selinux denial.
Test: adb screencap, pull, and verify
Test: Android Studio screenshot
Bug: 36643190
Change-Id: Ib534240bc9bb3a1f32b8865ca66db988902a0f4a
2017-04-05 16:07:00 +00:00
Nick Kralevich
6f108fd8e6 Merge "Fix lock logspam and remove domain_deprecated rule" into oc-dev 2017-04-05 13:54:18 +00:00
TreeHugger Robot
c0e6cb584c Merge "Allow update_verifier to reboot the device" into oc-dev 2017-04-05 01:53:52 +00:00
Nick Kralevich
4a580ccabb Fix lock logspam and remove domain_deprecated rule
Remove system_file:file { lock ioctl } from domain_deprecated. The only
domains triggering this were dex2oat and netd, which are fixed in this
change.

Addresses the following logspam similar to:

  avc: granted { lock } for comm="iptables"
  path="/system/etc/xtables.lock" dev="sda22" ino=3745
  scontext=u:r:netd:s0 tcontext=u:object_r:system_file:s0 tclass=file

  avc: granted { lock } for comm="dex2oat"
  path="/system/framework/arm/boot-okhttp.art" dev="dm-0" ino=1295
  scontext=u:r:dex2oat:s0 tcontext=u:object_r:system_file:s0 tclass=file

Test: device boots and no obvious problems.
Bug: 28760354
Bug: 36879751
Change-Id: Iac851c0e49a52ce4000fdfe16e68c17ff819693f
2017-04-04 18:37:28 -07:00
TreeHugger Robot
ccbea503ca Merge "Remove hal_binderization_prop" into oc-dev 2017-04-04 23:50:35 +00:00
TreeHugger Robot
abaf415c36 Merge "Allow hal_sensors to use ashmem from android.hidl.allocator" into oc-dev 2017-04-04 23:22:57 +00:00
TreeHugger Robot
e311d66955 Merge "tee no longer violates the socket comms ban" into oc-dev 2017-04-04 23:17:40 +00:00
Ray Essick
72f6219fed Merge "allow media.metrics to write to file descriptor in /data" into oc-dev 2017-04-04 23:12:26 +00:00
Alex Klyubin
9a14704f62 Wifi Keystore HAL is not a HAL
Wifi Keystore HAL is a HwBinder service (currently offered by keystore
daemon) which is used by Wifi Supplicant HAL. This commit thus
switches the SELinux policy of Wifi Keystore HAL to the approach used
for non-HAL HwBinder services.

The basic idea is simimilar to how we express Binder services in the
policy, with two tweaks: (1) we don't have 'hwservicemanager find' and
thus there's no add_hwservice macro, and (2) we need loosen the
coupling between core and vendor components. For example, it should be
possible to move a HwBinder service offered by a core component into
another core component, without having to update the SELinux policy of
the vendor image. We thus annotate all components offering HwBinder
service x across the core-vendor boundary with x_server, which enables
the policy of clients to contain rules of the form:
binder_call(mydomain, x_server), and, if the service uses IPC
callbacks, also binder_call(x_server, mydomain).

Test: mmm system/sepolicy
Test: sesearch indicates to changes to binder { call transfer} between
      keystore and hal_wifi_supplicant_default domains
Bug: 36896667

Change-Id: I45c4ce8159b63869d7bb6df5c812c5291776d892
2017-04-04 15:04:05 -07:00
Alex Klyubin
645abeaded tee no longer violates the socket comms ban
SELinux policy no longer has allow rules which permit core/non-vendor
domains to communicate with tee domain over sockets. This commit thus
removes tee from the list of temporary exceptions for the socket
communications prohibition.

Test: mmm system/sepolicy
Bug: 36714625
Bug: 36715266
Change-Id: Iccbd9ea0555b0c9f1cb6c5e0f5a6c0d3f8730b4d
2017-04-04 14:12:14 -07:00
Tianjie Xu
6ca32e3531 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: I1260e60f2ef4db50573e515ba95c332512c8ae62
(cherry picked from commit 0d8c1e0a33)
2017-04-04 21:07:48 +00:00
Amit Mahajan
8b080ee260 rild does not communicate with BT/system_server/mediaserver over sockets
Test: manual (verified no denials in basic telephony operations)
Bug: 36613472
Change-Id: I31274adee2cb6293102446cd2d6d547c50616836
2017-04-04 14:04:49 -07:00
Alex Klyubin
ea53e29f82 Merge "No access to tee domain over Unix domain sockets" into oc-dev 2017-04-04 20:51:07 +00:00
Yifan Hong
d131f945e6 Allow hal_sensors to use ashmem from android.hidl.allocator
android.framework.sensorservice@1.0 pass a file
descriptor from hidl_memory into
android.hardware.sensors@1.0, hence requiring the latter
to use the file descriptor.

Test: VtsHalSensorManagerV1_0TargetTest under selinux
enforcing mode
Bug: 35219747
Change-Id: I0185c8af0714776842c90ebb687b684324b55cd8
2017-04-04 13:49:20 -07:00
Alex Klyubin
7acdb58c04 hwservicemanager is not a HAL
This removes hwservicemanager from halserverdomain, because
halserverdomain is only for domains which offer a HAL service.
hwservicemanager offers HwBinder services, but those are not HAL
services.

Test: mmm system/sepolicy
Test: Device boots, no new denials.
Bug: 36494354
Bug: 36896667
Change-Id: I002e047ee1dd98f44429ab3dfe31f66dc63a8a1c
2017-04-04 13:47:40 -07:00
TreeHugger Robot
fbccda3423 Merge "Move TEE rules to vendor image" into oc-dev 2017-04-04 18:59:24 +00:00
Ray Essick
7218698d5a allow media.metrics to write to file descriptor in /data
when GMSCore collects information for uploading via 'dumpsys
media.metrics', it provides the metrics service with a file descriptor
to hold the data, which is post-processed by the log collecting code
in GMScore.  This temp file lives in /data/, a place where our
restrictive policies for media.metrics doesn't allow any writing.

This relaxes the restrictions -- allowing media.metrics to
write to already open file descriptors it might be given on that
partition.

Bug: 36660639
Test: build/boot
Change-Id: Icbaa76b04ecf731014b6b1bb1283bc2951a6ae4b
2017-04-04 10:30:50 -07:00
Steven Moreland
f20c6ee7ab Remove hal_binderization_prop
Test: works on internal marlin
Bug: 34274385
Change-Id: Idd35e5cdccb595b4e5994eb1d78fdeece0aec0a6
2017-04-04 10:24:36 -07:00
TreeHugger Robot
29f273ce6a Merge "sepolicy: Add new wifi keystore HAL" into oc-dev 2017-04-04 16:12:48 +00:00
Martijn Coenen
c3a9e7df5f Merge "Add target for vndservice_contexts." into oc-dev 2017-04-04 03:41:47 +00:00
TreeHugger Robot
bab5872cb1 Merge "adbd/shell: grant access to sepolicy for cts" into oc-dev 2017-04-04 02:01:43 +00:00
Ningyuan Wang
9337a4dd87 Merge "Remove unused wificond sepolicy for dropping privileges" into oc-dev 2017-04-03 23:31:39 +00:00
Jeff Vander Stoep
892d1e40ce adbd/shell: grant access to sepolicy for cts
Test: Test: make cts && \
      cts-tradefed run singleCommand cts --skip-device-info \
      --skip-preconditions --skip-connectivity-check --abi arm64-v8a \
      --module CtsSecurityHostTestCases \
      -t android.security.cts.SELinuxHostTest#testNoExemptionsForBinderInVendorBan
      Fails as expected.
Bug: 36002573

Change-Id: I298c526789b25734d5f18666c64497e5d1e181d0
2017-04-03 16:31:09 -07:00
Martijn Coenen
6676c234fc Add target for vndservice_contexts.
So we can limit vndservicemanager access to
just vndservice_contexts.

Bug: 36052864
Test: servicemanager,vndservicemanager work
Change-Id: I7b132d4f616ba1edd0daf7be750d4b7174c4e188
2017-04-03 15:39:42 -07:00
Tom Cherry
0c31c85a28 Merge "Grant vdc access to kmsg" into oc-dev 2017-04-03 21:58:44 +00:00
Shubang Lu
a1c0650898 Merge "Add sepolicy for tv.input" into oc-dev 2017-04-03 19:55:53 +00:00
Alex Klyubin
f86d54f0d1 No access to tee domain over Unix domain sockets
The tee domain is a vendor domain. Thus it cannot be accessed by
non-vendor components over Unix domain sockets.

It appears that the rules granting this access are not needed.

Test: Flash a clean build with this change. Confirm that bullhead,
      angler, sailfish, ryu, boot without new denials.
      Confirm that YouTube, Netflix, Google Play Movies play back
      videos without new denials.
Bug: 36714625
Bug: 36715266

Change-Id: I639cecd07c9a3cfb257e62622b51b7823613472a
2017-04-03 11:26:01 -07:00
Alex Klyubin
304d653637 Move TEE rules to vendor image
"tee" domain is a vendor domain. Hence its rules should live on the
vendor image.

What's left as public API is that:
1. tee domain exists and that it is permitted to sys_rawio capability,
2. tee_device type exists and apps are not permitted to access
   character devices labeled tee_device.

If you were relying on system/sepolicy automatically labeling
/dev/tf_driver as tee_device or labeling /system/bin/tf_daemon as
tee_exec, then you need to add these rules to your device-specific
file_contexts.

Test: mmm system/sepolicy
Test: bullhead, angler, and sailfish boot up without new denials
Bug: 36714625
Bug: 36714625
Bug: 36720355
Change-Id: Ie21619ff3c44ef58675c369061b4afdd7e8501c6
2017-04-03 11:11:48 -07:00
Ningyuan Wang
9576785df5 Remove unused wificond sepolicy for dropping privileges
Bug: 36855921
Test: compile, wifi works with toggling
Change-Id: Ib0819a2d552472e482e192a69530441cfc2c0fd7
2017-04-03 10:27:39 -07:00
TreeHugger Robot
ed82acb912 Merge "VR: Add sepolicy for VR HWC service" into oc-dev 2017-04-03 14:17:09 +00:00
Ningyuan Wang
a299bc8028 Merge "Remove unused wificond sepolicy privilges" into oc-dev 2017-04-02 03:53:06 +00:00
Jeffrey Vander Stoep
814edf8c90 Merge "Ban core components from accessing vendor data types" into oc-dev 2017-04-01 14:20:37 +00:00
Jeff Vander Stoep
50563c0367 Ban core components from accessing vendor 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 FD such as
ioctl/stat/read/write/append.

This commit asserts that core components marked with attribute
coredomain may only access core data types marked with attribute
core_data_file_type.

A temporary exemption is granted to domains that currently rely on
access.

(cherry picked from commit cd97e71084)

Bug: 34980020
Test: build Marlin policy
Change-Id: I2f0442f2628fbac1f2f7aa5ddf2a13e16b2546cc
2017-04-01 07:16:40 -07:00
TreeHugger Robot
45f699c792 Merge "Refactor sanitized library on-disk layout - SELinux." into oc-dev 2017-04-01 04:18:33 +00:00
TreeHugger Robot
386f946025 Merge "domain: grant all domains access to zoneinfo" into oc-dev 2017-04-01 01:55:52 +00:00
Vishwath Mohan
063de1e099 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.

(cherry picked from commit 33ebdda80f)

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-31 17:23:09 -07:00
Ningyuan Wang
f3443ee77a Remove unused wificond sepolicy privilges
Bug: 33239267
Test: compile, run wifi, no selinux complaint for wificond
Change-Id: I9b3e874381ac6cd7c6ff1058cc4f313bd85481b8
2017-03-31 17:18:17 -07:00
Alex Klyubin
ad80182ab8 Merge "Tighten restrictions on core <-> vendor socket comms" into oc-dev 2017-04-01 00:06:57 +00:00
Tom Cherry
e961483330 Grant vdc access to kmsg
Init is no longer calling vdc with logwrapper, so it must take care of
logging to kmsg directly.

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

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

(cherry picked from commit bc4d36305d)

Change-Id: Id7bc2fa87518aa0678c09495267c9e198ca8c968
2017-03-31 20:48:36 +00:00
Shubang
c76e158c27 Add sepolicy for tv.input
Test: build, flash; adb shell lshal
Bug: 36562029
Change-Id: If8f6d8dbd99d31e6627fa4b7c1fd4faea3b75cf2
2017-03-31 13:44:50 -07:00
Jeff Vander Stoep
5aebe5123c domain: grant all domains access to zoneinfo
/data/misc/zoneinfo is provided by libc and is considered to be
VNDK stable. Grant read access to all domains and exempt from
neverallow rules asserting no vendor access to core data types.

Bug: 36730929
Test: Marlin Policy builds
Change-Id: I13766a661d6314f5393639fc20f1ab55d802f35f
2017-03-31 12:39:27 -07:00
Jin Qian
a239f30fd6 storaged: allow shell to call dumpsys storaged
Test: adb kill-server && adb shell dumpsys storaged
Bug: 36492915
Change-Id: I3a1a2ad2f016ddd5770d585cae82c8be69001df9
2017-03-31 10:53:55 -07:00