Skip to content
Snippets Groups Projects
  1. Oct 29, 2018
    • Nick Kralevich's avatar
      Enforce execve() restrictions for API > 28 · 0dd738d8
      Nick Kralevich authored
      untrusted_app: Remove the ability to run execve() on files within an
      application's home directory. Executing code from a writable /home
      directory is a W^X violation (https://en.wikipedia.org/wiki/W%5EX).
      Additionally, loading code from application home directories violates a
      security requirement that all executable code mapped into memory must
      come from signed sources, or be derived from signed sources.
      
      Note: this change does *not* remove the ability to load executable code
      through other mechanisms, such as mmap(PROT_EXEC) of a file descriptor
      from the app's home directory. In particular, functionality like
      dlopen() on files in an app's home directory continues to work even
      after this change.
      
      untrusted_app_25 and untrusted_app_27: For backwards compatibility,
      continue to allow these domains to execve() files from the
      application's home directory.
      
      seapp_contexts: Bump the minimum API level required to enter the
      untrusted_app domain. This will run API level 27-28 processes in
      the API level 27 sandbox. API level 28 will continue to run with
      levelFrom=all, and API level 27 will continue to run with
      levelFrom=user.
      
      Bug: 112357170
      Test: Device boots and no obvious problems.
      Test: See CTS test at https://android-review.googlesource.com/c/platform/cts/+/804228
      Change-Id: Ief9ae3a227d16ab5792f43bacbb577c1e70185a0
      0dd738d8
  2. Oct 11, 2018
    • Tri Vo's avatar
      Constrain cgroups access. · f55c989d
      Tri Vo authored
      What changed:
      - Removed cgroup access from untrusted and priv apps.
      - Settings app writes to /dev/stune/foreground/tasks, so system_app domain
      retains access to cgroup.
      - libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used
      abundantly in native code. So added a blanket allow rule for (coredomain - apps)
      to access cgroups.
      - For now, only audit cgroup access from vendor domains. Ultimately, we want to
      either constrain vendor access to individual domains or, even better, remove
      vendor access and have platform manage cgroups exclusively.
      
      Changes from original aosp/692189 which was reverted:
      - There seem to be spurious denials from vendor-specific apps. So added
      back access from { appdomain -all_untrusted_apps -priv_app } to cgroup.
      Audit this access with intent to write explicit per-domain rules for it.
      
      Bug: 110043362
      Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates
      /dev/memcg on a per app basis on a device that supports that.
      Test: aosp_sailfish, wahoo boot without cgroup denials
      This reverts commit cacea25e.
      Change-Id: I05ab404f348a864e8409d811346c8a0bf49bc47a
      f55c989d
  3. Oct 10, 2018
    • Nick Kralevich's avatar
      Revert "Constrain cgroups access." · cacea25e
      Nick Kralevich authored
      This reverts commit 9899568f.
      
      Reason for revert: Reports of high numbers of SELinux denials
      showing up on the SELinux dashboard.
      
      Bug: 110043362
      Change-Id: Id8fc260c47ffd269ac2f15ff7dab668c959e3ab0
      cacea25e
  4. Oct 09, 2018
    • Tri Vo's avatar
      Constrain cgroups access. · 9899568f
      Tri Vo authored
      What changed:
      - Removed cgroup access from untrusted and priv apps.
      - Settings app writes to /dev/stune/foreground/tasks, so system_app domain
      retains access to cgroup.
      - libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used
      abundantly in native code. So added a blanket allow rule for (coredomain - apps)
      to access cgroups.
      - For now, only audit cgroup access from vendor domains. Ultimately, we want to
      either constrain vendor access to individual domains or, even better, remove
      vendor access and have platform manage cgroups exclusively.
      
      Bug: 110043362
      Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates
      /dev/memcg on a per app basis on a device that supports that.
      Test: aosp_sailfish, wahoo boot without cgroup denials
      Change-Id: I9e441b26792f1edb1663c660bcff422ec7a6332b
      9899568f
  5. Sep 27, 2018
  6. Sep 07, 2018
  7. Sep 04, 2018
    • Jeff Vander Stoep's avatar
      app: Allow all apps to read dropbox FDs · 6026a4ad
      Jeff Vander Stoep authored
      DropboxManager may pass FDs to any app with the READ_LOGS
      permission which is available to all apps as a development
      permission.
      
      Test: atest CtsIncidentHostTestCases
      Fixes: 111856304
      Change-Id: I329e3125dab83de948b860061df9d232e31cb23e
      6026a4ad
  8. Aug 21, 2018
    • Tri Vo's avatar
      Rename untrusted_app_visible_*' to include 'violators'. · 7f8b6cc6
      Tri Vo authored
      Bug: 110887137
      Test: Flash new system policy onto a device with vendor policy that uses
      untrusted_app_visible_* attributes, and check that old and new attributes
      are applied to exactly same types.
      Change-Id: Ibee0ec645878fcc8c93cd0fbd169a8d45129d79e
      Merged-In: Ibee0ec645878fcc8c93cd0fbd169a8d45129d79e
      (cherry picked from commit 7abca51d)
      7f8b6cc6
  9. Aug 06, 2018
  10. Aug 02, 2018
    • Nick Kralevich's avatar
      Start partitioning off privapp_data_file from app_data_file · 23c9d91b
      Nick Kralevich authored
      Currently, both untrusted apps and priv-apps use the SELinux file label
      "app_data_file" for files in their /data/data directory. This is
      problematic, as we really want different rules for such files. For
      example, we may want to allow untrusted apps to load executable code
      from priv-app directories, but disallow untrusted apps from loading
      executable code from their own home directories.
      
      This change adds a new file type "privapp_data_file". For compatibility,
      we adjust the policy to support access privapp_data_files almost
      everywhere we were previously granting access to app_data_files
      (adbd and run-as being exceptions). Additional future tightening is
      possible here by removing some of these newly added rules.
      
      This label will start getting used in a followup change to
      system/sepolicy/private/seapp_contexts, similar to:
      
        -user=_app isPrivApp=true domain=priv_app type=app_data_file levelFrom=user
        +user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
      
      For now, this newly introduced label has no usage, so this change
      is essentially a no-op.
      
      Test: Factory reset and boot - no problems on fresh install.
      Test: Upgrade to new version and test. No compatibility problems on
            filesystem upgrade.
      
      Change-Id: I9618b7d91d1c2bcb5837cdabc949f0cf741a2837
      23c9d91b
  11. Jul 18, 2018
    • Todd Poynor's avatar
      remove thermalcallback_hwservice · c3e9ff90
      Todd Poynor authored
      This hwservice isn't registered with hwservicemanager but rather passed
      to the thermal hal, so it doesn't need sepolicy associated with it to
      do so.
      
      Test: manual: boot, inspect logs
      Test: VtsHalThermalV1_1TargetTest
      Bug: 109802374
      Change-Id: Ifb727572bf8eebddc58deba6c0ce513008e01861
      Merged-In: Ifb727572bf8eebddc58deba6c0ce513008e01861
      (cherry picked from commit c6afcb7f)
      c3e9ff90
  12. Jun 29, 2018
    • Todd Poynor's avatar
      remove thermalcallback_hwservice · c6afcb7f
      Todd Poynor authored
      This hwservice isn't registered with hwservicemanager but rather passed
      to the thermal hal, so it doesn't need sepolicy associated with it to
      do so.
      
      Test: manual: boot, inspect logs
      Test: VtsHalThermalV1_1TargetTest
      Bug: 109802374
      Change-Id: Ifb727572bf8eebddc58deba6c0ce513008e01861
      Merged-In: Ifb727572bf8eebddc58deba6c0ce513008e01861
      c6afcb7f
  13. Jun 22, 2018
    • Jeff Vander Stoep's avatar
      Update socket ioctl restrictions · 0597ade1
      Jeff Vander Stoep authored
      Grant access to icmp_socket to netdomain. This was previously
      labeled as rawip_socket which apps are allowed to use. Neverallow
      all other new socket types for apps.
      
      Kernels versions > 4.9 redefine ICMP sockets from rawip_socket
      to icmp_socket. To pass neverallow tests, we need to define
      which IOCTLs are allowed (and disallowed).
      
      Note that this does not change behavior on devices with
      kernel versions <=4.9. However, it is necessary (although not
      sufficient) to pass CTS on kernel version 4.14.
      
      Bug: 110520616
      Test: Grant icmp_socket in net.te and build.
      Change-Id: I5c7cb6867d1a4cd1554a8da0d55daa8e06daf803
      0597ade1
  14. Jun 14, 2018
    • Mark Salyzyn's avatar
      access to /proc/slabinfo · d6eaed85
      Mark Salyzyn authored
      init, dumpstate and shell
      
      Test: check avc for init is now gone
      Bug: 7232205
      Bug: 109821005
      Change-Id: I299a0ba29bcc97a97047f12a5c48f6056f5e6de5
      d6eaed85
  15. May 30, 2018
    • Steven Moreland's avatar
      mediacodec->mediacodec+hal_omx{,_server,_client} · 7baf725e
      Steven Moreland authored
      (breaks vendor blobs, will have to be regenerated
      after this CL)
      
      This moves mediacodec to vendor so it is replaced with
      hal_omx_server. The main benefit of this is that someone
      can create their own implementation of mediacodec without
      having to alter the one in the tree. mediacodec is still
      seccomp enforced by CTS tests.
      
      Fixes: 36375899
      Test: (sanity) YouTube
      Test: (sanity) camera pics + video
      Test: check for denials
      Change-Id: I31f91b7ad6cd0a891a1681ff3b9af82ab400ce5e
      7baf725e
  16. May 04, 2018
  17. Apr 18, 2018
    • Jeff Vander Stoep's avatar
      Protect dropbox service data with selinux · 4d3ee1a5
      Jeff Vander Stoep authored
      Create a new label for /data/system/dropbox, and neverallow direct
      access to anything other than init and system_server.
      
      While all apps may write to the dropbox service, only apps with
      android.permission.READ_LOGS, a signature|privileged|development
      permission, may read them. Grant access to priv_app, system_app,
      and platform_app, and neverallow access to all untrusted_apps.
      
      Bug: 31681871
      Test: atest CtsStatsdHostTestCases
      Test: atest DropBoxTest
      Test: atest ErrorsTests
      Change-Id: Ice302b74b13c4d66e07b069c1cdac55954d9f5df
      4d3ee1a5
  18. Apr 16, 2018
    • Jeff Sharkey's avatar
      Add exFAT support; unify behind "sdcard_type". · b469c300
      Jeff Sharkey authored
      We're adding support for OEMs to ship exFAT, which behaves identical
      to vfat.  Some rules have been manually enumerating labels related
      to these "public" volumes, so unify them all behind "sdcard_type".
      
      Test: atest
      Bug: 67822822
      Change-Id: I09157fd1fc666ec5d98082c6e2cefce7c8d3ae56
      b469c300
  19. Apr 13, 2018
    • Jeff Sharkey's avatar
      Add exFAT support; unify behind "sdcard_type". · 000cafc7
      Jeff Sharkey authored
      We're adding support for OEMs to ship exFAT, which behaves identical
      to vfat.  Some rules have been manually enumerating labels related
      to these "public" volumes, so unify them all behind "sdcard_type".
      
      Test: atest
      Bug: 67822822
      Change-Id: I09157fd1fc666ec5d98082c6e2cefce7c8d3ae56
      000cafc7
  20. Apr 03, 2018
    • Jeff Vander Stoep's avatar
      Add untrusted_app_27 · 3aa7ca56
      Jeff Vander Stoep authored
      This is a partial cherry pick of commit 6231b4d9
      'Enforce per-app data protections for targetSdk 28+'.
      
      Untrusted_app_27 remains unreachable, but it's existence
      prevents future merge conflicts.
      
      Bug: 63897054
      Test: build/boot aosp_walleye-userdebug
      Change-Id: I64b013874fe87b55f47e817a1279e76ecf86b7c0
      Merged-In: I64b013874fe87b55f47e817a1279e76ecf86b7c0
      (cherry picked from commit 6231b4d9)
      3aa7ca56
  21. Mar 29, 2018
    • Jeff Vander Stoep's avatar
      Improve neverallows on /proc and /sys · 3079d01a
      Jeff Vander Stoep authored
      Access to these files was removed in Oreo. Enforce that access is not
      granted by partners via neverallow rule.
      
      Also disallow most untrusted app access to net.dns.* properties.
      
      Bug: 77225170
      Test: system/sepolicy/tools/build_policies.sh
      Change-Id: I85b634af509203393dd2d9311ab5d30c65f157c1
      (cherry picked from commit 886aa54b)
      3079d01a
    • Pawin Vongmasa's avatar
      Put in sepolicies for Codec2.0 services · 4be28894
      Pawin Vongmasa authored
      Test: Builds
      
      Bug: 64121714
      Bug: 31973802
      Change-Id: Id37be8726a8bb297e35bca494964fdbcc48c6a73
      4be28894
  22. Mar 28, 2018
    • Jeff Vander Stoep's avatar
      Improve neverallows on /proc and /sys · 886aa54b
      Jeff Vander Stoep authored
      Access to these files was removed in Oreo. Enforce that access is not
      granted by partners via neverallow rule.
      
      Also disallow most untrusted app access to net.dns.* properties.
      
      Bug: 77225170
      Test: system/sepolicy/tools/build_policies.sh
      Change-Id: I85b634af509203393dd2d9311ab5d30c65f157c1
      886aa54b
  23. Feb 05, 2018
  24. Jan 29, 2018
  25. Jan 24, 2018
  26. Jan 23, 2018
  27. Jan 18, 2018
    • Jeff Vander Stoep's avatar
      Enforce per-app data protections for targetSdk 28+ · 6231b4d9
      Jeff Vander Stoep authored
      Adds per-app categories to untrusted app domains and their
      app data types. Per-app categories are in addition to the
      existing per-user categories.
      
      Apps targeting sdk version 28+ will now have the following
      characteristics:
      Domain: u:r:untrusted_app:s0:c[0-9]+,c[0-9]+,c[0-9],c[0-9]
      Data context: u:object_r:app_data_file:s0:c[0-9]+,c[0-9]+,c[0-9],c[0-9]
      
      Whereas apps targeting 27- will look like:
      Domain: u:r:untrusted_app_27:s0:c[0-9]+,c[0-9]+
      Data context: u:object_r:app_data_file:s0:c[0-9]+,c[0-9]+
      
      To ensure backwards compatibility with previous SDK versions,
      the levelFrom=all now enforces categories by dominance instead of
      equality. Apps with per-app and per-user categories will continue
      to have selinux permissions (but not necessarily unix permissions)
      to access app data with only per-user categories, but apps with only
      per-user categories will not be able to access the data of apps with
      both per-app and per-user categories.
      
      Bug: 63897054
      Test: Boot sailfish, run apps, verify no new selinux denials.
      Test: cts-tradefed run cts -m CtsSelinuxTargetSdkCurrentTestCases
      Test: cts-tradefed run cts -m CtsSelinuxTargetSdk27TestCases
      Test: cts-tradefed run cts -m CtsSelinuxTargetSdk25TestCases
      Test: adb sideload an OTA and verify that files are correctly labeled.
      Change-Id: I64b013874fe87b55f47e817a1279e76ecf86b7c0
      6231b4d9
  28. Jan 16, 2018
    • Michael Butler's avatar
      Allow applications to use NN API HAL services · ea331aa7
      Michael Butler authored
      The NeuralNetworks runtime is a library that communicates with
      NeuralNetworks HIDL services and is linked by applications. To enable
      the NN runtime to use these services, applications must have explicit
      sepolicy permissions to find the NN services and communicate across
      binder.
      
      This CL relaxes neverallow rules for hal_neuralnetworks_*.
      
      Because it is affecting pre-existing neverallow rules, this CL requires
      a CTS rebuild.
      
      Bug: 70340780
      Test: mm
      Test: ran neuralnetworks vts and cts binaries
      Change-Id: I84f73ac77486681f91d1f8687268c0fa22a7ba0b
      (cherry picked from commit 598870bebc4bb34542df81799b46f3cdcfb6723b)
      ea331aa7
  29. Jan 10, 2018
  30. Dec 12, 2017
    • Marissa Wall's avatar
      Restrict access to uid_concurrent_*_time · 80ee23f7
      Marissa Wall authored
      Do not let apps read uid_concurrent_active_time and
      uid_concurrent_policy_time.
      
      b/68399339
      
      Test: Check that they can't be read from the shell
          without root permissions and system_server was able
          to read them
      
      Change-Id: I6f09ef608607cb9f4084ba403a1e7254b8c49a06
      80ee23f7
  31. Oct 12, 2017
  32. Oct 06, 2017
    • Tri Vo's avatar
      Extend access to proc/asound/* · 464f59ae
      Tri Vo authored
      Renamed this type:
      proc_asound_cards -> proc_asound
      
      Labeled /proc/asound/devices as proc_asound.
      
      We now use proc_asound type to label files under /proc/asound which we
      want to expose to system components.
      
      Bug: 66988327
      Test: Pixel 2 boots, can play sound with or without headphones, and
      selinux denials to proc_asound are not seen.
      
      Change-Id: I453d9bfdd70eb80931ec9e80f17c8fd0629db3d0
      464f59ae
  33. Sep 28, 2017
  34. Sep 27, 2017
    • Dan Cashman's avatar
      Fix build. Split mediaprovider from priv_app. · 3e21c5f1
      Dan Cashman authored
      This CL was accidentally reverted a second time by commit:
      cb5129f9.  Submit it for the third,
      and final, time.
      
      (cherry-pick of 5637587d
      which was in AOSP and internal master but not stage-aosp-master)
      
      Bug: 62102757
      Test: Builds and boots.
      Change-Id: I0394907e808c737422e644aec452baa3e777cf6f
      3e21c5f1
  35. Sep 26, 2017
  36. Sep 20, 2017
    • Tri Vo's avatar
      Explicitly label filesystem files in /proc · 62f2842c
      Tri Vo authored
      proc files needed by fwk that were labeled:
      /proc/filesystems -> proc_filesystems
      /proc/mounts -> proc_mounts
      /proc/swaps -> proc_mounts
      
      Removed access to proc label from these domains:
      e2fs, fsck, fsck_untrusted, sdcardd
      
      e2fs: added access to proc_filesystems, proc_mounts, proc_swaps
      fsck: added access to proc_mounts, proc_swaps
      fsck_untrusted: added access to proc_mounts
      sdcardd: added access to proc_filesystems
      vold: added access to proc_filesystems, proc_mounts
      
      Bug: 66199084
      Test: device boots without selinux denials to new labels or proc label.
      Change-Id: If0f19e22074419dab0b3a0c6f3a300ea8cb94523
      62f2842c
  37. Sep 19, 2017
    • Tri Vo's avatar
      Explicitly label system_server's dependencies in /proc · 8c2323d3
      Tri Vo authored
      Labeled:
      /proc/asound/cards -> proc_asound_cards
      /proc/loadavg -> proc_loadavg
      /proc/pagetypeinfo -> proc_pagetypeinfo
      /proc/version -> proc_version
      /proc/vmallocinfo -> proc_vmallocinfo
      
      system_server: added access to all new types  and removed access to proc label.
      init: added access to proc_version.
      dumpstate: added access to proc_pagetypeinfo, proc_version,
      proc_vmallocinfo.
      hal_audio: added access to proc_asound_cards.
      all_untrusted_apps: extended neverallow rule to include new labels.
      
      Bug: 65980789
      Test: device boots without selinux denials to the newly introduced
      labels.
      Test: "adb shell dumpstate" throws no violations to new labels.
      Change-Id: Ic60facd3d4776e38d5e3ba003d06ada4e52c7dca
      8c2323d3
  38. Aug 17, 2017
Loading