Skip to content
Snippets Groups Projects
  1. Dec 18, 2015
    • Nick Kralevich's avatar
      neverallow debugfs access · 96b1c9ca
      Nick Kralevich authored
      Don't allow access to the generic debugfs label. Instead, force
      relabeling to a more specific type. system_server and dumpstate
      are excluded from this until I have time to fix them.
      
      Tighten up the neverallow rules for untrusted_app. It should never
      be reading any file on /sys/kernel/debug, regardless of the label.
      
      Change-Id: Ic7feff9ba3aca450f1e0b6f253f0b56c7918d0fa
      96b1c9ca
  2. Dec 14, 2015
    • Nick Kralevich's avatar
      label /sys/kernel/debug/tracing and remove debugfs write · fe12b616
      Nick Kralevich authored
      Start labeling the directory /sys/kernel/debug/tracing. The files
      in this directory need to be writable to the shell user.
      
      Remove global debugfs:file write access. This was added in the days
      before we could label individual debugfs files.
      
      Change-Id: I79c1fcb63b4b9b903dcabd99b6b25e201fe540a3
      fe12b616
  3. Dec 10, 2015
    • Nick Kralevich's avatar
      Restore sysfs_devices_system_cpu to domain.te · 4e2d2245
      Nick Kralevich authored
      Lots of processes access CPU information. This seems to be triggered
      by libraries loaded into every Android process. Allow the access.
      
      Addresses the following denials:
      
      adbd    : type=1400 audit(0.0:3): avc: denied { search } for name="cpu" dev="sysfs" ino=32 scontext=u:r:adbd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=dir permissive=1
      adbd    : type=1400 audit(0.0:4): avc: denied { read } for name="online" dev="sysfs" ino=34 scontext=u:r:adbd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=file permissive=1
      adbd    : type=1400 audit(0.0:5): avc: denied { open } for path="/sys/devices/system/cpu/online" dev="sysfs" ino=34 scontext=u:r:adbd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=file permissive=1
      adbd    : type=1400 audit(0.0:6): avc: denied { getattr } for path="/sys/devices/system/cpu/online" dev="sysfs" ino=34 scontext=u:r:adbd:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=file permissive=1
      
      Change-Id: Ie7bfae53bdf670028db724d2720447ead42bad35
      4e2d2245
  4. Dec 08, 2015
    • Nick Kralevich's avatar
      Remove property read access for non-core properties · 5a570a4b
      Nick Kralevich authored
      Instead of allowing global read access to all properties,
      only allow read access to the properties which are part of
      core SELinux policy. Device-specific policies are no longer
      readable by default and need to be granted in device-specific
      policy.
      
      Grant read-access to any property where the person has write
      access. In most cases, anyone who wants to write a property
      needs read access to that property.
      
      Change-Id: I2bd24583067b79f31b3bb0940b4c07fc33d09918
      5a570a4b
    • Nick Kralevich's avatar
      Add initial debugfs labeling support and label /sys/kernel/debug/tracing/trace_marker · 44826cb5
      Nick Kralevich authored
      Add initial support for labeling files on /sys/kernel/debug.
      The kernel support was added in https://android-review.googlesource.com/122130
      but the userspace portion of the change was never completed until now.
      
      Start labeling the file /sys/kernel/debug/tracing/trace_marker . This
      is the trace_marker file, which is written to by almost all processes
      in Android. Allow global write access to this file.
      
      This change should be submitted at the same time as the system/core
      commit with the same Change-Id as this patch.
      
      Change-Id: Id1d6a9ad6d0759d6de839458890e8cb24685db6d
      44826cb5
  5. 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
  6. Nov 28, 2015
    • Nick Kralevich's avatar
      Remove domain_deprecated from adbd and shell · 8ca19368
      Nick Kralevich authored
      The extra permissions are not needed. Delete them.
      
      This change also adds read permission for /data/misc/zoneinfo
      back to all domains. libc refernces this directory for timezone
      related files, and it feels dangerous and of little value to
      try to restrict access. In particular, this causes problems when the
      shell user attempts to run "ls -la" to show file time stamps in
      the correct timezone.
      
      Bug: 25433265
      Change-Id: I666bb460e440515151e3bf46fe2e0ac0e7c99f46
      8ca19368
  7. Nov 25, 2015
    • Jeff Vander Stoep's avatar
      Perms back to domain · 9a3d1c6b
      Jeff Vander Stoep authored
      allow reading symlinks in /data and getattr in /system
      
      Change-Id: I8cc9ca056725cf10ebfeef474ebf9c80c5300a73
      9a3d1c6b
  8. Nov 19, 2015
    • Jeff Vander Stoep's avatar
      Move some perms back to domain · aef68b77
      Jeff Vander Stoep authored
      libselinux stats selinuxfs, as does every process that links against
      libselinux such as toolbox. grant:
         allow domain selinuxfs:filesystem getattr;
      
      domain is already granted:
         allow domain self:dir r_dir_perms;
         allow domain self:lnk_file r_file_perms;
         allow domain self:{ fifo_file file } rw_file_perms;
      To make these possible, also grant:
         allow domain proc:dir search;
      
      Change-Id: Ife6cfa2124c9d61bf908ac89a8444676acdb4259
      aef68b77
  9. Nov 16, 2015
  10. Nov 09, 2015
  11. Oct 29, 2015
    • Nick Kralevich's avatar
      Create a new SELinux type for /data/nativetest · e9d261ff
      Nick Kralevich authored
      1) Don't use the generic "system_data_file" for the files in /data/nativetest.
      Rather, ensure it has it's own special label. This allows us to distinguish
      these files from other files in SELinux policy.
      
      2) Allow the shell user to execute files from /data/nativetest, on
      userdebug or eng builds only.
      
      3) Add a neverallow rule (compile time assertion + CTS test) that nobody
      is allowed to execute these files on user builds, and only the shell user
      is allowed to execute these files on userdebug/eng builds.
      
      Bug: 25340994
      Change-Id: I3e292cdd1908f342699d6c52f8bbbe6065359413
      e9d261ff
  12. Oct 28, 2015
    • Nick Kralevich's avatar
      Update text relocation neverallow assertions · 89424bf9
      Nick Kralevich authored
      1) Don't allow any SELinux domain to attempt to perform a text
      relocation on a file from the /system partition. It's not supported
      and should never be attempted.
      
      2) Completely block any non-app SELinux domains from using text
      relocations, regardless of the source.
      
      Bug: 20013628
      Change-Id: I82573398d0d5586264a717a1e400a3dbc7793fe3
      89424bf9
  13. Oct 14, 2015
    • Jeff Vander Stoep's avatar
      Add priv_app domain to global seapp_context · ee9c0b5f
      Jeff Vander Stoep authored
      Assign priviliged apps not signed with the platform key to the priv_app
      domain.
      
      Bug: 22033466
      Change-Id: Idf7fbe7adbdc326835a179b554f96951b69395bc
      ee9c0b5f
    • William Roberts's avatar
      neverallow: domain:file execute and entrypoint · f25304ee
      William Roberts authored
      
      Occasionally, files get labeled with the domain type rather
      than the executable file type. This can work if the author
      uses domain_auto_trans() versus init_daemon_domain(). This
      will cause a lot of issues and is typically not what the
      author intended.
      
      Another case where exec on domain type might occur, is if
      someone attempts to execute a /proc/pid file, this also
      does not make sense.
      
      To prevent this, we add a neverallow.
      
      Change-Id: I39aff58c8f5a2f17bafcd2be33ed387199963b5f
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      f25304ee
  14. Oct 10, 2015
  15. Oct 07, 2015
    • Nick Kralevich's avatar
      delete procrank SELinux domain. · 9e6effa1
      Nick Kralevich authored
      Simplify SELinux policy by deleting the procrank SELinux domain.
      procrank only exists on userdebug/eng builds, and anyone wanting
      to run procrank can just su to root.
      
      Bug: 18342188
      Change-Id: I71adc86a137c21f170d983e320ab55be79457c16
      9e6effa1
    • David Zeuthen's avatar
      Move update_engine policy to AOSP. · a10f789d
      David Zeuthen authored
      The update_engine daemon from Brillo is expected to be used also in
      Android so move its selinux policy to AOSP.
      
      Put update_engine in the whitelist (currently only has the recovery
      there) allowing it to bypass the notallow for writing to partititions
      labeled as system_block_device.
      
      Also introduce the misc_block_device dev_type as update_engine in some
      configurations may need to read/write the misc partition. Start
      migrating uncrypt to use this instead of overly broad
      block_device:blk_file access.
      
      Bug: 23186405
      Test: Manually tested with Brillo build.
      
      Change-Id: Icf8cdb4133d4bbdf14bacc6c0fa7418810ac307a
      a10f789d
  16. Oct 06, 2015
    • Nick Kralevich's avatar
      remove "allow vold block_device:blk_file create_file_perms;" · 7e86e19d
      Nick Kralevich authored
      vold hasn't use the generic "block_device" label since
      commit 273d7ea4 (Sept 2014), and
      the auditallow statement in vold hasn't triggered since that time.
      
      Remove the rule which allows vold access to the generic block_device
      label, and remove the vold exception.
      
      Thanks to jorgelo for reminding me about this.
      
      Change-Id: Idd6cdc20f5be9a40c5c8f6d43bbf902a475ba1c9
      7e86e19d
  17. Sep 22, 2015
  18. Aug 25, 2015
    • Stephen Smalley's avatar
      Only allow toolbox exec where /system exec was already allowed. · a3c97a76
      Stephen Smalley authored
      
      When the toolbox domain was introduced, we allowed all domains to exec it
      to avoid breakage.  However, only domains that were previously allowed the
      ability to exec /system files would have been able to do this prior to the
      introduction of the toolbox domain.  Remove the rule from domain.te and add
      rules to all domains that are already allowed execute_no_trans to system_file.
      Requires coordination with device-specific policy changes with the same Change-Id.
      
      Change-Id: Ie46209f0412f9914857dc3d7c6b0917b7031aae5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      a3c97a76
  19. Aug 24, 2015
  20. Aug 22, 2015
  21. Aug 15, 2015
    • Nick Kralevich's avatar
      allow domain adbd:unix_stream_socket ioctl; · f4d39ca1
      Nick Kralevich authored
      https://android-review.googlesource.com/166419 changed the handling
      of non-interactive adb shells to use a socket instead of a PTY.
      When the stdin/stdout/stderr socket is received by /system/bin/sh,
      the code runs isatty() (ioctl TCGETS) to determine how to handle the
      file descriptor. This is denied by SELinux.
      
      Allow it for all domains.
      
      Addresses the following denial:
      
        avc: denied { ioctl } for pid=4394 comm="sh" path="socket:[87326]" dev="sockfs" ino=87326 ioctlcmd=5401 scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=unix_stream_socket permissive=0
      
      TODO: When kernels are publicly available which support SELinux ioctl
      filtering, limit this just to ioctl 5401 (TCGETS) instead of all ioctls.
      
      Bug: 21215503
      Change-Id: I5c9394f27b8f198d96df14eac4b0c46ecb9b0898
      f4d39ca1
  22. Aug 14, 2015
    • Nick Kralevich's avatar
      mediaserver: remove /system/bin/toolbox exec access · bf65c7ef
      Nick Kralevich authored
      In Android 5.1, mediaserver couldn't execute any file on
      /system. This slightly regressed due to
      8a0c25ef, which granted mediaserver
      access to execute /system/bin/toolbox and /system/bin/toybox
      
      Revoke that unneeded access and add a neverallow rule to prevent
      regressions.
      
      TODO: Remove toolbox_exec:file execute permissions from domain.te
      and add it back to the specific domains that need it.
      
      Change-Id: Ia7bc6028a9ffb723d4623d91cbe15c8c1bbb2eb9
      bf65c7ef
  23. Aug 03, 2015
  24. Aug 02, 2015
    • Nick Kralevich's avatar
      init.te: delete kernel load policy support · 356df327
      Nick Kralevich authored
      Remove the ability to dynamically update SELinux policy on the
      device.
      
      1) This functionality has never been used, so we have no idea if
      it works or not.
      
      2) If system_server is compromised, this functionality allows a
      complete bypass of the SELinux policy on the device. In particular,
      an attacker can force a regression of the following patch
        * https://android-review.googlesource.com/138510
      see also https://code.google.com/p/android/issues/detail?id=181826
      
      3) Dynamic policy update can be used to bypass neverallow protections
      enforced in CTS, by pushing a policy to the device after certification.
      Such an updated policy could bring the device out of compliance or
      deliberately introduce security weaknesses.
      
      Bug: 22885422
      Bug: 8949824
      Change-Id: Id98b5e09d79254816d920b92003efe8dcbe6cd2e
      356df327
  25. Jul 27, 2015
  26. Jul 14, 2015
    • Nick Kralevich's avatar
      neverallow service_manager / service_manager_type · f2c4e128
      Nick Kralevich authored
      Init never uses / add service manager services. It doesn't make
      sense to allow these rules to init. Adding a rule of this type
      is typically caused by a process inappropriately running in init's
      SELinux domain, and the warning message:
      
        Warning!  Service %s needs a SELinux domain defined; please fix!
      
      is ignored.
      
      In addition, add neverallow rules to domain.te which prevent
      nonsense SELinux service_manager rules from being added.
      
      Change-Id: Id04a50d1826fe451a9ed216aa7ab249d0393cc57
      f2c4e128
  27. Jul 13, 2015
    • dcashman's avatar
      Allow domains to read tmpfs symlinks. · 301555e6
      dcashman authored
      Domains have the ability to read normal tmpfs files but not symlinks.
      Grant this ability.  In particular, allow domains to read /mnt/sdcard.
      
      Addresses the following denial:
      type=1400 audit(0.0:19):avc: denied { read } for comm=4173796E635461736B202333 name="sdcard" dev="tmpfs" ino=7475 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:tmpfs:s0 tclass=lnk_file permissive=0
      
      (cherry-pick of commit: 2b0b8299)
      
      Bug: 20755029
      Change-Id: Iaa5dc278b34faf33473d3e49f92d8766ae5563c0
      301555e6
    • dcashman's avatar
      Allow domains to read tmpfs symlinks. · 2b0b8299
      dcashman authored
      Domains have the ability to read normal tmpfs files but not symlinks.
      Grant this ability.  In particular, allow domains to read /mnt/sdcard.
      
      Addresses the following denial:
      type=1400 audit(0.0:19):avc: denied { read } for comm=4173796E635461736B202333 name="sdcard" dev="tmpfs" ino=7475 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:tmpfs:s0 tclass=lnk_file permissive=0
      
      Bug: 20755029
      Change-Id: I0268eb00e0eb43feb2d5bca1723b87b7a44f31a9
      2b0b8299
  28. Jul 08, 2015
    • William Roberts's avatar
      neverallow: domain execute data_file_type · 7028bdcc
      William Roberts authored
      
      To help reduce code injection paths, a neverallow is placed
      to prevent domain, sans untrusted_app and shell, execute
      on data_file_type. A few data_file_type's are also exempt
      from this rule as they label files that should be executable.
      
      Additional constraints, on top of the above, are placed on domains
      system_server and zygote. They can only execute data_file_type's
      of type dalvikcache_data_file.
      
      Change-Id: I15dafbce80ba2c85a03c23128eae4725703d5f02
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      7028bdcc
  29. Jun 23, 2015
    • Stephen Smalley's avatar
      neverallow PROT_EXEC stack or heap. · 5328d974
      Stephen Smalley authored
      
      Despite removing these from AOSP policy they seem to still be
      present in device policies.  Prohibit them via neverallow.
      
      We would also like to minimize execmem to only app domains
      and others using ART, but that will first require eliminating it
      from device-specific service domains (which may only have it
      due to prior incorrect handling of text relocations).
      
      Change-Id: Id1f49566779d9877835497d8ec7537abafadadc4
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      5328d974
    • Jeff Vander Stoep's avatar
      Fix grouper build by allowing mknod in recovery · 9c7570ef
      Jeff Vander Stoep authored
      Change-Id: I2aef01ba72cae028d5e05deddbdeff674f9a534d
      9c7570ef
    • Nick Kralevich's avatar
      Allow /dev/klog access, drop mknod and __null__ access · 31d88a70
      Nick Kralevich authored
      Allow vold, healthd, slideshow, and watchdogd access to /dev/kmsg.
      These processes log to the kernel dmesg ring buffer, so they need
      write access to that file.
      
      Addresses the following denials:
      
          avc: denied { write } for pid=134 comm="watchdogd" name="kmsg" dev="tmpfs" ino=9248 scontext=u:r:watchdogd:s0 tcontext=u:object_r:kmsg_device:s0 tclass=chr_file permissive=0
          avc: denied { write } for pid=166 comm="healthd" name="kmsg" dev="tmpfs" ino=9248 scontext=u:r:healthd:s0 tcontext=u:object_r:kmsg_device:s0 tclass=chr_file permissive=0
          avc: denied { write } for pid=180 comm="vold" name="kmsg" dev="tmpfs" ino=9248 scontext=u:r:vold:s0 tcontext=u:object_r:kmsg_device:s0 tclass=chr_file permissive=0
      
      These denials were triggered by the change in
      https://android-review.googlesource.com/151209 . Prior to that change,
      any code which called klog_init would (unnecessarily) create the
      device node themselves, rather than using the already existing device
      node.
      
      Drop special /dev/__null__ handling from watchdogd. As of
      https://android-review.googlesource.com/148288 , watchdogd no longer
      creates it's own /dev/null device, so it's unnecessary for us
      to allow for it.
      
      Drop mknod from healthd, slideshow, and watchdogd. healthd and slideshow
      only needed mknod to create /dev/__kmsg__, which is now obsolete.
      watchdogd only needed mknod to create /dev/__kmsg__ and /dev/__null__,
      which again is now obsolete.
      
      (cherry picked from e2651972)
      
      Bug: 21242418
      Change-Id: If01c8001084575e7441253f0fa8b4179ae33f534
      31d88a70
  30. Jun 18, 2015
Loading