Skip to content
Snippets Groups Projects
  1. 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
  2. Oct 08, 2018
  3. Oct 04, 2018
    • Martijn Coenen's avatar
      Add policy for apexd. · ac097ac4
      Martijn Coenen authored
      apexd is a new daemon for managing APEX packages installed
      on the device. It hosts a single binder service, "apexservice".
      
      Bug: 112455435
      Test: builds, binder service can be registered,
            apexes can be accessed, verified and mounted
      Change-Id: I634ad100f10b2edcd9a9c0df0d33896fa5d4ed97
      ac097ac4
  4. Sep 27, 2018
    • Nick Kralevich's avatar
      Introduce system_file_type · 5e37271d
      Nick Kralevich authored
      system_file_type is a new attribute used to identify files which exist
      on the /system partition. It's useful for allow rules in init, which are
      based off of a blacklist of writable files. Additionally, it's useful
      for constructing neverallow rules to prevent regressions.
      
      Additionally, add commented out tests which enforce that all files on
      the /system partition have the system_file_type attribute. These tests
      will be uncommented in a future change after all the device-specific
      policies are cleaned up.
      
      Test: Device boots and no obvious problems.
      Change-Id: Id9bae6625f042594c8eba74ca712abb09702c1e5
      5e37271d
    • Nick Kralevich's avatar
      Label /system/usr/share/zoneinfo differently · ff1c765f
      Nick Kralevich authored
      /system/usr/share/zoneinfo is currently labeled zoneinfo_data_file,
      a label shared with /data/misc/zoneinfo. However, each of these
      directory locations has different security characteristics. In
      particular, the files in /system/usr/share/zoneinfo must never be
      writable, whereas /data/misc/zoneinfo may be written to by system_server.
      Reusing the same label hides these different security characteristics.
      
      Create a separate label for /system/usr/share/zoneinfo.
      
      Test: Device boots and no obvious problems.
      Change-Id: I8cf16ff038b06b38f77388e546d9b7a6865f7879
      ff1c765f
  5. Sep 23, 2018
    • Jeff Vander Stoep's avatar
      Further lock down app data · 0b67bb88
      Jeff Vander Stoep authored
      Assert that only apps and installd may open private app files.
      
      Remove "open" permission for mediaserver/vold and remove their
      neverallow exemption.
      
      Test: verify no related audit messages in the logs.
      Test: build
      Fixes: 80300620
      Fixes: 80418809
      Bug: 80190017
      Change-Id: If0c1862a273af1fedd8898f334c9b0aa6b9be728
      0b67bb88
  6. Sep 20, 2018
    • Tri Vo's avatar
      More granular vendor access to /system files. · 5c1fe61e
      Tri Vo authored
      This change limits global access to /system files down to:
      /system/bin/linker*
      /system/lib[64]/*
      /system/etc/ld.config*
      /system/etc/seccomp_policy/*
      /system/etc/security/cacerts/*
      /system/usr/share/zoneinfo/*
      
      Bug: 111243627
      Test: boot device, browse internet without denials to system_* types.
      Test: VtsHalDrmV1_{1, 0}TargetTest without denials
      Change-Id: I69894b29733979c2bc944ac80229e84de5d519f4
      5c1fe61e
  7. Sep 19, 2018
    • Benjamin Gordon's avatar
      sepolicy: grant dac_read_search to domains with dac_override · 342362ae
      Benjamin Gordon authored
      kernel commit 2a4c22426955d4fc04069811997b7390c0fb858e (fs: switch order
      of CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH checks) swapped the order of
      dac_override and dac_read_search checks.  Domains that have dac_override
      will now generate spurious denials for dac_read_search unless they also
      have that permission.  Since dac_override is a strict superset of
      dac_read_search, grant dac_read_search to all domains that already have
      dac_override to get rid of the denials.
      
      Bug: 114280985
      Bug: crbug.com/877588
      Test: Booted on a device running 4.14.
      Change-Id: I5c1c136b775cceeb7f170e139e8d4279e73267a4
      342362ae
  8. Sep 18, 2018
    • Tri Vo's avatar
      system_writes_mnt_vendor_violators for device launched before P. · ca4217e2
      Tri Vo authored
      In cases when a device upgrades to system-as-root from O to P, it needs a mount
      point for an already existing partition that is accessed by both system and
      vendor.
      
      Devices launching with P must not have /mnt/vendor accessible to system.
      
      Bug: 78598545
      Test: m selinx_policy
      Change-Id: Ia7bcde44e2b8657a7ad9e0d9bae7a7259f40936f
      ca4217e2
  9. Sep 14, 2018
    • Nick Kralevich's avatar
      Strengthen ptrace neverallow rules · 095fbea5
      Nick Kralevich authored
      Add additional compile time constraints on the ability to ptrace various
      sensitive domains.
      
      llkd: remove some domains which llkd should never ptrace, even on
      debuggable builds, such as kernel threads and init.
      
      crash_dump neverallows: Remove the ptrace neverallow checks because
      it duplicates other neverallow assertions spread throughout the policy.
      
      Test: policy compiles and device boots
      Change-Id: Ia4240d1ce7143b983bb048e046bb4729d0af5a6e
      095fbea5
  10. Sep 13, 2018
    • Hridya Valsaraju's avatar
      Allow fastbootd to wipe metadata. · 073efc34
      Hridya Valsaraju authored
      Metadata needs to be erased as part of fastboot flashall -w.
      
      Test: fastboot erase metadata
      Bug: 113648914
      Change-Id: I38a0debd9face16cad9d9a13a48549f3f58652fa
      073efc34
  11. Sep 12, 2018
  12. Sep 11, 2018
    • Martijn Coenen's avatar
      Allow init to use binder. · a720d3d0
      Martijn Coenen authored
      But in a very restricted form:
      1) Nobody can initiate calls into init
      2) Nobody can transfer binder objects into init, except servicemanager
      
      Bug: 112684055
      Test: device boots
      Change-Id: Icfb218f2871e234284c74e096eccd7a2e786cf94
      a720d3d0
  13. Sep 06, 2018
    • Nick Kralevich's avatar
      dumpstate: remove JIT and /data execute · eef72d34
      Nick Kralevich authored
      Not needed for modern Android versions. These rules are really, really
      old.
      
      Test: "adb bugreport" continues to work
      Test: Generating a bugreport via key combo continues to work.
      Change-Id: Ibc1157fb36abd7fc701db3819474f25210a3cb5f
      eef72d34
  14. Sep 04, 2018
    • Mark Salyzyn's avatar
      llkd: Add stack symbol checking · 275ea12d
      Mark Salyzyn authored
      llkd needs the ptrace capabilities and dac override to monitor for
      live lock conditions on the stack dumps.
      
      Test: compile
      Bug: 33808187
      Change-Id: Ibc1e4cc10395fa9685c4ef0ca214daf212a5e126
      275ea12d
  15. Aug 28, 2018
  16. Aug 21, 2018
    • Benjamin Gordon's avatar
      sepolicy: Fix references to self:capability · 7ed266c6
      Benjamin Gordon authored
      commit 9b2e0cbe added a new
      self:global_capability_class_set macro that covers both self:capability
      and self:cap_userns.  Apply the new macro to various self:capability
      references that have cropped up since then.
      
      Bug: 112307595
      Test: policy diff shows new rules are all cap_userns
      Change-Id: I3eb38ef07532a8e693fd549dfdbc4a6df5329609
      7ed266c6
  17. Aug 15, 2018
    • Jerry Zhang's avatar
      Add sepolicy for fastbootd · 1d85efa9
      Jerry Zhang authored
      Also allow adb and fastboot to talk to recovery
      through recovery_socket. This enables changing
      between modes with usb commands.
      
      Test: No selinux denials
      Bug: 78793464
      Change-Id: I80c54d4eaf3b94a1fe26d2280af4e57cb1593790
      1d85efa9
    • Florian Mayer's avatar
      Revert "Add sepolicy for fastbootd" · c2ab15b7
      Florian Mayer authored
      This reverts commit 0fd3ed3b.
      
      Reason for revert: Broke user builds.
      
      Change-Id: If95f1a25d22425a5a2b68a02d1561352fb5a52f0
      c2ab15b7
  18. Aug 14, 2018
    • Steven Moreland's avatar
      Remove old incidentd socket allow. · fa3c138a
      Steven Moreland authored
      Forgotten cleanup item.
      
      Bug: 35870313
      Test: making sepolicy (neverallows resolved at compile time)
      Change-Id: If9a583c4508db63356869502ec374727afa84b0b
      fa3c138a
    • Jerry Zhang's avatar
      Add sepolicy for fastbootd · 0fd3ed3b
      Jerry Zhang authored
      Also allow adb and fastboot to talk to recovery
      through recovery_socket. This enables changing
      between modes with usb commands.
      
      Test: No selinux denials
      Bug: 78793464
      Change-Id: I1f97659736429fe961319c642f458c80f199ffb4
      0fd3ed3b
  19. Aug 11, 2018
    • Tri Vo's avatar
      neverallow fwk access to /vendor · 44b7d5b8
      Tri Vo authored
      This rule prevents adding further fwk->vendor access.
      Left a TODO to clean up already existing access.
      
      Bug: 37168747
      Test: build sailfish, walleye policies
      Change-Id: I5e61d0b94b81df228628dba5746e084f291a7904
      44b7d5b8
  20. Aug 08, 2018
    • Nick Kralevich's avatar
      Remove legacy execmod access from API >= 26. · f3eb9854
      Nick Kralevich authored
      Text relocation support was removed from the linker for apps targeting
      API >= 23. See
      https://android.googlesource.com/platform/bionic/+/master/android-changes-for-ndk-developers.md#text-relocations-enforced-for-api-level-23
      
      However, the security policy was not updated to remove the execmod
      permission at that time, since we didn't have support for targeting
      SELinux policies to API versions.
      
      Remove execmod permissions for apps targeting API 26 or greater. The
      linker support was removed, so it's pointless to keep around the SELinux
      permissions.
      
      Retain execmod support for apps targeting API 25 or lower. While in
      theory we could remove support for API 23-25, that would involve the
      introduction of a new SELinux domain (and the associated rule
      explosion), which I would prefer to avoid.
      
      This change helps protect application executable code from modification,
      enforcing W^X properties on executable code pages loaded from files.
      https://en.wikipedia.org/wiki/W%5EX
      
      Test: auditallow rules were added and nothing triggered for apps
            targeting API >= 26. Code compiles and device boots.
      Bug: 111544476
      
      Change-Id: Iab9a0bd297411e99699e3651c110e57eb02a3a41
      f3eb9854
  21. Aug 07, 2018
    • Tri Vo's avatar
      Add support for RS vendor executables. · dd253e90
      Tri Vo authored
      /vendor/bin/bcc being a dependency of renderscript should be labeled as
      same_process_hal_file. To facilitate that we relax neverallow rules for
      executing same_process_hal_file from coredomain.
      
      See details on /vendor/bin/bcc:
      https://source.android.com/devices/architecture/vndk/renderscript
      
      Bug: n/a
      Test: build-time change
      Change-Id: Ie996fb863090bf08b3d3ef653da827d0b22937d7
      dd253e90
    • Nick Kralevich's avatar
      Relax some neverallow rules · bd3e300a
      Nick Kralevich authored
      Kernels above 4.14 have a new mmap permission. However, neverallow rules
      exclude the use of mmap, even when file FDs are passable across the
      vendor/non-vendor boundary. Since we allow reading / writing of passed
      file descriptors, also allow the use of mmap for passed file
      descriptors.
      
      Bug: 112171217
      Test: policy compiles
      Change-Id: I8176f86960bdff0cf5de770809510e9df5d62db9
      bd3e300a
    • Nick Kralevich's avatar
      Revert "Remove legacy execmod access." · d90d001a
      Nick Kralevich authored
      This reverts commit 0f11ffcc.
      
      Reason for revert: libmono crashes
      
      Bug: 112292089
      Bug: 111544476
      Test: policy compiles, device boots
      Change-Id: I064090aa9337cf17b80cd2c9af9342df851a3b27
      d90d001a
  22. 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
    • Alan Stokes's avatar
      Remove legacy execmod access. · 0f11ffcc
      Alan Stokes authored
      Remove the exemptions for untrusted apps and broaden the neverallow so
      they can't be reinstated. Modifying executable pages is unsafe. Text
      relocations are not supported.
      
      Bug: 111544476
      Test: Builds.
      Change-Id: Ibff4f34d916e000203e38574bb063513e4428bb7
      0f11ffcc
  23. Jul 25, 2018
    • Bowgo Tsai's avatar
      Allowing vold to search /mnt/vendor/* · 7b67a617
      Bowgo Tsai authored
      vold will trim rw mount points about daily, but it is denied by SELinux:
      
      root   603   603 W Binder:603_2: type=1400 audit(0.0:11): avc: denied {
      search } for name="vendor" dev="tmpfs" ino=23935 scontext=u:r:vold:s0
      tcontext=u:object_r:mnt_vendor_file:s0 tclass=dir permissive=0
      
      Allowing vold to search /mnt/vendor/* to fix the denials.
      
      Note that device-specific sepolicy needs to be extended to allow vold
      to send FITRIM ioctl. e.g., for /mnt/vendor/persist, it needs:
      
          allow vold persist_file:dir { ioctl open read };
      
      Bug: 111409607
      Test: boot a device, checks the above denial is gone
      Change-Id: Ia9f22d973e5a2e295678781de49a0f61fccd9dad
      7b67a617
  24. Jul 17, 2018
  25. Jul 12, 2018
  26. Jun 29, 2018
  27. 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
  28. Jun 14, 2018
  29. Jun 13, 2018
    • padarshr's avatar
      Add ueventd to mnt_vendor_file neverallow exemption list · 44ae7c2c
      padarshr authored
      Legacy hardware and code still depends on the ueventd helpers to
      locate the firmware supported files which are on new mount path
      labeled with mnt_vendot_file. For ueventd helper to work we need dir search
      and read permission on this new label so moving ueventd to exempted list.
      
      Already ueventd has the vendor_file_type read access.
      
      Bug:110083808
      
      Change-Id: Ia15cc39ecef9e29b4f1f684efdddbeb78b427988
      44ae7c2c
  30. 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
  31. May 29, 2018
    • Jeff Vander Stoep's avatar
      Improve tests protecting private app data · ab82125f
      Jeff Vander Stoep authored
      In particular, add assertions limiting which processes may
      directly open files owned by apps. Reduce this to just apps, init,
      and installd. App data is protected by a combination of selinux
      permissions and Unix permissions, so limiting the open permission to
      just apps (which are not allowed to have CAP_DAC_OVERRIDE or
      CAP_DAC_READ_SEARCH) ensures that only installd and init have
      complete access an app's private directory.
      
      In addition to apps/init/installd, other processes currently granted
      open are mediaserver, uncrypt, and vold. Uncrypt's access appears to
      be deprecated (b/80299612). Uncrypt now uses /data/ota_package
      instead. b/80418809 and b/80300620 track removal for vold and
      mediaserver.
      
      Test: build/boot aosp_taimen-userdebug. Verify no "granted" audit
      messages in the logs.
      Bug: 80190017
      Bug: 80300620
      Bug: 80418809
      Fixes: 80299612
      Change-Id: I153bc7b62294b36ccd596254a5976dd887fed046
      ab82125f
  32. May 16, 2018
Loading