Skip to content
Snippets Groups Projects
  1. Jul 11, 2016
    • Andreas Gampe's avatar
      Sepolicy: Add otapreopt_slot · eb717421
      Andreas Gampe authored
      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
      eb717421
  2. Jun 28, 2016
  3. Jun 27, 2016
  4. Jun 25, 2016
  5. Jun 24, 2016
    • Eino-Ville Talvala's avatar
      Rework neverallow for /data execute permission · c5266df9
      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
      Change-Id: Ia876cc1dfd5b12908c59bd9e8620a6b890729c28
      c5266df9
  6. 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
  7. Apr 28, 2016
    • 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 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
  9. 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
  10. Apr 18, 2016
  11. 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
  12. 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
  13. Apr 07, 2016
    • Jeff Vander Stoep's avatar
      Enforce restrictions on kernel module origin · 66344009
      Jeff Vander Stoep authored
      (cherry picked from AOSP 163c8a006b87cae0217fd9dafdaec5271f1d795b)
      
      Do not allow module loading except from the system, vendor,
      and boot partitions.
      
      Bug: 27824855
      Change-Id: Ifc012e47c5677190c7cc564f9d48af8c7d0982e1
      66344009
  14. 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
  15. 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
  16. Mar 10, 2016
    • dcashman's avatar
      Allow domains to getattr proc lnk_file. · 74ae21b3
      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
      74ae21b3
  17. 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
  18. Mar 02, 2016
  19. Feb 24, 2016
  20. Feb 19, 2016
  21. Feb 05, 2016
    • dcashman's avatar
      Allow domain to read proc dirs. · abf31acb
      dcashman authored
      Ability to read all of proc was placed in domain_deprecated with the
      intention of reducing information leaking from proc.  Many processes try
      to read proc dirs, though.  Allow this with the belief that information
      leakage is from the proc files themselves rather than dir structure.
      
      Address the following denial:
      avc: denied { read } for name="/" dev="proc" ino=1 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=dir permissive=0
      
      Bug: 26833472
      Change-Id: I975ae022c093e1cf80de21487dc11e49f938e5a3
      abf31acb
    • Nick Kralevich's avatar
      Replace "neverallow domain" by "neverallow *" · 35a14514
      Nick Kralevich authored
      Modify many "neverallow domain" rules to be "neverallow *" rules
      instead. This will catch more SELinux policy bugs where a label
      is assigned an irrelevant rule, as well as catch situations where
      a domain attribute is not assigned to a process.
      
      Change-Id: I5b83a2504c13b384f9dff616a70ca733b648ccdf
      35a14514
    • Andreas Gampe's avatar
      Selinux: introduce policy for OTA preopt · 47ebae1a
      Andreas Gampe authored
      Add permissions to dex2oat, introduce otapreopt binary and otadexopt
      service.
      
      Bug: 25612095
      Change-Id: I80fcba2785e80b2931d7d82bb07474f6cd0099f7
      47ebae1a
  22. Feb 04, 2016
  23. Jan 29, 2016
  24. Jan 27, 2016
    • Jeff Vander Stoep's avatar
      domain: grant write perms to cgroups · be0616ba
      Jeff Vander Stoep authored
      Was moved to domain_deprecated. Move back to domain.
      
      Files in /acct/uid/*/tasks are well protected by unix permissions.
      No information is leaked with write perms.
      
      Change-Id: I8017e906950cba41ce350bc0892a36269ade8d53
      be0616ba
  25. Jan 26, 2016
    • SimHyunYong's avatar
      Using r_dir_file macro in domain.te · 093ea6fb
      SimHyunYong authored
      r_dir_file(domain, self)
      
      allow domain self:dir r_dir_perms;
      allow domain self:lnk_file r_file_perms;
      allow domain self:file r_file_perms;
      
      te_macros
      define(`r_dir_file', `
      allow $1 $2:dir r_dir_perms;
      allow $1 $2:{ file lnk_file } r_file_perms;
      ')
      
      Change-Id: I7338f63a1eaa8ca52cd31b51ce841e3dbe46ad4f
      093ea6fb
  26. Jan 25, 2016
    • Jeff Vander Stoep's avatar
      domain: allow dir search in selinuxfs · 45517a75
      Jeff Vander Stoep authored
      Domain is already allowed to stat selinuxfs, it also needs
      dir search.
      
      Addresses:
      avc: denied { search } for name="/" dev="selinuxfs" ino=1 scontext=u:r:watchdogd:s0 tcontext=u:object_r:selinuxfs:s0 tclass=dir
      
      Change-Id: I3e5bb96e905db480a2727038f80315d9544e9c07
      45517a75
  27. Jan 22, 2016
    • dcashman's avatar
      Allow access to /dev/ion and proc_net dir. · 8666bf25
      dcashman authored
      Address the following:
      01-21 13:35:41.147  5896  5896 W ndroid.music:ui: type=1400 audit(0.0:22): avc: denied { read } for name="ion" dev="tmpfs" ino=1237 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:ion_device:s0 tclass=chr_file permissive=0
      01-21 13:35:41.152  5896  5896 E qdmemalloc: open_device: Failed to open ion device - Permission denied
      01-21 13:35:41.152  5896  5896 E qdgralloc: Could not mmap handle 0x7f827d7260, fd=55 (Permission denied)
      01-21 13:35:41.152  5896  5896 E qdgralloc: gralloc_register_buffer: gralloc_map failed
      
      and
      
      01-22 08:58:47.667  7572  7572 W Thread-23: type=1400 audit(0.0:186): avc: denied { search } for name="xt_qtaguid" dev="proc" ino=4026535741 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_net:s0 tclass=dir permissive=0
      01-22 08:58:47.671  7498  7572 I qtaguid : Untagging socket 68 failed errno=-13
      01-22 08:58:47.671  7498  7572 W NetworkManagementSocketTagger: untagSocket(68) failed with errno -13
      
      Change-Id: Id4e253879fe0f6daadd04d148a257a10add68d38
      8666bf25
  28. Jan 21, 2016
    • dcashman's avatar
      Allow domains to stat filesystems. · fcea7263
      dcashman authored
      Address the following denials:
      01-21 12:44:53.704  4595  4595 W ndroid.calendar: type=1400 audit(0.0:21): avc: denied { getattr } for name="/" dev="dm-0" ino=2 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:labeledfs:s0 tclass=filesystem permissive=0
      01-21 12:45:23.177  5544  5544 W roid.music:main: type=1400 audit(0.0:46): avc: denied { getattr } for name="/" dev="rootfs" ino=1 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:rootfs:s0 tclass=filesystem permissive=0
      7618 W .android.chrome: type=1400 audit(0.0:413): avc: denied { getattr } for path="/" dev="rootfs" ino=1 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0
      
      01-21 12:44:53.709  4595  4595 D AndroidRuntime: Shutting down VM
      01-21 12:44:53.727  4595  4595 E AndroidRuntime: FATAL EXCEPTION: main
      01-21 12:44:53.727  4595  4595 E AndroidRuntime: Process: com.google.android.calendar, PID: 4595
      01-21 12:44:53.727  4595  4595 E AndroidRuntime: java.lang.RuntimeException: Unable to get provider com.google.android.syncadapters.calendar.timely.TimelyProvider: java.lang.IllegalArgumentException: Invalid path: /data
      01-21 12:44:53.727  4595  4595 E AndroidRuntime: 	at android.app.ActivityThread.installProvider(ActivityThread.java:5550)
      ...
      
      Change-Id: I0e9d65438d031e19c9abc5dca8969ed4356437a0
      fcea7263
  29. Jan 07, 2016
    • dcashman's avatar
      Allow domain to read symlinks in /sys. · cee72924
      dcashman authored
      Address the following denial:
      avc: denied { read } for name="battery" dev="sysfs" ino=17945 scontext=u:r:shell:s0 tcontext=u:object_r:sysfs:s0 tclass=lnk_file permissive=0
      
      Bug: 26219114
      Change-Id: I862b40a6514bffaa455dd7f06368acf9bcdc4782
      cee72924
  30. Jan 04, 2016
    • Felipe Leme's avatar
      Creates a new permission for /cache/recovery · 549ccf77
      Felipe Leme authored
      This permission was created mostly for dumpstate (so it can include
      recovery files on bugreports when an OTA fails), but it was applied to
      uncrypt and recovery as well (since it had a wider access before).
      
      Grant access to cache_recovery_file where we previously granted access
      to cache_file. Add auditallow rules to determine if this is really
      needed.
      
      BUG: 25351711
      Change-Id: I07745181dbb4f0bde75694ea31b3ab79a4682f18
      549ccf77
  31. Dec 24, 2015
    • Daichi Hirono's avatar
      Add new rules for appfuse. · a20802dd
      Daichi Hirono authored
      The new rules are used to allow to mount FUSE file system for priv-app.
      
      Change-Id: I5ce2d261be501e2b3fef09b7666f1e5d1cddbe52
      a20802dd
  32. Dec 23, 2015
    • Nick Kralevich's avatar
      undeprecate /proc/cpuinfo, more shell permissions · f8f937a1
      Nick Kralevich authored
      Access to /proc/cpuinfo was moved to domain_deprecated in commit
      6e3506e1. Restore access to everyone.
      
      Allow the shell user to stat() /dev, and vfsstat() /proc and other
      labeled filesystems such as /system and /data.
      
      Access to /proc/cpuinfo was explicitly granted to bootanim, but is no
      longer required after moving it back to domain.te. Delete the redundant
      entry.
      
      Commit 4e2d2245 restored access to
      /sys/devices/system/cpu for all domains, but forgot to remove the
      redundant entry from bootanim.te. Cleanup the redundant entry.
      
      Addresses the following denials:
      
        avc: denied { getattr } for pid=23648 comm="bionic-unit-tes" name="/" dev="proc" ino=1 scontext=u:r:shell:s0 tcontext=u:object_r:proc:s0 tclass=filesystem permissive=0
        avc: denied { read } for name="cpuinfo" dev="proc" ino=4026533615 scontext=u:r:shell:s0 tcontext=u:object_r:proc_cpuinfo:s0 tclass=file permissive=0
        avc: denied { getattr } for pid=23713 comm="bionic-unit-tes" path="/dev" dev="tmpfs" ino=11405 scontext=u:r:shell:s0 tcontext=u:object_r:device:s0 tclass=dir permissive=0
        avc: denied { getattr } for name="/" dev="mmcblk0p30" ino=2 scontext=u:r:shell:s0 tcontext=u:object_r:labeledfs:s0 tclass=filesystem permissive=0
      
      Bug: 26295417
      Change-Id: Ia85ac91cbd43235c0f8fe0aebafffb8046cc77ec
      f8f937a1
Loading