Commit graph

131 commits

Author SHA1 Message Date
Dan Cashman
2f2fd36539 Merge "Add extraneous neverallow rule to enforce attribute inclusion." into oc-dev
am: b5aeaf6dfa

Change-Id: Ib0ac9cf10c7cb9fd2462e0036307e2552d19b93b
2017-06-16 20:46:00 +00:00
Dan Cashman
939b50ff61 Add extraneous neverallow rule to enforce attribute inclusion.
Due to the massively increased number of attributes in SELinux policy
as part of the treble changes, we have had to remove attributes from
policy for performance reasons.  Unfortunately, some attributes are
required to be in policy to ensure that our neverallow rules are being
properly enforced.  Usually this is not a problem, since neverallow rules
indicate that an attribute should be kept, but this is not currently the
case when the attribute is part of a negation in a group.

This is particularly problematic with treble since some attributes may
exist for HALs that have no implementation, and thus no types.  In
particular, this has caused an issue with the neverallows added in our
macros.  Add an extraneous neverallow rule to each of those auto-generated
neverallow rules to make sure that they are not removed from policy, until
the policy compiler is fixed to avoid this.  Also add corresponding rules
for other types which have been removed due to no corresponding rules.

Bug: 62591065
Bug: 62658302
Test: Attributes present in policy and CTS passes.  sepolicy-analyze also
works on platform-only policy.
Change-Id: Ic3fc034cdbd04a94167f8240cf562297e8d7c762
2017-06-16 11:19:53 -07:00
Andrew Scull
b17b763711 Allow bootctl HAL to access misc block device. am: b0d59450ae
am: 7c4f46b5c1

Change-Id: I88aa64b8847456f66310d632ee86929a76dfaf7b
2017-06-01 18:59:29 +00:00
Andrew Scull
7c4f46b5c1 Allow bootctl HAL to access misc block device.
am: b0d59450ae

Change-Id: If85613b84aecf43b0519bb933d925eb1829e3d5e
2017-06-01 18:39:31 +00:00
Andrew Scull
b0d59450ae Allow bootctl HAL to access misc block device.
This is sometimes used for communication with the bootloader.

Bug: 62052545
Test: Build
Change-Id: I3ae37793407719e55ab0830129aa569c9018f7da
2017-05-31 16:00:28 +01:00
Narayan Kamath
f194aad208 SEPolicy: Changes for new stack dumping scheme.
Applications connect to tombstoned via a unix domain socket and request
an open FD to which they can write their traces. This socket has a new
label (tombstoned_java_trace_socket) and appdomain and system_server are
given permissions to connect and write to it.

Apps no longer need permissions to open files under /data/anr/ and
these permissions will be withdrawn in a future change.

Bug: 32064548
Test: Manual

(cherry picked from commit a8832dabc7f3b7b2381760d2b95f81abf78db709)

(cherry picked from commit 11bfcc1e96)

Change-Id: Icc60d227331c8eee70a9389ff1e7e78772f37e6f
2017-05-31 10:01:48 +00:00
Narayan Kamath
11bfcc1e96 SEPolicy: Changes for new stack dumping scheme.
Applications connect to tombstoned via a unix domain socket and request
an open FD to which they can write their traces. This socket has a new
label (tombstoned_java_trace_socket) and appdomain and system_server are
given permissions to connect and write to it.

Apps no longer need permissions to open files under /data/anr/ and
these permissions will be withdrawn in a future change.

Bug: 32064548
Test: Manual

(cherry picked from commit a8832dabc7f3b7b2381760d2b95f81abf78db709)

Change-Id: I70a3e6e230268d12b454e849fa88418082269c4f
2017-05-30 18:16:38 +01:00
Alex Vakulenko
251b15a601 Merge "SELinux policies for PDX services" into oc-dev am: 7e6176400b
am: 14847b075b

Change-Id: I2e467b433481631148ad5a761ebeff76459a4a54
2017-05-11 19:07:39 +00:00
Alex Vakulenko
14847b075b Merge "SELinux policies for PDX services" into oc-dev
am: 7e6176400b

Change-Id: Idefee5498a277bd5b507e648ff41bdc02aa0d752
2017-05-11 18:33:26 +00:00
Alex Vakulenko
41daa7f859 SELinux policies for PDX services
Specify per-service rules for PDX transport. Now being able to
grant permissions to individual services provided by processes,
not all services of a process.

Also tighter control over which permissions are required for
client and server for individual components of IPC (endpoints,
channels, etc).

Bug: 37646189
Change-Id: I78eb8ae8b6e08105666445a66bfcbd2f1d69d0ea
2017-05-10 16:39:19 -07:00
Nick Kralevich
aa365288ef system_server: drop dalvikcache_data_file execute.
With build/core eaa9d88cf, system_server should not be loading code
from /data.

https://bugs.chromium.org/p/project-zero/issues/detail?id=955

Bug: 37214733
Bug: 31780877
Test: Device boots and no obvious problems.
Test: No collected SELinux denials for build-server generated builds.
Change-Id: I37b1e9e6c4555c937730ab491b6c38801b38ad38
2017-05-04 08:54:58 -07:00
Jeff Vander Stoep
ea9d1b1f68 Merge "Add default label and mapping for vendor services" into oc-dev
am: 74a96734a9

Change-Id: Id1a20ebb9c2bd1dfa6edcb11354bcb3e525e3f04
2017-04-29 18:09:52 +00:00
TreeHugger Robot
74a96734a9 Merge "Add default label and mapping for vendor services" into oc-dev 2017-04-29 18:05:30 +00:00
TreeHugger Robot
02bbb402e0 Merge "Add default label and mapping for vendor services" 2017-04-28 22:30:52 +00:00
Jeff Vander Stoep
082eae4e51 Add default label and mapping for vendor services
Adding the default label/mapping is important because:
1.  Lookups of services without an selinux label should generate
    a denial.
2.  In permissive mode, lookups of a service without a label should be
    be allowed, without the default label service manager disallows
    access.
3.  We can neverallow use of the default label.

Bug: 37762790
Test: Build and flash policy onto Marlin with unlabeled vendor services.
    Add/find of unlabeled vendor services generate a denial.

Change-Id: I66531deedc3f9b79616f5d0681c87ed66aca5b80
(cherry picked from commit 639a2b842c)
2017-04-28 14:56:57 -07:00
Jeff Vander Stoep
639a2b842c Add default label and mapping for vendor services
Adding the default label/mapping is important because:
1.  Lookups of services without an selinux label should generate
    a denial.
2.  In permissive mode, lookups of a service without a label should be
    be allowed, without the default label service manager disallows
    access.
3.  We can neverallow use of the default label.

Bug: 37762790
Test: Build and flash policy onto Marlin with unlabeled vendor services.
    Add/find of unlabeled vendor services generate a denial.

Change-Id: I66531deedc3f9b79616f5d0681c87ed66aca5b80
2017-04-28 14:00:10 -07:00
Jaekyun Seok
a8c23ee1ee Merge "Allow installd to read vendor_overlay_file" into oc-dev am: 9829506c25
am: 59be4ad535

Change-Id: I67c7b07a91f117870b104bc917206fda9423715f
2017-04-26 22:16:29 +00:00
Jaekyun Seok
59be4ad535 Merge "Allow installd to read vendor_overlay_file" into oc-dev
am: 9829506c25

Change-Id: I7a05cbb58ebbe4d23c9fc13ef429b444301a912e
2017-04-26 22:04:31 +00:00
TreeHugger Robot
9829506c25 Merge "Allow installd to read vendor_overlay_file" into oc-dev 2017-04-26 21:50:16 +00:00
Nick Kralevich
0671abc35f Merge "relax fuse_device neverallow rules" into oc-dev am: c78db706d4
am: 7acd15174a

Change-Id: Ib7b56576f037048614998e655b0b6a9ca5f71a02
2017-04-26 21:44:09 +00:00
Nick Kralevich
7acd15174a Merge "relax fuse_device neverallow rules" into oc-dev
am: c78db706d4

Change-Id: I7b866f588980ebb068629e326155976629bf2223
2017-04-26 21:23:03 +00:00
TreeHugger Robot
c78db706d4 Merge "relax fuse_device neverallow rules" into oc-dev 2017-04-26 21:12:56 +00:00
Nick Kralevich
45766d4178 relax fuse_device neverallow rules
The fuse_device neverallow rules are too aggressive and are inhibiting
certain vendor customizations. Relax the /dev/fuse neverallow rules so
that they better reflect the security invariants we want to uphold.

Bug: 37496487
Test: policy compiles.
Change-Id: Ie73b0ba7c76446afc2a7a23ebed1275c977d932d
2017-04-26 11:43:40 -07:00
Daniel Nicoara
3818e4f528 Merge "Remove rules blocking vrcore_app to connect to VR HWC and VirtualTouchpad" into oc-dev am: a5647da327
am: 8784e1e738

Change-Id: Ie065c69ad1c0b97265d9cb1f520902fc19d27f6c
2017-04-26 18:24:21 +00:00
Daniel Nicoara
8784e1e738 Merge "Remove rules blocking vrcore_app to connect to VR HWC and VirtualTouchpad" into oc-dev
am: a5647da327

Change-Id: I502e43626fd430da68f2a149704dafac024b3cc9
2017-04-26 18:05:11 +00:00
TreeHugger Robot
a5647da327 Merge "Remove rules blocking vrcore_app to connect to VR HWC and VirtualTouchpad" into oc-dev 2017-04-26 17:53:36 +00:00
Alex Klyubin
95c431d425 Merge "Assert ban on framework <-> vendor comms over VndBinder" into oc-dev am: a9d7b895da
am: cdcfb552ee

Change-Id: Ifdcd2bb2bb5bc8168951dcb0039ee7e543984015
2017-04-26 04:54:52 +00:00
Alex Klyubin
cdcfb552ee Merge "Assert ban on framework <-> vendor comms over VndBinder" into oc-dev
am: a9d7b895da

Change-Id: I040a1874e3a08510d9b7c9a107a149845dd1976c
2017-04-26 04:51:44 +00:00
Alex Klyubin
00657834b8 Assert ban on framework <-> vendor comms over VndBinder
This adds neverallow rules which enforce the prohibition on
communication between framework and vendor components over VendorBinder.
This prohibition is similar in spirit to the one for Binder
communications.

Most changes consist of adding neverallow rules, which do not affect
runtime behavior. The only change which does affect runtime behavior
is the change which takes away the right of servicemanager domain to
transfer Binder tokens to hwservicemanager and vndservicemanager. This
grant was there by accident (because it was overly broad) and is not
expected to be needed: servicemanager, hwservicemanager, and
vndservicemanager are not supposed to be communicating with each
other.

P. S. The new neverallow rules in app_neverallows.te are covered by
the new rules in domain.te. The rules were nevertheless added to
app_neverallows.te for consistency with other *Binder rules there.

Test: mmm system/sepolicy
Bug: 37663632
Change-Id: I7c2ae23924bf0f2fed3f1e3a8d4d603129286329
2017-04-25 14:15:52 -07:00
Alex Klyubin
18152ddc4f Assert apps can access only approved HwBinder services am: 2a7f4fb069
am: 7b021be44b

Change-Id: I0e93aecc3b40a3d00bfdea354fe9a4987b28fabb
2017-04-24 22:57:22 +00:00
Alex Klyubin
7b021be44b Assert apps can access only approved HwBinder services
am: 2a7f4fb069

Change-Id: Ia77557e2ef5aa124cb0d4a9e5f05300005a97bfd
2017-04-24 21:06:22 +00:00
Alex Klyubin
2a7f4fb069 Assert apps can access only approved HwBinder services
App domains which host arbitrary code must not have access to
arbitrary HwBinder services. Such access unnecessarily increases the
attack surface. The reason is twofold:
1. HwBinder servers do not perform client authentication because HIDL
   currently does not expose caller UID information and, even if it
   did, many HwBinder services either operate at a layer below that of
   apps (e.g., HALs) or must not rely on app identity for
   authorization. Thus, to be safe, the default assumption is that
   a HwBinder service treats all its clients as equally authorized to
   perform operations offered by the service.
2. HAL servers (a subset of HwBinder services) contain code with
   higher incidence rate of security issues than system/core
   components and have access to lower layes of the stack (all the way
   down to hardware) thus increasing opportunities for bypassing the
   Android security model.

HwBinder services offered by core components (as opposed to vendor
components) are considered safer because of point #2 above.

Always same-process aka always-passthrough HwBinder services are
considered safe for access by these apps. This is because these HALs
by definition do not offer any additional access beyond what its
client already as, because these services run in the process of the
client.

This commit thus introduces these two categories of HwBinder services
in neverallow rules.

Test: mmm system/sepolicy -- this does not change on-device policy
Bug: 34454312
Change-Id: I4f5f4dd10b3fc3bb9d262dda532d4a23dcdf061d
2017-04-24 10:15:31 -07:00
Alex Klyubin
fa57d41538 Tighten isolated_app -> *Binder policy
* isolated_app is no longer permitted to access /dev/hwbinder -- this
  was granted by mistake.
* There are now neverallows which enforce that isolated_app can't
  access HwBinder and VendorBinder.
* There are now neverallows which enforce that isolated_app can't add
  Binder and VendorBinder services to servicemanager and
  vndservicemanager.

Test: mmm system/sepolicy
Bug: 34454312
Change-Id: I8ba90a0dcb6a9fccd8f50c78cbd2409381376f7a
2017-04-21 18:09:01 -07:00
Alex Klyubin
f1b7fc2106 Merge "Restrict access to hwservicemanager" into oc-dev
am: 7dace9ae1d

Change-Id: I1cee56f20312833ba50a00a1a75331ce53aa2978
2017-04-21 19:18:29 +00:00
Alex Klyubin
53656c1742 Restrict access to hwservicemanager
This adds fine-grained policy about who can register and find which
HwBinder services in hwservicemanager.

Test: Play movie in Netflix and Google Play Movies
Test: Play video in YouTube app and YouTube web page
Test: In Google Camera app, take photo (HDR+ and conventional),
      record video (slow motion and normal), and check that photos
      look fine and videos play back with sound.
Test: Cast screen to a Google Cast device
Test: Get location fix in Google Maps
Test: Make and receive a phone call, check that sound works both ways
      and that disconnecting the call frome either end works fine.
Test: Run RsHelloCompute RenderScript demo app
Test: Run fast subset of media CTS tests:
      make and install CtsMediaTestCases.apk
      adb shell am instrument -e size small \
          -w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner'
Test: Play music using Google Play music
Test: Adjust screen brightness via the slider in Quick Settings
Test: adb bugreport
Test: Enroll in fingerprint screen unlock, unlock screen using
      fingerprint
Test: Apply OTA update:
      Make some visible change, e.g., rename Settings app.
      make otatools && \
      make dist
      Ensure device has network connectivity
      ota_call.py -s <serial here> --file out/dist/sailfish-ota-*.zip
      Confirm the change is now live on the device
Bug: 34454312
(cherry picked from commit 632bc494f1)
Merged-In: Iecf74000e6c68f01299667486f3c767912c076d3
Change-Id: I7a9a487beaf6f30c52ce08e04d415624da49dd31
2017-04-21 09:54:53 -07:00
Jaekyun Seok
aeada24741 Allow installd to read vendor_overlay_file
installd needs to check whether idmap is outdated or not compared to
vendor overlay file.

Test: building succeeded and tested on sailfish.
Bug: 37179531
Change-Id: I934c1ae39e3f806bca1e3d68cf8190addeebb499
2017-04-21 09:39:11 +09:00
Jeff Vander Stoep
73165a3dce Merge "Only the bluetooth app may run in the bluetooth domain" am: 35fd321234 am: fad5038197 am: 20fa3aefe1
am: a990e5fc2a

Change-Id: I4fe0c1091b25d7510c2d2788eddde83609f3e1c7
2017-04-21 00:10:44 +00:00
Jeff Vander Stoep
a990e5fc2a Merge "Only the bluetooth app may run in the bluetooth domain" am: 35fd321234 am: fad5038197
am: 20fa3aefe1

Change-Id: I3f031cdd2d9f44b1154156383b13e1681aeefc2c
2017-04-20 23:56:58 +00:00
Alex Klyubin
632bc494f1 Restrict access to hwservicemanager
This adds fine-grained policy about who can register and find which
HwBinder services in hwservicemanager.

Test: Play movie in Netflix and Google Play Movies
Test: Play video in YouTube app and YouTube web page
Test: In Google Camera app, take photo (HDR+ and conventional),
      record video (slow motion and normal), and check that photos
      look fine and videos play back with sound.
Test: Cast screen to a Google Cast device
Test: Get location fix in Google Maps
Test: Make and receive a phone call, check that sound works both ways
      and that disconnecting the call frome either end works fine.
Test: Run RsHelloCompute RenderScript demo app
Test: Run fast subset of media CTS tests:
      make and install CtsMediaTestCases.apk
      adb shell am instrument -e size small \
          -w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner'
Test: Play music using Google Play music
Test: Adjust screen brightness via the slider in Quick Settings
Test: adb bugreport
Test: Enroll in fingerprint screen unlock, unlock screen using
      fingerprint
Test: Apply OTA update:
      Make some visible change, e.g., rename Settings app.
      make otatools && \
      make dist
      Ensure device has network connectivity
      ota_call.py -s <serial here> --file out/dist/sailfish-ota-*.zip
      Confirm the change is now live on the device
Bug: 34454312
Change-Id: Iecf74000e6c68f01299667486f3c767912c076d3
2017-04-20 14:45:21 -07:00
Daniel Nicoara
5227638394 Remove rules blocking vrcore_app to connect to VR HWC and VirtualTouchpad
Bug: 37542947
Test: Compiled and ran on device to ensure no access errors while in VR
Change-Id: Ia685676d82f1f10f2bd371a13879d00fe63a9ea6
2017-04-20 16:45:58 -04: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
TreeHugger Robot
c14625042c Merge "Sepolicy: Fix asanwrapper" 2017-04-20 01:23:06 +00:00
Andreas Gampe
c848d37d5a Sepolicy: Fix asanwrapper
Add asanwrapper support for system server under sanitization.

Bug: 36138508
Test: m && m SANITIZE_TARGET=address SANITIZE_LITE=true
Test: adb root && adb shell setprop wrap.system_server asanwrapper
Change-Id: Id930690d2cfd8334c933e0ec5ac62f88850331d0
2017-04-19 16:33:45 -07:00
Dan Cashman
fe02a4ee48 Remove vndservice_manager object classes.
vndservicemanager is a copy of servicemanager, and so has the exact
same properties.  This should be reflected in the sharing of an object
manager in SELinux policy, rather than creating a second one, which is
effectively an attempt at namespacing based on object rather than type
labels.  hwservicemanager, however, provides different and additional
functionality that may be reflected in changed permissions, though they
currently map to the existing servicemanager permissions.  Keep the new
hwservice_manager object manager but remove the vndservice_manager one.

(preemptive cherry-pick of commit: 2f1c7ba75e
to avoid merge conflict)

Bug: 34454312
Bug: 36052864
Test: policy builds and device boots.
Change-Id: I9e0c2757be4026101e32ba780f1fa67130cfa14e
2017-04-19 16:49:33 +00:00
Dan Cashman
2f1c7ba75e Remove vndservice_manager object classes.
vndservicemanager is a copy of servicemanager, and so has the exact
same properties.  This should be reflected in the sharing of an object
manager in SELinux policy, rather than creating a second one, which is
effectively an attempt at namespacing based on object rather than type
labels.  hwservicemanager, however, provides different and additional
functionality that may be reflected in changed permissions, though they
currently map to the existing servicemanager permissions.  Keep the new
hwservice_manager object manager but remove the vndservice_manager one.

Bug: 34454312
Bug: 36052864
Test: policy builds and device boots.
Change-Id: I9e0c2757be4026101e32ba780f1fa67130cfa14e
2017-04-18 12:40:44 -07:00
Sandeep Patil
b99676eece Add vendor_executes_system_violators attribute
Temporary attribute (checked against in CTS) to point out vendor
processes that run /system executables. These are currently only down to
2-3 of them that are related to telephony on sailfish

Bug: 36463595
Test: Build succeeds for sailfish
Test: ./cts-tradefed run cts -m CtsSecurityHostTestCases -t \
          android.security.cts.SELinuxHostTest#testNoExemptionsForVendorExecutingCore \
          --skip-device-info --skip-preconditions --skip-connectivity-check \
          --abi arm64-v8a

Change-Id: I9eb40ad259aefba73869d6a1b40186d33fa475dd
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-04-14 22:57:30 -07:00
Sandeep Patil
c6d8902453 add netutils_wrappers
Bug: 36463595
Test: Boot sailfish, make wifi call, internet over data and wifi

Change-Id: I81259b6412d7197725afe2fe4976aa0a03b8df6e
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-04-14 22:57:27 -07:00
TreeHugger Robot
e9e11a795b Merge changes from topic 'add_vendor_shell_toybox' into oc-dev
* changes:
  suppress audit logs from rild's access to core domain through system()
  sepolicy: auditallow vendor components to execute files from /system
  vendor_shell: add sepolicy for vendor shell
  toolbox: add sepolicy for vendor toybox
  Do not allow priv_apps to scan all exec files
2017-04-14 20:53:51 +00:00
Alex Klyubin
20c2d4e98c Remove unnecessary attributes
Test: mmm system/sepolicy
Bug: 34980020

(cherry picked from commit 3cc6a95944)

Change-Id: I64c7275551e8e27d68072e8ec38c07b539989da0
2017-04-14 09:39:19 -07:00
Sandeep Patil
7bbf7a6ec2 suppress audit logs from rild's access to core domain through system()
Change-Id: Ic9a9026df6f36d65fa02cc7b264bc901a14546f9
Signed-off-by: Sandeep Patil <sspatil@google.com>
2017-04-14 09:38:53 -07:00