Skip to content
Snippets Groups Projects
  1. 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
    • 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
  2. Aug 20, 2018
    • Hridya Valsaraju's avatar
      Define 'super_block_device' type · 4ae8fe9b
      Hridya Valsaraju authored
      Bug: 78793464
      Test: fastboot getvar partition-size:super
      
      'super_block_device' corresponds to the super partition
      required for flashing dynamic partitions.
      
      Change-Id: I323634b6797ead7c5face117a7028bf9ab947aea
      4ae8fe9b
    • Dario Freni's avatar
      s/product-services/product_services/g · e217ab1b
      Dario Freni authored
      Attempting to reduce the number of different spellings we have for
      "product services" partition in the codebase.
      
      Bug: 112431447
      Test: m
      Change-Id: I1499c60e3d6c6c9fbe2e3f30f097f83b1e837c1c
      Merged-In: I1499c60e3d6c6c9fbe2e3f30f097f83b1e837c1c
      e217ab1b
  3. Aug 15, 2018
    • Joel Galenson's avatar
      bug_map: track new pm/storage denials · a68b1044
      Joel Galenson authored
      avc: denied { getattr } for comm="Binder:1231_1" path="/storage/emulated" dev="tmpfs" ino=72787 scontext=u:r:system_server:s0 tcontext=u:object_r:storage_stub_file:s0 tclass=dir
      
      Bug: 112609936
      Test: Built policy.
      Change-Id: Ib772aca11bad4ba267de259be4ad065f228ef1df
      a68b1044
    • 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
  4. Aug 14, 2018
    • 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
    • Mark Salyzyn's avatar
      fs_mgr: use ro.persistent_properties.ready · 7ab1450d
      Mark Salyzyn authored
      Replace more complicated logic that determines that persistent
      properties are now valid with a simple check of
      ro.persistent_properties.ready.
      
      Test: manual
      Bug: 109821005
      Change-Id: I8c63beb294377ea9ce6eb6336b83f529deedd830
      7ab1450d
    • Tri Vo's avatar
      Sepolicy for system suspend HAL. · dac2a4a3
      Tri Vo authored
      Bug: 78888165
      Test: device can boot with HAL running.
      Change-Id: I3bf7c8203e038b892176c97ec006152a2904c7be
      dac2a4a3
  5. Aug 13, 2018
    • Nick Kralevich's avatar
      Revert "Change priv-apps /home/home labels to privapp_data_file" · cdc6649a
      Nick Kralevich authored
      There is a problem with on-disk labeling of files created by secondary
      dex background compilation which is causing unexpected denials to show
      up. Restore the old labeling until we are able to fix the underlying
      problem.
      
      Steps to reproduce:
        1) boot android device.
        2) adb root
        3) Run cmd package compile -r bg-dexopt --secondary-dex com.google.android.gms
        4) Examine the files in /data/user_de/0/com.google.android.gms
      Expected:
        All files have the label privapp_data_file
      Actual:
        The files in /data/user_de/0/com.google.android.gms/app_chimera/m
        are labeled "app_data_file", not "privapp_data_file".
      
      This reverts commit 4df57822.
      
      Bug: 112357170
      Test: policy compiles
      Change-Id: I38ba75c92c9c46e6a1fdbc02e3dc80c63adccaa8
      cdc6649a
    • Nick Kralevich's avatar
      Revert "auditallow app_data_file execute" · c47e149a
      Nick Kralevich authored
      There is a problem with on-disk labeling of files created by secondary
      dex background compilation which is causing unexpected denials to show
      up. Drop the auditallow rule to avoid logspam.
      
      Steps to reproduce:
        1) boot android device.
        2) adb root
        3) Run cmd package compile -r bg-dexopt --secondary-dex com.google.android.gms
        4) Examine the files in /data/user_de/0/com.google.android.gms
      Expected:
        All files have the label privapp_data_file
      Actual:
        The files in /data/user_de/0/com.google.android.gms/app_chimera/m
        are labeled "app_data_file", not "privapp_data_file".
      
      Addresses the following audit logspam:
        type=1400 audit(0.0:117): avc: granted { execute } for comm=4173796E635461736B202331 path="/data/user_de/0/com.google.android.gms/app_chimera/m/00000002/oat/arm/DynamiteLoader.odex" dev="dm-0" ino=5775 scontext=u:r:untrusted_app:s0:c111,c256,c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file app=com.android.chrome
      
      Additionally, this removes auditallow statements for older untrusted
      apps. Lots of big apps are executing files from their home directory.
      Additional restrictions in this area will need to be tied to API
      versions.
      
      Addresses the following audit logspam:
        type=1400 audit(0.0:619): avc: granted { execute } for comm="na:notification" path="/data/data/com.facebook.katana/lib-xzs/libbreakpad.so" dev="dm-3" ino=28333 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file app=com.facebook.katana
        type=1400 audit(0.0:129): avc: granted { execute } for comm="ticlock" path="/data/data/is.shortcut/files/ticlock/ticlock" dev="dm-3" ino=58614 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file app=is.shortcut
        type=1400 audit(0.0:1239): avc: granted { execute } for comm="Analytics-Norma" path="/data/data/com.facebook.orca/lib-xzs/libchipsetmerged.so" dev="dm-3" ino=50243 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file app=com.facebook.orca
        type=1400 audit(0.0:58): avc: granted { execute_no_trans } for comm="sh" path="/data/data/is.shortcut/files/ticlock/ticlock" dev="dm-3" ino=58614 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file app=is.shortcut
        type=1400 audit(0.0:1948): avc: granted { execute_no_trans } for comm="sh" path="/data/data/com.mxdata.tube.Market/files/osmcore" dev="sda13" ino=2752651 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file app=com.mxdata.tube.Market
        type=1400 audit(0.0:2875): avc: granted { execute_no_trans } for comm="ThreadPoolManag" path="/data/data/com.amazon.kindle/files/hardwareTest" dev="sda13" ino=1935346 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=file app=com.amazon.kindle
      
      This reverts commit 4738b93d.
      
      Bug: 112357170
      Test: policy compiles
      c47e149a
  6. Aug 10, 2018
  7. Aug 09, 2018
  8. Aug 08, 2018
    • Mark Salyzyn's avatar
      fs_mgr: add overlayfs handling for squashfs system filesystems · 9b398f3f
      Mark Salyzyn authored
      /cache/overlay directory in support of overlayfs mounts on userdebug
      and eng devices.  Overlayfs in turn can be capable of supporting
      adb remount for read-only or restricted-storage filesystems like
      squashfs or right-sized (zero free space) system partitions
      respectively.
      
      Test: compile
      Bug: 109821005
      Bug: 110985612
      Change-Id: I3ece03886db7cc97f864497cf93ec6c6c39bccd1
      9b398f3f
    • 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
  9. Aug 07, 2018
  10. Aug 06, 2018
  11. Aug 03, 2018
    • Tom Cherry's avatar
      Second stage init is on system · 2faf4854
      Tom Cherry authored
      Test: boot hikey
      Change-Id: I8f26f858af8ccde1d7f4b346966bbb6bbeab5a92
      2faf4854
    • Nick Kralevich's avatar
      Change priv-apps /home/home labels to privapp_data_file · 4df57822
      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.
      
      Commit 23c9d91b introduced a new type
      called privapp_data_file and added rules necessary to preserve
      compatibility. However, that change did not relabel any existing files,
      so effectively the change was a no-op.
      
      This change performs the switch, relabeling priv-app's /data/data files
      from app_data_file to privapp_data_file. Due to the compatibility rules
      added in 23c9d91b, there should be no
      noticeable effect from this change.
      
      Test: Factory reset and boot - no problems on fresh install.
      Test: Upgrade to new version and test. No compatibility problems on
            filesystem upgrade.
      
      Merged-In: I9a476726bf01f4bcc7952d11fd57dba803a9fd8d
      Change-Id: I23a26cd3906fc43cbd225c05c3a2abd3cab8bd06
      4df57822
    • Tom Cherry's avatar
      Allow init to execute services marked with seclabel u:r:su:s0 in userdebug/eng · 938ab05d
      Tom Cherry authored
      This is do aid developers pushing debug services to not need to modify
      the underlying SEPolicy
      
      avc: denied { transition } for comm="init" path="/system/bin/awk"
      dev="dm-0" ino=1934 scontext=u:r:init:s0 tcontext=u:r:su:s0
      tclass=process
      avc: denied { rlimitinh } for comm="awk" scontext=u:r:init:s0
      tcontext=u:r:su:s0 tclass=process
      avc: denied { siginh } for comm="awk" scontext=u:r:init:s0
      tcontext=u:r:su:s0 tclass=process
      avc: denied { noatsecure } for comm="awk" scontext=u:r:init:s0
      tcontext=u:r:su:s0 tclass=process
      
      Test: init can execute a system_file marked with seclabel u:r:su:s0
      Change-Id: I85d9528341fe08dbb2fb9a91e34a41f41aa093be
      938ab05d
    • Tom Cherry's avatar
      Move watchdogd out of init and into its own domain · d840374e
      Tom Cherry authored
      Bug: 73660730
      Test: watchdogd still runs
      Change-Id: I31697c7c6fa2f7009731ff48c659af051838e42f
      d840374e
  12. 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
  13. Jul 23, 2018
  14. Jul 20, 2018
    • Tri Vo's avatar
      28 mapping workaround for devices upgrading to P. · 0cc68ea0
      Tri Vo authored
      Bug: 72458734
      Test: Compile current system sepolicy with P vendor sepolicy
      Test: Plug in a P device then do:
      m selinux_policy
      cp $OUT/system/etc/selinux/plat_sepolicy.cil  plat_sepolicy.cil
      cp $ANDROID_BUILD_TOP/system/sepolicy/private/compat/28.0/28.0.cil 28.0.cil
      adb pull /vendor/etc/selinux/plat_pub_versioned.cil
      adb pull /vendor/etc/selinux/vendor_sepolicy.cil
      secilc plat_sepolicy.cil -m -M true -G -N -c 30 28.0.cil \
      plat_pub_versioned.cil vendor_sepolicy.cil
      Change-Id: I399b3a204eb94bee0ba1b5024b1c3463219c678e
      0cc68ea0
    • Alan Stokes's avatar
      Re-order rules to match AOSP. · c2aad29d
      Alan Stokes authored
      This is to avoid merge problems if we make any further changes in AOSP.
      
      Test: Builds.
      Change-Id: Ib4193d31c02dda300513f82f6c7426a2e81d8111
      c2aad29d
    • Alan Stokes's avatar
      Temporarily add auditing of execmod by apps. · 708aa90d
      Alan Stokes authored
      This is so we can get data on which apps are actually doing this.
      
      Bug: 111544476
      Test: Device boots. No audits seen on test device.
      Change-Id: I5f72200ed8606775904d353c4d3d790373fe7dea
      708aa90d
  15. Jul 19, 2018
    • Jae Shin's avatar
      Add mapping files for 28.0.[ignore.]cil · 1fa96348
      Jae Shin authored
      Steps taken to produce the mapping files:
      
      1. Add prebuilts/api/28.0/[plat_pub_versioned.cil|vendor_sepolicy.cil]
      from the /vendor/etc/selinux/[plat_pub_versioned.cil|vendor_sepolicy.cil]
      files built on pi-dev with lunch target aosp_arm64-eng
      
      2. Add new file private/compat/28.0/28.0.cil by doing the following:
      - copy /system/etc/selinux/mapping/28.0.cil from pi-dev aosp_arm64-eng
      device to private/compat/28.0/28.0.cil
      - remove all attribute declaration statement (typeattribute ...) and
      sort lines alphabetically
      - some selinux types were added/renamed/deleted w.r.t 28 sepolicy.
      Find all such types using treble_sepolicy_tests_28.0 test.
      - for all these types figure out where to map them by looking at
      27.0.[ignore.]cil files and add approprite entries to 28.0.[ignore.]cil.
      
      This change also enables treble_sepolicy_tests_28.0 and install 28.0.cil
      mapping onto the device.
      
      Bug: 72458734
      Test: m selinux_policy
      Change-Id: I90e17c0b43af436da4b62c16179c198b5c74002c
      1fa96348
  16. 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
    • Todd Poynor's avatar
      reorder api 27 compat entries for removed types to match AOSP · d1ff81c2
      Todd Poynor authored
      Avoids subsequent merge conflicts in this section of the file.
      
      Test: manual: compile
      Change-Id: I9af723dccff54039031dc4d8f3e5ee34be5960d1
      Merged-In: I9af723dccff54039031dc4d8f3e5ee34be5960d1
      (cherry picked from commit 66825305)
      d1ff81c2
  17. Jul 17, 2018
  18. Jul 14, 2018
    • Steven Thomas's avatar
      Selinux changes for vr flinger vsync service · 7bec9674
      Steven Thomas authored
      Add selinux policy for the new Binder-based vr flinger vsync service.
      
      Bug: 72890037
      
      Test: - Manually confirmed that I can't bind to the new vsync service
      from a normal Android application, and system processes (other than
      vr_hwc) are prevented from connecting by selinux.
      
      - Confirmed the CTS test
        android.security.cts.SELinuxHostTest#testAospServiceContexts, when
        built from the local source tree with this CL applied, passes.
      
      - Confirmed the CTS test
        android.cts.security.SELinuxNeverallowRulesTest#testNeverallowRules521,
        when built from the local source tree with this CL applied, passes.
      
      Change-Id: Ib7a6bfcb1c2ebe1051f3accc18b481be1b188b06
      7bec9674
  19. Jul 03, 2018
  20. Jul 02, 2018
    • Yabin Cui's avatar
      Export more files in proc_perf. · 09464811
      Yabin Cui authored
      Export /proc/sys/kernel/perf_cpu_time_max_percent and
      /proc/sys/kernel/perf_event_mlock_kb in proc_perf. So
      they can be read in shell and written by init.
      
      This is needed by simpleperf to control cpu percent and
      memory used for profiling.
      
      Bug: 110706031
      Test: build and boot hikey960 successfully.
      
      Change-Id: I2a01f583508003ab73427bab30a7982a27dfa677
      09464811
Loading