Skip to content
Snippets Groups Projects
  1. Dec 05, 2016
    • Max's avatar
      /dev/port does not seem to be used, adding in rules to confirm. · c27c23fb
      Max authored
      Only init and ueventd have any access to /dev/port, and neither should
      have any use for it. As it stands, leaving port in just represents
      additional attack surface with no useful functionality, so it should be
      removed if possible, not only from Pixel devices, but from all Android
      devices.
      
      Test: The phone boots successfully
      
      Bug:33301618
      Change-Id: Iedc51590f1ffda02444587d647889ead9bdece3f
      c27c23fb
  2. Nov 21, 2016
    • Nick Kralevich's avatar
      Collapse urandom_device into random_device · 5eadcb8c
      Nick Kralevich authored
      urandom_device and random_device have the exact same security
      properties. Collapse them into one type.
      
      Test: device boots and /dev/urandom is labeled correctly.
      Change-Id: I12da30749291bc5e37d99bc9422bb86cb58cec41
      5eadcb8c
  3. Nov 12, 2016
  4. Nov 01, 2016
  5. Oct 06, 2016
    • dcashman's avatar
      Split general policy into public and private components. · cc39f637
      dcashman authored
      Divide policy into public and private components.  This is the first
      step in splitting the policy creation for platform and non-platform
      policies.  The policy in the public directory will be exported for use
      in non-platform policy creation.  Backwards compatibility with it will
      be achieved by converting the exported policy into attribute-based
      policy when included as part of the non-platform policy and a mapping
      file will be maintained to be included with the platform policy that
      maps exported attributes of previous versions to the current platform
      version.
      
      Eventually we would like to create a clear interface between the
      platform and non-platform device components so that the exported policy,
      and the need for attributes is minimal.  For now, almost all types and
      avrules are left in public.
      
      Test: Tested by building policy and running on device.
      
      Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
      cc39f637
  6. Sep 12, 2016
  7. 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
  8. Sep 10, 2016
  9. Sep 01, 2016
  10. Aug 29, 2016
  11. Aug 15, 2016
    • Hung-ying Tyan's avatar
      Allow init to mount /odm, /vendor early · c3774720
      Hung-ying Tyan authored
      Specifically we need init to relabel (/dev/device-mapper, /dev/block/dm-?)
      and other files in /dev/block/* from tmpfs to dm_device and block_device
      respectively.
      
      BUG=27805372
      
      Change-Id: I16af6e803f8e4150481137aba24d5406872f9c62
      c3774720
  12. Aug 11, 2016
  13. Aug 05, 2016
    • Daniel Micay's avatar
      restrict access to timing information in /proc · 5423db6e
      Daniel Micay authored
      These APIs expose sensitive information via timing side channels. This
      leaves access via the adb shell intact along with the current uses by
      dumpstate, init and system_server.
      
      The /proc/interrupts and /proc/stat files were covered in this paper:
      
      https://www.lightbluetouchpaper.org/2016/07/29/yet-another-android-side-channel/
      
      The /proc/softirqs, /proc/timer_list and /proc/timer_stats files are
      also relevant.
      
      Access to /proc has been greatly restricted since then, with untrusted
      apps no longer having direct access to these, but stricter restrictions
      beyond that would be quite useful.
      
      Change-Id: Ibed16674856569d26517e5729f0f194b830cfedd
      5423db6e
  14. Jul 22, 2016
  15. Jul 07, 2016
  16. May 13, 2016
    • Christian Poetzsch's avatar
      sepolicy: add support for new tracefs · 97573fdf
      Christian Poetzsch authored
      Since kernel 4.1 ftrace is supported as a new separate filesystem. It
      gets automatically mounted by the kernel under the old path
      /sys/kernel/debug/tracing. Because it lives now on a separate device
      some sepolicy rules need to be updated. This patch is doing that. Most
      of the rules are created based on a conversation happened on the SELinux
      Android mailing list:
      
      http://comments.gmane.org/gmane.comp.security.seandroid/2799
      
      
      
      Note, that this also needs 3a343a1 from the 4.4 branch in kernel/common.
      Also note that when tracefs is auto mounted by the kernel, the kernel
      does not use the "mode" parameter specified to mount debugfs for
      tracefs. So an extra line like
      
         chmod 0755 /sys/kernel/debug/tracing
      
      is necessary in init.${ro.hardware}.rc after debugfs was mounted.
      
      Signed-off-by: default avatarChristian Poetzsch <christian.potzsch@imgtec.com>
      
      (cherry picked from commit 4dafa72a)
      
      Change-Id: I75738c756b49da4ac109ae442ee37c1e2844ff0a
      97573fdf
    • Christian Poetzsch's avatar
      sepolicy: add support for new tracefs · 4dafa72a
      Christian Poetzsch authored
      Since kernel 4.1 ftrace is supported as a new separate filesystem. It
      gets automatically mounted by the kernel under the old path
      /sys/kernel/debug/tracing. Because it lives now on a separate device
      some sepolicy rules need to be updated. This patch is doing that. Most
      of the rules are created based on a conversation happened on the SELinux
      Android mailing list:
      
      http://comments.gmane.org/gmane.comp.security.seandroid/2799
      
      
      
      Note, that this also needs 3a343a1 from the 4.4 branch in kernel/common.
      Also note that when tracefs is auto mounted by the kernel, the kernel
      does not use the "mode" parameter specified to mount debugfs for
      tracefs. So an extra line like
      
         chmod 0755 /sys/kernel/debug/tracing
      
      is necessary in init.${ro.hardware}.rc after debugfs was mounted.
      
      Change-Id: I60fb7a90e24628e0370c3bca57644451fce5646d
      Signed-off-by: default avatarChristian Poetzsch <christian.potzsch@imgtec.com>
  17. May 10, 2016
    • Jeff Vander Stoep's avatar
      allow init to read symlinks in sys · 912f3c10
      Jeff Vander Stoep authored
      avc: denied { read } for name="device" dev="sysfs" ino=36099 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_rmtfs:s0 tclass=lnk_file
      
      init is already allowed to read directories, this is an obvious omission.
      
      Change-Id: I5131a84bb67e73aaed235c3cbab95c365eaaa2f0
      912f3c10
  18. Apr 07, 2016
  19. Apr 05, 2016
  20. 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
  21. Mar 30, 2016
  22. 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
  23. 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
    • 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
  24. Mar 11, 2016
  25. Mar 07, 2016
  26. Mar 04, 2016
    • Alex Deymo's avatar
      New postinstall domain and rules to run post-install program. · a52b5618
      Alex Deymo authored
      When using the A/B updater, a device specific hook is sometimes needed
      to run after the new partitions are updated but before rebooting into
      the new image. This hook is referred to throughout the code as the
      "postinstall" step.
      
      This patch creates a new execution domain "postinstall" which
      update_engine will use to run said hook. Since the hook needs to run
      from the new image (namelly, slot "B"), update_engine needs to
      temporarly mount this B partition into /postinstall and then run a
      program from there.
      
      Since the new program in B runs from the old execution context in A, we
      can't rely on the labels set in the xattr in the new filesystem to
      enforce the policies baked into the old running image. Instead, when
      temporarily mounting the new filesystem in update_engine, we override
      all the new file attributes with the new postinstall_file type by
      passing "context=u:object_r:postinstall_file:s0" to the mount syscall.
      This allows us to set new rules specific to the postinstall environment
      that are consistent with the rules in the old system.
      
      Bug: 27177071
      TEST=Deployed a payload with a trivial postinstall script to edison-eng.
      
      (cherry picked from commit 6cb2c893)
      
      Change-Id: I49a529eecf1ef0524819470876ef7c8c2659c7ef
      a52b5618
  27. Mar 02, 2016
    • Alex Deymo's avatar
      New postinstall domain and rules to run post-install program. · 6cb2c893
      Alex Deymo authored
      When using the A/B updater, a device specific hook is sometimes needed
      to run after the new partitions are updated but before rebooting into
      the new image. This hook is referred to throughout the code as the
      "postinstall" step.
      
      This patch creates a new execution domain "postinstall" which
      update_engine will use to run said hook. Since the hook needs to run
      from the new image (namelly, slot "B"), update_engine needs to
      temporarly mount this B partition into /postinstall and then run a
      program from there.
      
      Since the new program in B runs from the old execution context in A, we
      can't rely on the labels set in the xattr in the new filesystem to
      enforce the policies baked into the old running image. Instead, when
      temporarily mounting the new filesystem in update_engine, we override
      all the new file attributes with the new postinstall_file type by
      passing "context=u:object_r:postinstall_file:s0" to the mount syscall.
      This allows us to set new rules specific to the postinstall environment
      that are consistent with the rules in the old system.
      
      Bug: 27177071
      TEST=Deployed a payload with a trivial postinstall script to edison-eng.
      
      Change-Id: Ib06fab92afb45edaec3c9c9872304dc9386151b4
      6cb2c893
  28. Jan 27, 2016
  29. Jan 07, 2016
    • Bertrand SIMONNET's avatar
      Allows init to send signals. · 34e4da5f
      Bertrand SIMONNET authored
      This will allow init to terminate services cleanly (SIGTERM, wait,
      SIGKILL) when needed.
      
      Bug: 26216447
      Test: manual: init is able to send a SIGTERM signal without denials.
      
      Change-Id: Id2471ca08c0b011be64a36956628e965bc999bc6
      34e4da5f
  30. Jan 04, 2016
    • dcashman's avatar
      Create sysfs_zram label. · 36f255ff
      dcashman authored
      Address following denials:
      avc: denied { getattr } for path="/sys/devices/virtual/block/zram0/disksize" dev="sysfs" ino=14958 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
      avc: denied { search } for name="zram0" dev="sysfs" ino=14903 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0
      avc: denied { read } for name="mem_used_total" dev="sysfs" ino=14970 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
      avc: denied { write } for name="uevent" dev="sysfs" ino=14904 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
      avc: denied { open } for path="/sys/devices/virtual/block/zram0/uevent" dev="sysfs" ino=14904 scontext=u:r:ueventd:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=file permissive=0
      avc: denied { read } for pid=348 comm="vold" name="zram0" dev="sysfs" ino=15223 scontext=u:r:vold:s0 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0
      avc: denied { search } for pid=3494 comm="ContactsProvide" name="zram0"dev="sysfs" ino=15223 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:sysfs_zram:s0 tclass=dir permissive=0
      
      Bug: 22032619
      Change-Id: I40cf918b7cafdba6cb3d42b04b1616a84e4ce158
      36f255ff
  31. Dec 16, 2015
  32. Dec 08, 2015
  33. Dec 03, 2015
    • Tom Cherry's avatar
      Support fine grain read access control for properties · 949d7cbc
      Tom Cherry authored
      Properties are now broken up from a single /dev/__properties__ file into
      multiple files, one per property label.  This commit provides the
      mechanism to control read access to each of these files and therefore
      sets of properties.
      
      This allows full access for all domains to each of these new property
      files to match the current permissions of /dev/__properties__.  Future
      commits will restrict the access.
      
      Bug: 21852512
      
      Change-Id: Ie9e43968acc7ac3b88e354a0bdfac75b8a710094
      949d7cbc
  34. Nov 16, 2015
  35. Nov 03, 2015
    • Jeff Vander Stoep's avatar
      Create attribute for moving perms out of domain · d22987b4
      Jeff Vander Stoep authored
      Motivation: Domain is overly permissive. Start removing permissions
      from domain and assign them to the domain_deprecated attribute.
      Domain_deprecated and domain can initially be assigned to all
      domains. The goal is to not assign domain_deprecated to new domains
      and to start removing domain_deprecated where it is not required or
      reassigning the appropriate permissions to the inheriting domain
      when necessary.
      
      Bug: 25433265
      Change-Id: I8b11cb137df7bdd382629c98d916a73fe276413c
      d22987b4
  36. Sep 22, 2015
  37. Aug 24, 2015
Loading