Skip to content
Snippets Groups Projects
  1. Sep 13, 2016
    • Andreas Gampe's avatar
      Sepolicy: Add otapreopt_slot · a3a0bb44
      Andreas Gampe authored
      (cherry picked from commit eb717421)
      
      The new A/B OTA artifact naming scheme includes the target slot so
      that the system is robust with respect to unexpected reboots. This
      complicates the renaming code after reboot, so it is moved from the
      zygote into a simple script (otapreopt_slot) that is hooked into
      the startup sequence in init.
      
      Give the script the subset of the rights that the zygote had so that
      it can move the artifacts from /data/ota into /data/dalvik-cache.
      Relabeling will be done in the init rc component, so relabeling
      rights can be completely removed.
      
      Bug: 25612095
      Bug: 28069686
      Change-Id: Iad56dc3d78ac759f4f2cce65633cdaf1cab7631b
      a3a0bb44
    • Andreas Gampe's avatar
      Sepolicy: allow otapreopt_chroot to mount vendor · c9ce12ba
      Andreas Gampe authored
      (cherry picked from commit ec4b9d67)
      
      Vendor apps are usually not preopted, so A/B dexopt should pick
      them up. update_engine is not mounting the vendor partition, so
      let otapreopt_chroot do the work.
      
      This change gives otapreopt_chroot permission to mount /vendor
      into the chroot environment.
      
      Bug: 25612095
      Bug: 29498238
      Change-Id: I5a77bdb78a8e478ce10f6c1d0f911a8d6686becb
      c9ce12ba
  2. Sep 12, 2016
    • Alex Light's avatar
      Allow cppreopts to work with selinux · b7ebb32f
      Alex Light authored
      (cherry picked from commit d3edd6b5)
      
      Bug: 29278988
      Change-Id: I199572377a6b5c33116c718a545159ddcf50df30
      b7ebb32f
    • Nick Kralevich's avatar
      fix build: exclude bluetooth from neverallow restriction · e1b00f39
      Nick Kralevich authored
      Bluetooth is sometimes started from init.
      
      Addresses the following compiler error:
      
        libsepol.report_failure: neverallow on line 489 of
        system/sepolicy/domain.te (or line 9149 of policy.conf) violated by
        allow init bluetooth:process { transition };
        libsepol.check_assertions: 1 neverallow failures occurred
        Error while expanding policy
      
      (cherry-picked from commit 7e380216)
      
      Change-Id: I2bc1e15217892e1ba2a62c9683af0f3c0aa16b86
      e1b00f39
    • Eino-Ville Talvala's avatar
      Rework neverallow for /data execute permission · 6bb6c16e
      Eino-Ville Talvala authored
      Previously appdomains allowed to execute off of /data
      where whitelisted. This had the unfortunate side effect of
      disallowing the creation of device specific app domains
      with fewer permissions than untrusted_app. Instead grant
      all apps a neverallow exemption and blacklist specific app
      domains that should still abide by the restriction.
      
      This allows devices to add new app domains that need
      /data execute permission without conflicting with this rule.
      
      Bug: 26906711
      
      (cherry picked from commit c5266df9)
      
      Change-Id: I4adb58e8c8b35122d6295db58cedaa355cdd3924
      6bb6c16e
  3. Sep 11, 2016
    • Jeff Vander Stoep's avatar
      Enforce ioctl command whitelisting on all sockets · bff98015
      Jeff Vander Stoep authored
      Remove the ioctl permission for most socket types. For others, such as
      tcp/udp/rawip/unix_dgram/unix_stream set a default unprivileged whitelist
      that individual domains may extend (except where neverallowed like
      untrusted_app). Enforce via a neverallowxperm rule.
      
      Change-Id: I15548d830f8eff1fd4d64005c5769ca2be8d4ffe
      bff98015
  4. Jun 28, 2016
    • Jeff Vander Stoep's avatar
      domain: allow reading /proc/sys/vm/overcommit_memory · bc1986fb
      Jeff Vander Stoep authored
      Needed for jemalloc commit:
      
      2f970c32b527660a33fa513a76d913c812dcf7c
      Modify pages_map() to support mapping uncommitted virtual memory.
      
      avc: denied { read } for name="overcommit_memory" dev="proc" ino=10544
      scontext=u:r:wificond:s0 tcontext=u:object_r:proc:s0 tclass=file
      
      Bug: 29773242
      Change-Id: I78054c1ed576a7998c4ee1d1beca2f610c589c3a
      bc1986fb
  5. Jun 10, 2016
    • dcashman's avatar
      Allow access to sysfs usb nodes. · b144ebab
      dcashman authored
      Some legitimate functionality currently requires direct sysfs access
      that is not otherwise possible via the android APIs.  Specifically,
      isochronous USB transfers require this direct access, without which USB
      audio applications would noticibly suffer.
      
      Grant read access to the usb files under /sys/devices to prevent this
      regression.
      
      Bug: 28417852
      Change-Id: I3424bf3498ffa0eb647a54cc962ab8c54f291728
      b144ebab
  6. Jun 03, 2016
    • William Roberts's avatar
      ueventd: allow getattr on blk and chr types. · cd109d44
      William Roberts authored
      
      The commit: d41ad551
      fixes a race in coldboot. However, introduced a seperate
      bug where existing character files were being relabeled.
      
      The fix was to have ueventd ensure their was a delta between
      the old and new labels and only then call lsetfilecon(). To
      do this we call lgetfilecon() which calls lgetxattr(), this
      requires getattr permissions.
      
      This patch is void of any relabelfrom/to for ueventd on chr_file
      as those can be added as they occur.
      
      Bug: 29106809
      
      Change-Id: I84f60539252fc2b4a71cf01f78e3cadcfad443ef
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      cd109d44
  7. Apr 28, 2016
    • William Roberts's avatar
      shell: enable hostside test: testAllBlockDevicesAreSecure · e53d0b0b
      William Roberts authored
      
      Enable rules to allow shell to getattr on all block files
      for checking modes under /dev/block.
      
      Exempt shell from any neverallows on blk_file and limit them
      to only getattr.
      
      bug: 28306036
      Change-Id: Ic26c0f7acfb238ff78d5d3537d51c1a70c64d196
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      e53d0b0b
    • William Roberts's avatar
      shell: enable hostside test: testAllCharacterDevicesAreSecure · 72c16e32
      William Roberts authored
      Enable shell to have access to /dev for running the
      world accessable mode test on /dev.
      
      This approach adds shell to the list of excluded domains
      on neverallows around chr_files, but locks down the access
      for shell to only getattr.
      
      It was done this lightly more complicated way to prevent
      loosening the allow rules so that any domain would have
      getattr permissions.
      
      Change-Id: Idab466fa226ddbf004fcb1bbcaf98c8326605253
      72c16e32
    • Mihai Serban's avatar
      Allow ueventd to relabel block devices · 87c11478
      Mihai Serban authored
      
      There is a race in ueventd's coldboot procedure that permits creation
      of device block nodes before platform devices are registered. In this case
      the device node links used to compute the SELinux context are not known
      and the node is created under the generic context: u:object_r:block_device:s0.
      
      Ueventd has been patched to relabel the nodes on subsequent add events but
      it needs permissions to be allowed to do it.
      
      BUG=28388946
      
      Signed-off-by: default avatarMihai Serban <mihai.serban@intel.com>
      
      (cherry picked from commit d41ad551)
      
      Change-Id: I26838a3a9bc19b341e7176e5dc614827232014bf
      87c11478
    • Nick Kralevich's avatar
      Add no_x_file_perm to property related files. · ea0c294c
      Nick Kralevich authored
      It doesn't ever make sense to attempt to load executable code
      from these files. Add a neverallow rule (compile time assertion and
      CTS test).
      
      Bug: 27882507
      
      (cherry picked from commit 50ba6318)
      
      Change-Id: Ifab6e46a077a87629b4d3c7ada1050f2ab6931d5
      ea0c294c
    • Nick Kralevich's avatar
      Disallow /misc access except for a few domains. · 24a7f167
      Nick Kralevich authored
      The misc_block_device partition is intended for the exclusive
      use of the OTA system, and components related to the OTA system.
      Disallow it's use by anyone else on user builds. On userdebug/eng
      builds, allow any domain to use this, since this appears to be used
      for testing purposes.
      
      Bug: 26470876
      
      (cherry picked from commit 2c7a5f26)
      
      Change-Id: I40c80fa62651a0135e1f07a5e07d2ef65ba04139
      24a7f167
  8. Apr 27, 2016
    • Mihai Serban's avatar
      Allow ueventd to relabel block devices · d41ad551
      Mihai Serban authored
      
      There is a race in ueventd's coldboot procedure that permits creation
      of device block nodes before platform devices are registered. In this case
      the device node links used to compute the SELinux context are not known
      and the node is created under the generic context: u:object_r:block_device:s0.
      
      Ueventd has been patched to relabel the nodes on subsequent add events but
      it needs permissions to be allowed to do it.
      
      BUG=28388946
      
      Change-Id: Ic836309527a2b81accc50df38bd753d54fa5e318
      Signed-off-by: default avatarMihai Serban <mihai.serban@intel.com>
      d41ad551
  9. Apr 23, 2016
  10. Apr 22, 2016
    • Andreas Gampe's avatar
      Selinux: Policies for otapreopt_chroot and postinstall_dexopt · e5d8a947
      Andreas Gampe authored
      Give mount & chroot permissions to otapreopt_chroot related to
      postinstall.
      
      Add postinstall_dexopt for otapreopt in the B partition. Allow
      the things installd can do for dexopt. Give a few more rights
      to dex2oat for postinstall files.
      
      Allow postinstall files to call the system server.
      
      Bug: 25612095
      Change-Id: If7407473d50c9414668ff6ef869c2aadd14264e7
      e5d8a947
    • Nick Kralevich's avatar
      Add no_x_file_perm to property related files. · 50ba6318
      Nick Kralevich authored
      It doesn't ever make sense to attempt to load executable code
      from these files. Add a neverallow rule (compile time assertion and
      CTS test).
      
      Bug: 27882507
      Change-Id: Iaa83e3ac543b2221e1178c563e18298305de6da2
      50ba6318
  11. Apr 21, 2016
  12. Apr 19, 2016
    • mukesh agrawal's avatar
      limit shell's access to log.* properties · 84cfde22
      mukesh agrawal authored
      Restrict the ability of the shell to set the log.*
      properties. Namely: only allow the shell to set
      such properities on eng and userdebug builds.
      
      The shell (and other domains) can continue to
      read log.* properties on all builds.
      
      While there: harmonize permissions for log.* and
      persist.log.tag. Doing so introduces two changes:
      - log.* is now writable from from |system_app|. This
        mirrors the behavior of persist.log.tag, which is
        writable to support "Developer options" ->
        "Logger buffer sizes" -> "Off".
        (Since this option is visible on user builds, the
        permission is enabled for all builds.)
      - persist.log.tag can now be set from |shell| on
        userdebug_or_eng().
      
      BUG=28221972
      TEST=manual (see below)
      
      Testing details
      - user build (log.tag)
        $ adb shell setprop log.tag.foo V
        $ adb shell getprop log.tag
        <blank line>
        $ adb bugreport | grep log.tag.foo
        [  146.525836] init: avc:  denied  { set } for property=log.tag.foo pid=4644 uid=2000 gid=2000 scontext=u:r:shell:s0 tcontext=u:object_r:log_prop:s0 tclass=property_service permissive=0
        [  146.525878] init: sys_prop: permission denied uid:2000  name:log.tag.foo
      - userdebug build (log.tag)
        $ adb shell getprop log.tag.foo
        <blank line>
        $ adb shell setprop log.tag.foo V
        $ adb shell getprop log.tag.foo
        V
      - user build (persist.log.tag)
        $ adb shell getprop | grep log.tag
        <no match>
        - Developer options -> Logger buffer sizes -> Off
        $ adb shell getprop | grep log.tag
        [persist.log.tag]: [Settings]
        [persist.log.tag.snet_event_log]: [I]
      
      Change-Id: Idf00e7a623723a7c46bf6d01e386aeca92b2ad75
      84cfde22
    • Nick Kralevich's avatar
      drop watchdogd from CAP_SYS_RAWIO neverallow · af82243e
      Nick Kralevich authored
      Doesn't appear to be needed anymore.
      
      Change-Id: I7a1fcf4c17fa69c313daebb87c9b0bf654169ee0
      af82243e
  13. Apr 18, 2016
  14. Apr 15, 2016
    • Jeff Vander Stoep's avatar
      Further restrict socket ioctls available to apps · 32333536
      Jeff Vander Stoep authored
      (cherry picked from commit 6ba383c5)
      
      Restrict unix_dgram_socket and unix_stream_socket to a whitelist.
      Disallow all ioctls for netlink_selinux_socket and netlink_route_socket.
      
      Neverallow third party app use of all ioctls other than
      unix_dgram_socket, unix_stream_socket, netlink_selinux_socket,
      netlink_route_socket, tcp_socket, udp_socket and rawip_socket.
      
      Bug: 28171804
      Change-Id: Icfe3486a62fc2fc2d2abd8d4030a5fbdd0ab30ab
      32333536
    • Nick Kralevich's avatar
      drop vold from sys_rawio neverallow exception · a499041f
      Nick Kralevich authored
      (cherry picked from commit 1df23cbf)
      
      This does not appear needed anymore.
      
      Bug: 27549740
      Change-Id: I3128ab610c742b18008f4cfc2a7116b210f770e7
      a499041f
    • Nick Kralevich's avatar
      Disallow /misc access except for a few domains. · 2c7a5f26
      Nick Kralevich authored
      The misc_block_device partition is intended for the exclusive
      use of the OTA system, and components related to the OTA system.
      Disallow it's use by anyone else on user builds. On userdebug/eng
      builds, allow any domain to use this, since this appears to be used
      for testing purposes.
      
      Bug: 26470876
      Change-Id: I05d4ee025bb8a5e6a1a9237fefaa2b1c646e332c
      2c7a5f26
  15. Apr 09, 2016
    • Alex Deymo's avatar
      Allow postinstall_file to be an entrypoint. · ac52f460
      Alex Deymo authored
      postinstall_file was an exec_type so it could be an entrypoint for the
      domain_auto_trans from update_engine domain to postinstall domain. This
      patch removes the exec_type from postinstall_file and exempts it from
      the neverallow rule to become an entrypoint.
      
      Bug: 28008031
      TEST=postinstall_example still runs as the "postinstall" domain on edison-eng.
      
      (cherry picked from commit a9671c6b)
      
      Change-Id: I2e1f61ed42f8549e959edbe047c56513903e8e9c
      ac52f460
  16. Apr 07, 2016
  17. Apr 06, 2016
  18. Apr 05, 2016
  19. Apr 01, 2016
    • Nick Kralevich's avatar
      refine /data/misc/logd rules · 8a8770cd
      Nick Kralevich authored
      (cherry pick from commit 6937aa93)
      
      Followup to 121f5bfd.
      
      Move misc_logd_file neverallow rule from domain.te to logd.te,
      since the goal of the neverallow rule is to protect logd / logpersist
      files from other processes.
      
      Switch the misc_logd_file neverallow rule from using "rw_file_perms"
      to "no_rw_file_perms". The latter covers more cases of file
      modifications.
      
      Add more neverallow rules covering misc_logd_file directories.
      
      Instead of using not_userdebug_nor_eng(), modify the rules to be
      consistent with other highly constrained file types such as
      keystore_data_file or vold_data_file. See, for example,
      https://android-review.googlesource.com/144768
      
      To see the net effect of this change, you can use the following
      command line:
      
        sesearch --allow -t misc_logd_file -c file,dir,lnk_file \
        out/target/product/bullhead/root/sepolicy
      
      Before this change:
      
        # userdebug builds
        allow init misc_logd_file:dir { search setattr read create getattr write relabelfrom ioctl rmdir remove_name relabelto open add_name };
        allow init misc_logd_file:file { setattr read create write relabelfrom getattr relabelto unlink open };
        allow init misc_logd_file:lnk_file { setattr relabelfrom create getattr relabelto unlink };
        allow logd misc_logd_file:dir { search read lock getattr write ioctl remove_name open add_name };
        allow logd misc_logd_file:file { rename setattr read lock create getattr write ioctl unlink open append };
        allow shell misc_logd_file:dir { search read lock getattr ioctl open };
        allow shell misc_logd_file:file { read lock ioctl open getattr };
      
        # user builds
        allow init misc_logd_file:dir { search setattr read create getattr write relabelfrom ioctl rmdir remove_name relabelto open add_name };
        allow init misc_logd_file:file relabelto;
        allow init misc_logd_file:lnk_file { setattr relabelfrom create getattr relabelto unlink };
      
      After this change:
      
        # userdebug builds
        allow init misc_logd_file:dir { search setattr read create getattr ioctl relabelto open };
        allow init misc_logd_file:file { relabelto getattr };
        allow init misc_logd_file:lnk_file relabelto;
        allow logd misc_logd_file:dir { search read lock getattr write ioctl remove_name open add_name };
        allow logd misc_logd_file:file { rename setattr read lock create getattr write ioctl unlink open append };
        allow shell misc_logd_file:dir { search read lock getattr ioctl open };
        allow shell misc_logd_file:file { read lock ioctl open getattr };
      
        # user builds
        allow init misc_logd_file:dir { search setattr read create getattr ioctl relabelto open };
        allow init misc_logd_file:file { relabelto getattr };
        allow init misc_logd_file:lnk_file relabelto;
      
      Change-Id: I0b00215049ad83182f458b4b9e258289c5144479
      Bug: 27965066
      8a8770cd
  20. Mar 28, 2016
    • Nick Kralevich's avatar
      refine /data/misc/logd rules · 6937aa93
      Nick Kralevich authored
      Followup to 121f5bfd.
      
      Move misc_logd_file neverallow rule from domain.te to logd.te,
      since the goal of the neverallow rule is to protect logd / logpersist
      files from other processes.
      
      Switch the misc_logd_file neverallow rule from using "rw_file_perms"
      to "no_rw_file_perms". The latter covers more cases of file
      modifications.
      
      Add more neverallow rules covering misc_logd_file directories.
      
      Instead of using not_userdebug_nor_eng(), modify the rules to be
      consistent with other highly constrained file types such as
      keystore_data_file or vold_data_file. See, for example,
      https://android-review.googlesource.com/144768
      
      To see the net effect of this change, you can use the following
      command line:
      
        sesearch --allow -t misc_logd_file -c file,dir,lnk_file \
        out/target/product/bullhead/root/sepolicy
      
      Before this change:
      
        # userdebug builds
        allow init misc_logd_file:dir { search setattr read create getattr write relabelfrom ioctl rmdir remove_name relabelto open add_name };
        allow init misc_logd_file:file { setattr read create write relabelfrom getattr relabelto unlink open };
        allow init misc_logd_file:lnk_file { setattr relabelfrom create getattr relabelto unlink };
        allow logd misc_logd_file:dir { search read lock getattr write ioctl remove_name open add_name };
        allow logd misc_logd_file:file { rename setattr read lock create getattr write ioctl unlink open append };
        allow shell misc_logd_file:dir { search read lock getattr ioctl open };
        allow shell misc_logd_file:file { read lock ioctl open getattr };
      
        # user builds
        allow init misc_logd_file:dir { search setattr read create getattr write relabelfrom ioctl rmdir remove_name relabelto open add_name };
        allow init misc_logd_file:file relabelto;
        allow init misc_logd_file:lnk_file { setattr relabelfrom create getattr relabelto unlink };
      
      After this change:
      
        # userdebug builds
        allow init misc_logd_file:dir { search setattr read create getattr ioctl relabelto open };
        allow init misc_logd_file:file { relabelto getattr };
        allow init misc_logd_file:lnk_file relabelto;
        allow logd misc_logd_file:dir { search read lock getattr write ioctl remove_name open add_name };
        allow logd misc_logd_file:file { rename setattr read lock create getattr write ioctl unlink open append };
        allow shell misc_logd_file:dir { search read lock getattr ioctl open };
        allow shell misc_logd_file:file { read lock ioctl open getattr };
      
        # user builds
        allow init misc_logd_file:dir { search setattr read create getattr ioctl relabelto open };
        allow init misc_logd_file:file { relabelto getattr };
        allow init misc_logd_file:lnk_file relabelto;
      
      Change-Id: I0b00215049ad83182f458b4b9e258289c5144479
      6937aa93
  21. Mar 25, 2016
    • Mark Salyzyn's avatar
      init: logpersist access on debug · ab33c469
      Mark Salyzyn authored
      (cherry pick from commit 121f5bfd)
      
      03-25 09:31:22.996     1     1 W init    : type=1400 audit(0.0:8): \
        avc: denied { getattr } for path="/data/misc/logd/logcat.052" \
        dev="dm-2" ino=124778 scontext=u:r:init:s0 \
        tcontext=u:object_r:misc_logd_file:s0 tclass=file permissive=0
      . . .
      
      Introduced a new macro not_userdebug_nor_eng()
      
      Change-Id: I9c3a952c265cac096342493598fff7d41604ca45
      ab33c469
    • Nick Kralevich's avatar
      Make sure neverallow rules also cover other property types · 45737b9f
      Nick Kralevich authored
      There are now individual property files to control access to
      properties. Don't allow processes other than init to write
      to these property files.
      
      Change-Id: I184b9df4555ae5051f9a2ba946613c6c5d9d4403
      45737b9f
    • Mark Salyzyn's avatar
      init: logpersist access on debug · 121f5bfd
      Mark Salyzyn authored
      03-25 09:31:22.996     1     1 W init    : type=1400 audit(0.0:8): \
        avc: denied { getattr } for path="/data/misc/logd/logcat.052" \
        dev="dm-2" ino=124778 scontext=u:r:init:s0 \
        tcontext=u:object_r:misc_logd_file:s0 tclass=file permissive=0
      . . .
      
      Introduced a new macro not_userdebug_nor_eng()
      
      Change-Id: I9c3a952c265cac096342493598fff7d41604ca45
      121f5bfd
  22. Mar 11, 2016
  23. Mar 10, 2016
    • dcashman's avatar
      Allow domains to getattr proc lnk_file. · f4c403d1
      dcashman authored
      Many permissions were removed from untrusted_app by the removal of
      domain_deprecated, including procfs access. procfs file access was restored,
      however, but not completely.  Add the ability to getattr to all domains,
      so that other domains which lost domain_deprecated may benefit, as they
      will likely need it.
      
      Bug: 27249037
      Change-Id: Id3f5e6121548b29d739d5e0fa6ccdbc9f0fc29be
      f4c403d1
Loading