Skip to content
Snippets Groups Projects
  1. Nov 08, 2017
  2. Oct 24, 2017
    • Tom Cherry's avatar
      Add label for /proc/sys/vm/page-cluster · 8bdb1dab
      Tom Cherry authored
      Test: boot sailfish with no audit when writing to page-cluster
      Change-Id: I2bfebdf9342594d66d95daaec92d71195c93ffc8
      8bdb1dab
    • Tri Vo's avatar
      /proc, /sys access from uncrypt, update_engine, postinstall_dexopt · 04fb82f2
      Tri Vo authored
      New types:
      1. proc_random
      2. sysfs_dt_firmware_android
      
      Labeled:
      1. /proc/sys/kernel/random as proc_random.
      2. /sys/firmware/devicetree/base/firmware/android/{compatible, fstab,
      vbmeta} as sysfs_dt_firmware_android.
      
      Changed access:
      1. uncrypt, update_engine, postinstall_dexopt have access to generic proc
      and sysfs labels removed.
      2. appropriate permissions were added to uncrypt, update_engine,
      update_engine_common, postinstall_dexopt.
      
      Bug: 67416435
      Bug: 67416336
      Test: fake ota go/manual-ab-ota runs without denials
      Test: adb sideload runs without denials to new types
      Change-Id: Id31310ceb151a18652fcbb58037a0b90c1f6505a
      04fb82f2
  3. Oct 20, 2017
    • Tri Vo's avatar
      Restrict netd fwk policy. · 8dabc2ce
      Tri Vo authored
      Remove netd access to sysfs_type attribute.
      
      These were moved from vendor to fwk policy:
      1. sysfs_net type declaration
      2. labeling of /sys/devices/virtual/net with sysfs_net
      3. netd access to sysfs_net
      
      Bug: 65643247
      Test: can browse internet without netd denials
      Test: netd_unit_test, netd_integration_test without netd denials
      Merged-In: Ic1b95a098f438c4c6bc969bee801bf7dd1a13f6e
      Change-Id: Ic1b95a098f438c4c6bc969bee801bf7dd1a13f6e
      (cherry picked from commit e62a56b7)
      8dabc2ce
  4. Oct 19, 2017
  5. Oct 12, 2017
    • Tri Vo's avatar
      Label system_server's dependencies in sysfs. · 1960215c
      Tri Vo authored
      New types:
      sysfs_android_usb
      sysfs_ipv4
      sysfs_power
      sysfs_rtc
      sysfs_switch
      sysfs_wakeup_reasons
      
      Labeled:
      /sys/class/android_usb, /sys/devices/virtual/android_usb ->sysfs_android_usb
      /sys/class/rtc -> sysfs_rtc
      /sys/class/switch, /sys/devices/virtual/switch -> sysfs_switch
      /sys/power/state, /sys/power/wakeup_count -> sysfs_power
      /sys/kernel/ipv4 -> sysfs_ipv4
      /sys/kernel/wakeup_reasons -> sysfs_wakeup_reasons
      
      Removed access to sysfs and sysfs_type from system_server and added
      appropriate access to new types.
      
      Bug: 65643247
      Test: sailfish boots without violation from system_server or to new labels.
      Change-Id: I27250fd537d76c8226defa138d84fe2a4ce2d5d5
      1960215c
  6. Oct 10, 2017
    • Tao Bao's avatar
      Create sysfs_dm label. · 5b4bea43
      Tao Bao authored
      Prior to this CL, /sys/devices/virtual/block/dm-X was using the generic
      sysfs label. This CL creates sysfs_dm label and grants the following
      accesses:
       - update_verifier to read sysfs_dm dir and file at
         /sys/devices/virtual/block/dm-X.
       - vold to write sysfs_dm.
      
      Bug: 63440407
      Test: update_verifier successfully triggers blocks verification and
            marks a sucessful boot;
      Test: No sysfs_dm related denials on sailfish.
      Change-Id: I6349412707800f1bd3a2fb94d4fe505558400c95
      5b4bea43
  7. Oct 06, 2017
    • Tri Vo's avatar
      Extend access to proc/asound/* · 464f59ae
      Tri Vo authored
      Renamed this type:
      proc_asound_cards -> proc_asound
      
      Labeled /proc/asound/devices as proc_asound.
      
      We now use proc_asound type to label files under /proc/asound which we
      want to expose to system components.
      
      Bug: 66988327
      Test: Pixel 2 boots, can play sound with or without headphones, and
      selinux denials to proc_asound are not seen.
      
      Change-Id: I453d9bfdd70eb80931ec9e80f17c8fd0629db3d0
      464f59ae
  8. Sep 26, 2017
  9. Sep 14, 2017
    • Tri Vo's avatar
      Explicitly label logd's dependencies in /proc. · 87ed5e8d
      Tri Vo authored
      labeled /proc/kmsg as proc_kmsg, changed logd's access from proc to
      proc_kmsg, and added a compat mapping.
      
      Bug: 65643247
      Test: device boots without selinux denials to the newly introduced proc_kmsg
      Test: logd-unit-tests passes
      
      Merged-In: I92c9f5694289eb6a94c4d90f14e2de4d46b5228e
      Change-Id: I92c9f5694289eb6a94c4d90f14e2de4d46b5228e
      (partial CP of commit 528da6fe)
      87ed5e8d
  10. Sep 11, 2017
  11. Jul 27, 2017
    • Joel Galenson's avatar
      Move file labeling to genfs_contexts. · 27c0aa7a
      Joel Galenson authored
      This should improve performance, as file_contexts is slower than
      genfs_contexts.
      
      Bug: 62413700
      Test: Built, flashed, and booted Sailfish.  Verified that the
      files have the correct context and that wifi, web, and atrace work.
      
      Merged-In: Ia28707ec565a0792bc882fbffe9e8ab9968535f5
      Change-Id: I9546f3af3c95e3443684ae4764881b69987611ef
      27c0aa7a
  12. Jul 01, 2017
    • Andres Oportus's avatar
      Allow only system_server to read uid_time_in_state · 97b955de
      Andres Oportus authored
      Bug: 62706738
      Bug: 34133340
      Test: Check that uid_time_in_state can't be read from
      the shell without root permissions and that
      "dumpsys batterystats --checkin| grep ctf" shows frequency
      data (system_server was able to read uid_time_in_state)
      
      Change-Id: Ic6a54da4ebcc9e10b0e3af8f14a45d7408e8686e
      (cherry picked from commit 4dc88795)
      97b955de
  13. Jun 06, 2017
    • Jeff Vander Stoep's avatar
      Move sysfs cpu hotplug labeling to genfs_contexts · e5fe6a33
      Jeff Vander Stoep authored
      On Marlin ~120 ms of time is spent relabeling /sys/devices/system/cpu
      every time we come out of suspend. Moving from file_contexts to
      genfs_contexts as the labeling mechanism knocks this down to ~3 ms.
      
      Bug: 32938130
      Test: build and boot Marlin. Verify that files in
          /sys/devices/system/cpu have the proper label before and after
          suspend.
      
      Change-Id: Ie71ea7e3dd5df250cabe4ba9600afbf67e69f720
      e5fe6a33
    • Jeff Vander Stoep's avatar
      Move sysfs cpu hotplug labeling to genfs_contexts · f85be7f8
      Jeff Vander Stoep authored
      On Marlin ~120 ms of time is spent relabeling /sys/devices/system/cpu
      every time we come out of suspend. Moving from file_contexts to
      genfs_contexts as the labeling mechanism knocks this down to ~3 ms.
      
      Bug: 32938130
      Test: build and boot Marlin. Verify that files in
          /sys/devices/system/cpu have the proper label before and after
          suspend.
      
      Change-Id: Ie71ea7e3dd5df250cabe4ba9600afbf67e69f720
      f85be7f8
  14. Mar 16, 2017
    • Jaesoo Lee's avatar
      enabled /sbin/modprobe for recovery mode · d363b0f9
      Jaesoo Lee authored
      This change defines new policy for modprobe (/sbin/modprobe) that should
      be used in both recovery and android mode.
      
      Denials:
      [   16.986440] c0    437 audit: type=1400 audit(6138546.943:5): avc:
      denied  { read } for  pid=437 comm="modprobe" name="modules" dev="proc"
      ino=4026532405 scontext=u:object_r:modprobe:s0
      tcontext=u:object_r:proc:s0 tclass=file permissive=1
      [   16.986521] c0    437 audit: type=1400 audit(6138546.943:6): avc:
      denied  { open } for  pid=437 comm="modprobe" path="/proc/modules"
      dev="proc" ino=4026532405 scontext=u:object_r:modprobe:s0
      tcontext=u:object_r:proc:s0 tclass=file permissive=1
      [   16.986544] c0    437 audit: type=1400 audit(6138546.943:7): avc:
      denied  { getattr } for  pid=437 comm="modprobe" path="/proc/modules"
      dev="proc" ino=4026532405 scontext=u:object_r:modprobe:s0
      tcontext=u:object_r:proc:s0 tclass=file permissive=1
      
      Bug: 35633646
      Test: Build and tested it works in sailfish recovery. The modprobe is
      invoked in init.rc (at the end of 'on init') with following command line
      
          exec u:r:modprobe:s0 -- /sbin/modprobe -a nilfs2 ftl
      
      Change-Id: Ie70be6f918bea6059f806e2eb38cd48229facafa
      d363b0f9
  15. Mar 07, 2017
  16. Mar 03, 2017
    • Nick Kralevich's avatar
      Label /proc/misc · 50bb7b5a
      Nick Kralevich authored
      Label /proc/misc and allow access to untrusted_apps targeting older API
      versions, as well as update_engine_common.
      
      /proc/misc is used by some banking apps to try to detect if they are
      running in an emulated environment.
      
      TODO: Remove access to proc:file from update_engine_common after more
      testing.
      
      Bug: 35917228
      Test: Device boots and no new denials.
      Change-Id: If1b97a9c55a74cb74d1bb15137201ffb95b5bd75
      50bb7b5a
  17. Feb 23, 2017
    • Luis Hector Chavez's avatar
      Restrict /proc/sys/vm/mmap_rnd_bits · 64a05038
      Luis Hector Chavez authored
      Label /proc/sys/vm/mmap_rnd_bits so it is only readable and writable by
      init. This also tightens the neverallow restrictions for proc_security.
      
      Bug: 33563834
      Test: run cts -m CtsPermissionTestCases -t \
            android.permission.cts.FileSystemPermissionTest#testProcfsMmapRndBitsExistsAndSane
      
      Change-Id: Ie7af39ddbf23806d4ffa35e7b19d30fec7b6d410
      64a05038
  18. Feb 16, 2017
    • Nick Kralevich's avatar
      Label /proc/config.gz · 929da014
      Nick Kralevich authored
      Add a label to /proc/config.gz, so we can distinguish this file from
      other /proc files in security policy.
      
      For now, only init is allowed read access. All others are denied.
      TODO: clarify exactly who needs access. Further access will be granted
      in a future commit.
      
      Bug: 35126415
      Test: policy compiles and no device boot problems.
      Change-Id: I8b480890495ce5b8aa3f8c7eb00e14159f177860
      929da014
  19. Jan 18, 2017
    • Jin Qian's avatar
      Define policy for /proc/uid_io/stats · d345906b
      Jin Qian authored
      New procfs file read by storaged to dump fg/bg IO usage.
      
      Remove kmsg rule since it's no longer used by storaged.
      
      Allow storaged to find permission_service to translate UID
      to package name.
      
      Test: adb shell storaged -u
      Bug: 34198239
      Change-Id: I74654662c75571cbe166cf2b8cbab84828218cbd
      d345906b
    • Jeff Sharkey's avatar
      Define policy for /proc/uid_procstat/set. · 828433c8
      Jeff Sharkey authored
      New procfs file written by the system_server to communicate fg/bg
      state of UIDs to switch the statistics counter sets used.
      
      avc: denied { write } for name="set" dev="proc" ino=4026531862 scontext=u:r:system_server:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=1
      
      Test: builds, boots, counter sets updated
      Bug: 34360629
      Change-Id: I2efbfbba9e73f50ce50a80a3dffd3b14fa55c048
      828433c8
  20. Jan 04, 2017
    • Nick Kralevich's avatar
      untrusted_app: allow access to /proc/tty/drivers · e427a2b2
      Nick Kralevich authored
      /proc/tty/drivers is read by applications to figure out if they are
      running in an emulated environment. Specifically, they look for the
      string "goldfish" within that file.
      
      Arguably this is not an Android API, and really shouldn't be exposed to
      applications, but:
      
      1) A largish number of applications break if they can't read this file;
      2) The information here isn't particularly sensitive
      
      While we could spend a bunch of time trying to get applications fixed,
      there are bigger fish to fry. It's not worth the battle.
      
      Test: "ls -laZ /proc/tty/drivers" is labeled properly.
      Bug: 33214085
      Bug: 33814662
      Bug: 33791054
      Bug: 33211769
      Bug: 26813932
      Change-Id: Icc05bdc1c917547a6dca7d76636a1009369bde49
      e427a2b2
  21. 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
  22. Aug 08, 2016
  23. 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
  24. Jul 22, 2016
  25. 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
  26. 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>
      4dafa72a
  27. Mar 07, 2016
  28. Feb 24, 2016
    • dcashman's avatar
      Label /proc/meminfo. · f25ea5f9
      dcashman authored
      Address the following denial:
      m.chrome.canary: type=1400 audit(0.0:15): avc: granted { read open } for path="/proc/meminfo" dev="proc" ino=4026544360 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file
      
      (cherry-pick of internal commit: 971aeeda)
      
      Bug: 22032619
      Chromium Bug: 586021
      
      Change-Id: I2dcb2d4800bbc92ea47c37d4fd7a10f827a0114c
      f25ea5f9
    • dcashman's avatar
      Label /proc/meminfo. · 971aeeda
      dcashman authored
      Address the following denial:
      m.chrome.canary: type=1400 audit(0.0:15): avc: granted { read open } for path="/proc/meminfo" dev="proc" ino=4026544360 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc:s0 tclass=file
      
      Bug: 22032619
      Chromium Bug: 586021
      
      Change-Id: I584345c84d870c313da69ec97a0b1e54c0eb9ee1
      971aeeda
  29. Jul 13, 2015
    • dcashman's avatar
      Give /proc/iomem a more specific label. · 26cd912e
      dcashman authored
      /proc/iomem is currently given the proc label but contains system information
      which should not be available to all processes.
      
      Bug: 22008387
      Change-Id: I4f1821f40113a743ad986d13d8d130ed8b8abf2f
      26cd912e
  30. May 15, 2015
    • Jeff Sharkey's avatar
      drop_caches label, vold scratch space on expanded. · c960596c
      Jeff Sharkey authored
      Define an explicit label for /proc/sys/vm/drop_caches and grant to
      the various people who need it, including vold which uses it when
      performing storage benchmarks.
      
      Also let vold create new directories under it's private storage area
      where the benchmarks will be carried out.  Mirror the definition of
      the private storage area on expanded media.
      
      avc: denied { write } for name="drop_caches" dev="proc" ino=20524 scontext=u:r:vold:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=0
      
      Bug: 21172095
      Change-Id: I300b1cdbd235ff60e64064d3ba6e5ea783baf23f
      c960596c
  31. May 13, 2015
  32. Apr 11, 2015
  33. Feb 25, 2015
    • Nick Kralevich's avatar
      Revert /proc/net related changes · 5cf3994d
      Nick Kralevich authored
      Revert the tightening of /proc/net access. These changes
      are causing a lot of denials, and I want additional time to
      figure out a better solution.
      
      Addresses the following denials (and many more):
      
        avc: denied { read } for comm="SyncAdapterThre" name="stats" dev="proc" ino=X scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file
        avc: denied { read } for comm="facebook.katana" name="iface_stat_fmt" dev="proc" ino=X scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file
        avc: denied { read } for comm="IntentService[C" name="if_inet6" dev="proc" ino=X scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_net:s0 tclass=file
        avc: denied { read } for comm="dumpstate" name="iface_stat_all" dev="proc" ino=X scontext=u:r:dumpstate:s0 tcontext=u:object_r:proc_net:s0 tclass=file
      
      This reverts commit 0f0324cc
      and commit 99940d1a
      
      Bug: 9496886
      Bug: 19034637
      Change-Id: I436a6e3638ac9ed49afbee214e752fe2b0112868
      5cf3994d
  34. Jan 22, 2015
    • Nick Kralevich's avatar
      domain.te: allow /proc/net/psched access · 0f0324cc
      Nick Kralevich authored
      external/sepolicy commit 99940d1a
      (https://android-review.googlesource.com/123331) removed /proc/net
      access from domain.te.
      
      Around the same time, system/core commit
      9a20e67fa62c1e0e0080910deec4be82ebecc922
      (https://android-review.googlesource.com/123531) was checked in.
      This change added libnl as a dependency of libsysutils.
      
      external/libnl/lib/utils.c has a function called get_psched_settings(),
      which is annotated with __attribute__((constructor)). This code
      gets executed when the library is loaded, regardless of whether or
      not other libnl code is executed.
      
      By adding the libnl dependency, even code which doesn't use the
      network (such as vold and logd) ends up accessing /proc/net/psched.
      
      For now, allow this behavior. However, in the future, it would be
      better to break this dependency so the additional code isn't loaded
      into processes which don't need it.
      
      Addresses the following denials:
      
        avc: denied { read } for  pid=148 comm="logd" name="psched" dev="proc" ino=4026536508 scontext=u:r:logd:s0 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0
        avc: denied { read } for pid=152 comm="vold" name="psched" dev="proc" ino=4026536508 scontext=u:r:vold:s0 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0
        avc: denied { read } for pid=930 comm="wpa_supplicant" name="psched" dev="proc" ino=4026536508 scontext=u:r:wpa:s0 tcontext=u:object_r:proc_net:s0 tclass=file permissive=0
      
      Bug: 19079006
      Change-Id: I1b6d2c144534d3f70f0028ef54b470a75bace1cf
      0f0324cc
  35. Sep 26, 2014
    • Nick Kralevich's avatar
      zygote: allow replacing /proc/cpuinfo · f2c01189
      Nick Kralevich authored
      Android's native bridge functionality allows an Android native
      app written on one CPU architecture to run on a different architecture.
      For example, Android ARM apps may run on an x86 CPU.
      
      To support this, the native bridge functionality needs to replace
      /proc/cpuinfo with the version from /system/lib/<ISA>/cpuinfo
      using a bind mount. See commit ab0da5a9a6860046619629b8e6b83692d35dff86
      in system/core.
      
      This change:
      
      1) Creates a new label proc_cpuinfo, and assigns /proc/cpuinfo
      that label.
      2) Grants read-only access to all SELinux domains, to avoid
      breaking pre-existing apps.
      3) Grants zygote mounton capabilities for that file, so zygote
      can replace the file as necessary.
      
      Addresses the following denial:
      
        avc: denied { mounton } for path="/proc/cpuinfo" dev="proc" ino=4026532012 scontext=u:r:zygote:s0 tcontext=u:object_r:proc:s0 tclass=file
      
      Bug: 17671501
      
      (cherry picked from commit 2de02877)
      
      Change-Id: I2c2366bee4fe365288d14bca9778d23a43c368cb
      f2c01189
Loading