Skip to content
Snippets Groups Projects
  1. Oct 02, 2014
    • Stephen Smalley's avatar
      Define specific block device types for system and recovery partitions. · 206b1a6c
      Stephen Smalley authored
      
      Define a specific block device type for system so that we can
      prevent raw writes to the system partition by anything other than
      recovery.
      
      Define a specific block device type for recovery so that we
      can prevent raw writes to the recovery partition by anything
      other than install_recovery or recovery.
      
      These types must be assigned to specific block device nodes
      via device-specific policy.  This change merely defines the types,
      adds allow rules so that nothing will break when the types are assigned,
      and adds neverallow rules to prevent adding further allow rules
      on these types.
      
      This change does not remove access to the generic block_device type
      from any domain so nothing should break even on devices without these
      type assignments.
      
      Change-Id: Ie9c1f6d632f6e9e8cbba106f07f6b1979d2a3c4a
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      206b1a6c
  2. Sep 28, 2014
    • Stephen Smalley's avatar
      Do not allow init to execute anything without changing domains. · 8a0c25ef
      Stephen Smalley authored
      
      Remove the ability of init to execute programs from / or /system
      without changing domains.  This forces all helper programs and
      services invoked by init to be assigned their own domain.
      
      Introduce separate domains for running the helper programs
      executed from the fs_mgr library by init.  This requires a domain
      for e2fsck (named fsck for generality) and a domain for running
      mkswap (named toolbox since mkswap is just a symlink to the toolbox
      binary and the domain transition occurs on executing the binary, not
      based on the symlink in any way).
      
      e2fsck is invoked on any partitions marked with the check mount
      option in the fstab file, typically userdata and cache but never
      system.  We allow it to read/write the userdata_block_device and
      cache_block_device types but also allow it to read/write the default
      block_device type until we can get the more specific types assigned
      in all of the device-specific policies.
      
      mkswap is invoked on any swap partition defined in the fstab file.
      We introduce a new swap_block_device type for this purpose, to be
      assigned to any such block devices in the device-specific policies,
      and only allow it to read/write such block devices.  As there seem to be
      no devices in AOSP with swap partitions in their fstab files, this does
      not appear to risk any breakage for existing devices.
      
      With the introduction of these domains, we can de-privilege init to
      only having read access to block devices for mounting filesystems; it
      no longer needs direct write access to such devices AFAICT.
      
      To avoid breaking execution of toolbox by system services, apps, or the shell,
      we allow all domains other than kernel and init the ability to
      run toolbox in their own domain.  This is broader than strictly required;
      we could alternatively only add it to those domains that already had
      x_file_perms to system_file but this would require a coordinated change
      with device-specific policy.
      
      Change-Id: Ib05de2d2bc2781dad48b70ba385577cb855708e4
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      8a0c25ef
  3. Sep 26, 2014
    • Nick Kralevich's avatar
      zygote: allow replacing /proc/cpuinfo · 2de02877
      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
      Change-Id: Ib70624fba2baeccafbc0a41369833f76b976ee20
      2de02877
  4. Sep 20, 2014
    • dcashman's avatar
      Add support for factory reset protection. · f37ce3f3
      dcashman authored
      Address the following denials:
      <12>[  417.732129] type=1400 audit(365340.189:47): avc: denied { read } for pid=1737 comm="Binder_2" name="mmcblk0p18" dev="tmpfs" ino=12406 scontext=u:r:system_server:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=0
      <12>[  417.882126] type=1400 audit(365340.339:48): avc: denied { read } for pid=1737 comm="Binder_2" name="mmcblk0p18" dev="tmpfs" ino=12406 scontext=u:r:system_server:s0 tcontext=u:object_r:block_device:s0 tclass=blk_file permissive=0
      
      (cherrypick of commit 47bd7300)
      
      Bug: 16710840
      Change-Id: I8cb5b4b17dffe14f0bf05d63eb8f6ab8d5c09f53
      f37ce3f3
  5. Sep 18, 2014
    • Nick Kralevich's avatar
      Remove /dev/log/* access · a10bfd88
      Nick Kralevich authored
      The kernel driver has been deprecated by the new userspace
      driver. Don't continue to allow access to the old driver.
      
      Maintain the labeling on /dev/log/* for now, just in case.
      
      Bug: 13505761
      Change-Id: Ibf8ef3af6274ede4262aada9222eaf63f63307b4
      a10bfd88
  6. Aug 22, 2014
    • Nick Kralevich's avatar
      assert that no domain can set default properties · 99aa03dc
      Nick Kralevich authored
      Add a neverallow rule (compile time assertion) that no SELinux domain
      other than init can set default_prop. default_prop is assigned to a
      property when no more specific label exists for that property.
      
      This ensures that all properties are labeled properly, and that
      no-one (other than init) gets access to unknown properties.
      
      Change-Id: If279960f23737e263d4d1b5face7b5c49cda7ae7
      99aa03dc
  7. Aug 21, 2014
    • Nick Kralevich's avatar
      tighten up neverallow rules for init binder operations · 65feafce
      Nick Kralevich authored
      Init never uses binder, so allowing binder related operations
      for init never makes sense. Disallow all binder opertions for
      init.
      
      This change expands on commit a730e50b,
      disallowing any init binder operation, not just call operations, which
      may be accidentally added by blindly running audit2allow.
      
      Change-Id: I12547a75cf68517d54784873846bdadcb60c5112
      65feafce
  8. Jul 28, 2014
  9. Jul 21, 2014
  10. Jul 14, 2014
    • Riley Spahn's avatar
      Add access control for each service_manager action. · b8511e0d
      Riley Spahn authored
      Add SELinux MAC for the service manager actions list
      and find. Add the list and find verbs to the
      service_manager class. Add policy requirements for
      service_manager to enforce policies to binder_use
      macro.
      
      Change-Id: I224b1c6a6e21e3cdeb23badfc35c82a37558f964
      b8511e0d
  11. Jul 10, 2014
    • Nick Kralevich's avatar
      Drop sys_rawio neverallow for tee · b59dc27a
      Nick Kralevich authored
      The new Nexus 5 tee implementation requires raw block I/O
      for anti-rollback protection.
      
      Bug: 15777869
      Change-Id: I57691a9d06b5a51e2699c240783ed56e3a003396
      b59dc27a
  12. Jul 08, 2014
    • Nick Kralevich's avatar
      New domain "install_recovery" · 9f6af083
      Nick Kralevich authored
      Create a new domain for the one-shot init service flash_recovery.
      
      This domain is initially in permissive_or_unconfined() for
      testing. Any SELinux denials won't be enforced for now.
      
      Change-Id: I7146dc154a5c78b6f3b4b6fb5d5855a05a30bfd8
      9f6af083
  13. Jul 07, 2014
    • Nick Kralevich's avatar
      fix build. · 3508d611
      Nick Kralevich authored
        libsepol.check_assertion_helper: neverallow on line 166 of external/sepolicy/domain.te (or line 5056 of policy.conf) violated by allow recovery unlabeled:file { create };
        Error while expanding policy
        make: *** [out/target/product/generic/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery] Error 1
      
      Change-Id: Iddf2cb8d0de2ab445e54a727f01be0b992b45ba5
      3508d611
    • Riley Spahn's avatar
      Add neverallow rules further restricing service_manager. · 76206abc
      Riley Spahn authored
      Add a neverallow rule that prevents domain from adding a
      default_android_service. Add a neverallow rule that prevents
      untrusted_app from ever adding a service through
      servicemanager.
      
      Change-Id: I963671fb1224147bb49ec8f0b6be0dcc91c23156
      76206abc
  14. Jun 23, 2014
    • Stephen Smalley's avatar
      Allow init to relabel rootfs files. · c626a882
      Stephen Smalley authored
      
      This is required for the restorecon /adb_keys in init.rc or
      for any other relabeling of rootfs files to more specific types on
      kernels that support setting security contexts on rootfs inodes.
      
      Addresses denials such as:
        avc: denied { relabelfrom } for comm="init" name="adb_keys" dev="rootfs" ino=1917 scontext=u:r:init:s0 tcontext=u:object_r:rootfs:s0 tclass=file permissive=0
      We do not need to prohibit relabelfrom of such files because our goal
      is to prevent writing to executable files, while relabeling the file
      to another type will take it to a non-executable (or non-writable) type.
      In contrast, relabelto must be prohibited by neverallow so that a
      modified file in a writable type cannot be made executable.
      
      Change-Id: I7595f615beaaa6fa524f3c32041918e197bfbebe
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      c626a882
  15. Jun 19, 2014
    • Stephen Smalley's avatar
      Remove write access to rootfs files. · 04b8a75c
      Stephen Smalley authored
      
      Remove write access to rootfs files from unconfineddomain and
      prevent adding it back via neverallow.  This is only applied to
      regular files, as we are primarily concerned with preventing
      writing to a file that can be exec'd and because creation of
      directories or symlinks in the rootfs may be required for mount
      point directories.
      
      Change-Id: If2c96da03f5dd6f56de97131f6ba9eceea328721
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      04b8a75c
  16. Jun 18, 2014
    • Stephen Smalley's avatar
      Prevent adding transitions to kernel or init domains. · bac4ccce
      Stephen Smalley authored
      
      Add neverallow rules to prohibit adding any transitions into
      the kernel or init domains.  Rewrite the domain self:process
      rule to use a positive permission list and omit the transition
      and dyntransition permissions from this list as well as other
      permissions only checked when changing contexts.  This should be
      a no-op since these permissions are only checked when
      changing contexts but avoids needing to exclude kernel or init
      from the neverallow rules.
      
      Change-Id: Id114b1085cec4b51684c7bd86bd2eaad8df3d6f8
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      bac4ccce
  17. Jun 17, 2014
    • Stephen Smalley's avatar
      Eliminate some duplicated rules. · 00b180df
      Stephen Smalley authored
      
      As reported by sepolicy-analyze -D -P /path/to/sepolicy.
      No semantic difference reported by sediff between the policy
      before and after this change.
      
      Deduplication of selinuxfs read access resolved by taking the
      common rules to domain.te (and thereby getting rid of the
      selinux_getenforce macro altogether).
      
      Change-Id: I4de2f86fe2efe11a167e8a7d25dd799cefe482e5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      00b180df
  18. Jun 16, 2014
    • Stephen Smalley's avatar
      Restrict use of context= mount options. · 75e2ef92
      Stephen Smalley authored
      
      Prior to this change, the init and recovery domains were
      allowed unrestricted use of context= mount options to force
      all files within a given filesystem to be treated as having a
      security context specified at mount time.  The context= mount
      option can be used in device-specific fstab.<board> files
      to assign a context to filesystems that do not support labeling
      such as vfat where the default label of sdcard_external is not
      appropriate (e.g. /firmware on hammerhead).
      
      Restrict the use of context= mount options to types marked with the
      contextmount_type attribute, and then remove write access from
      such types from unconfineddomain and prohibit write access to such
      types via neverallow.  This ensures that the no write to /system
      restriction cannot be bypassed via context= mount.
      
      Change-Id: I4e773fadc9e11328d13a0acec164124ad6e840c1
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      75e2ef92
  19. Jun 12, 2014
    • Nick Kralevich's avatar
      Remove world-read access to /data/dalvik-cache/profiles · 86703051
      Nick Kralevich authored
      Remove /data/dalvik-cache/profiles from domain. Profiling information
      leaks data about how people interact with apps, so we don't want
      the data to be available in all SELinux domains.
      
      Add read/write capabilities back to app domains, since apps need to
      read/write profiling data.
      
      Remove restorecon specific rules. The directory is now created by
      init, not installd, so installd doesn't need to set the label.
      
      Change-Id: Ic1b44009faa30d704855e97631006c4b990a4ad3
      86703051
  20. Jun 11, 2014
    • Stephen Smalley's avatar
      Refactor the shell domains. · 42fb824c
      Stephen Smalley authored
      
      Originally we used the shell domain for ADB shell only and
      the init_shell domain for the console service, both transitioned
      via automatic domain transitions on sh.  So they originally
      shared a common set of rules.  Then init_shell started to be used
      for sh commands invoked by init.<board>.rc files, and we switched
      the console service to just use the shell domain via seclabel entry
      in init.rc.  Even most of the sh command instances in init.<board>.rc
      files have been converted to use explicit seclabel options with
      more specific domains (one lingering use is touch_fw_update service
      in init.grouper.rc).  The primary purpose of init_shell at this point
      is just to shed certain permissions from the init domain when init invokes
      a shell command.  And init_shell and shell are quite different in
      their permission requirements since the former is used now for
      uid-0 processes spawned by init whereas the latter is used for
      uid-shell processes spawned by adb or init.
      
      Given these differences, drop the shelldomain attribute and take those
      rules directly into shell.te.  init_shell was an unconfined_domain(),
      so it loses nothing from this change.  Also switch init_shell to
      permissive_or_unconfined() so that we can see its actual denials
      in the future in userdebug/eng builds.
      
      Change-Id: I6e7e45724d1aa3a6bcce8df676857bc8eef568f0
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      42fb824c
  21. Jun 03, 2014
    • Stephen Smalley's avatar
      Remove domain unlabeled access. · cb23ca92
      Stephen Smalley authored
      https://android-review.googlesource.com/#/c/95900/
      
       added
      allow rules for unlabeled access as needed to all confined
      domains.  Therefore we can remove it from domain.  The only
      other domain that truly needs unlabeled access is init, which
      presently inherits it from unconfineddomain.
      
      Also prevent rules that would permit any confined domain from
      creating new unlabeled files on the system.
      
      Change-Id: I31c6478b42fbf60e3b7893b9578b6ad50170def6
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      cb23ca92
    • Christopher Tate's avatar
      Adjust rules around /data/app entities · 6f6c4255
      Christopher Tate authored
      This is to accomodate migration to (and ongoing support of) a
      new installed-app file topology, in which APK files are placed
      in /data/app/$PACKAGE-rev/, there is a canonical-path symlink
      /data/app/$PACKAGE/ -> /data/app/$PACKAGE-rev/, and the native
      libraries exist not under a top-level /data/app-lib/$PACKAGE-rev
      hard directory, but rather under /data/app/$PACKAGE/lib (when
      referenced by canonical path).
      
      Change-Id: I4f60257f8923c64266d98aa247bffa912e204fb0
      6f6c4255
  22. May 30, 2014
    • Stephen Smalley's avatar
      Restrict /data/security and setprop selinux.reload_policy access. · 3235f61a
      Stephen Smalley authored
      
      Remove /data/security and setprop selinux.reload_policy access
      from unconfineddomain, and only add back what is needed to
      init (system_server already gets the required allow rules via
      the selinux_manage_policy macro).
      
      init (via init.rc post-fs-data) originally creates /data/security
      and may later restorecon it.  init also sets the property (also from
      init.rc post-fs-data) to trigger a reload once /data is mounted.
      The system_server (SELinuxPolicyInstallReceiver in particular) creates
      subdirectories under /data/security for updates, writes files to these
      subdirectories, creates the /data/security/current symlink to the update
      directory, and sets the property to trigger a reload when an update bundle
      is received.
      
      Add neverallow rules to ensure that we do not allow undesired access
      to security_file or security_prop.
      
      This is only truly meaningful if the support for /data/security policies
      is restored, but is harmless otherwise.
      
      Also drop the persist.mmac property_contexts entry; it was never used in
      AOSP, only in our tree (for middleware MAC) and is obsolete.
      
      Change-Id: I5ad5e3b6fc7abaafd314d31723f37b708d8fcf89
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      3235f61a
    • Stephen Smalley's avatar
      Only auditallow unlabeled accesses not allowed elsewhere. · 2c8bf56f
      Stephen Smalley authored
      https://android-review.googlesource.com/#/c/95900/
      
       added further
      unlabeled rules for installd and added explicit unlabeled rules for
      vold and system_server.  Exclude these permissions from the auditallow
      rules on unlabeled so that we only see the ones that would be denied if
      we were to remove the allow domain rules here.
      
      Change-Id: I2b9349ad6606bcb6a74a7e67343a8a9e5d70174c
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      2c8bf56f
  23. May 29, 2014
    • Nick Kralevich's avatar
      Remove /system write from unconfined · 03ce5120
      Nick Kralevich authored
      Don't allow writes to /system from unconfined domains.
      /system is always mounted read-only, and no process should
      ever need to write there.
      
      Allow recovery to write to /system. This is needed to apply OTA
      images.
      
      Change-Id: I11aa8bd0c3b7f53ebe83806a0547ab8d5f25f3c9
      03ce5120
    • Stephen Smalley's avatar
      Protect /data/property. · ad0d0fc7
      Stephen Smalley authored
      
      /data/property is only accessible by root and is used by the init
      property service for storing persistent property values.  Create
      a separate type for it and only allow init to write to the directory
      and files within it.  Ensure that we do not allow access to other domains
      in future changes or device-specific policy via a neverallow rule.
      
      Change-Id: Iff556b9606c5651c0f1bba902e30b59bdd6f063a
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      ad0d0fc7
  24. May 23, 2014
    • Nick Kralevich's avatar
      Assert executable content (mostly) only loaded from /system · 629fbc95
      Nick Kralevich authored
      Add a compile time assertion that most SELinux domains don't
      execute code from outside of the system partition.
      
      Exceptions are listed in the neverallow rule.
      
      Change-Id: I8166e29a269adca11661df3c6cda4448a42ca30d
      629fbc95
    • Stephen Smalley's avatar
      Restrict requesting contexts other than policy-defined defaults. · 356f4be6
      Stephen Smalley authored
      
      Writing to the /proc/self/attr files (encapsulated by the libselinux
      set*con functions) enables a program to request a specific security
      context for various operations instead of the policy-defined defaults.
      The security context specified using these calls is checked by an
      operation-specific permission, e.g. dyntransition for setcon,
      transition for setexeccon, create for setfscreatecon or
      setsockcreatecon, but the ability to request a context at all
      is controlled by a process permission.  Omit these permissions from
      domain.te and only add them back where required so that only specific
      domains can even request a context other than the default defined by
      the policy.
      
      Change-Id: I6a2fb1279318625a80f3ea8e3f0932bdbe6df676
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      356f4be6
  25. May 20, 2014
    • Nick Kralevich's avatar
      make /dev/zero read-write · f007d036
      Nick Kralevich authored
      CTS test luni/src/test/java/libcore/java/nio/BufferTest.java function
      testDevZeroMapRW() requires us to be able to open /dev/zero in read-write
      mode. Allow it.
      
      Change-Id: I2be266875b1d190188376fd84c0996039d3c1524
      f007d036
  26. May 19, 2014
    • Nick Kralevich's avatar
      Suppress installd auditallow · 7a186b3f
      Nick Kralevich authored
      installd is expected to be handling unlabeled apps. Don't
      emit an audit rule when it occurs.
      
      Change-Id: Ia173914ff4d1b8368a18f326494eda8173d30192
      7a186b3f
  27. May 17, 2014
    • Nick Kralevich's avatar
      Bring back the unlabeled allowall rules · 5ce079b9
      Nick Kralevich authored
      On an upgrade from 4.2 to tip-of-tree master, there are still a
      number of files which aren't properly labeled. Restore the
      unlabeled compat rules until we can get everything properly
      labeled. It's not ideal, but it works around the immediate
      problem.
      
      After applying https://android-review.googlesource.com/94966 ,
      I'm still seeing the following denials.
      
      <4>[   12.040639] type=1400 audit(1400289656.430:4): avc:  denied  { read } for  pid=143 comm="installd" name="0" dev=mmcblk0p9 ino=32194 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=lnk_file
      <4>[  168.289170] type=1400 audit(1400289812.680:5): avc:  denied  { getattr } for  pid=1079 comm="system_server" path="/data/data/com.android.backupconfirm" dev=mmcblk0p9 ino=112676 scontext=u:r:system_server:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir
      <4>[  169.088406] type=1400 audit(1400289813.480:6): avc:  denied  { read } for  pid=143 comm="installd" name="com.android.location.fused" dev=mmcblk0p9 ino=112720 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir
      <4>[  169.088790] type=1400 audit(1400289813.480:7): avc:  denied  { open } for  pid=143 comm="installd" name="com.android.location.fused" dev=mmcblk0p9 ino=112720 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir
      <4>[  169.089205] type=1400 audit(1400289813.480:8): avc:  denied  { write } for  pid=143 comm="installd" name="com.android.location.fused" dev=mmcblk0p9 ino=112720 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir
      <4>[  169.089615] type=1400 audit(1400289813.480:9): avc:  denied  { remove_name } for  pid=143 comm="installd" name="lib" dev=mmcblk0p9 ino=112721 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir
      <4>[  169.090024] type=1400 audit(1400289813.480:10): avc:  denied  { unlink } for  pid=143 comm="installd" name="lib" dev=mmcblk0p9 ino=112721 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=lnk_file
      <4>[  169.090350] type=1400 audit(1400289813.480:11): avc:  denied  { rmdir } for  pid=143 comm="installd" name="com.android.renderscript.cache" dev=mmcblk0p9 ino=112902 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=dir
      <4>[  171.875822] type=1400 audit(1400289816.260:12): avc:  denied  { unlink } for  pid=143 comm="installd" name="8882B60ADE91B9E4.toc" dev=mmcblk0p9 ino=112903 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
      <4>[  180.615263] type=1400 audit(1400289825.000:13): avc:  denied  { rename } for  pid=143 comm="installd" name="BackupTransport.backupScheduler.xml" dev=mmcblk0p9 ino=112852 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
      <4>[  180.615578] type=1400 audit(1400289825.000:14): avc:  denied  { setattr } for  pid=143 comm="installd" name="BackupTransport.backupScheduler.xml" dev=mmcblk0p9 ino=112852 scontext=u:r:installd:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
      <4>[  393.934310] type=1400 audit(1400290038.320:15): avc:  denied  { read } for  pid=2410 comm="d.process.acore" name="0" dev=mmcblk0p9 ino=32194 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:unlabeled:s0 tclass=lnk_file
      <4>[  399.370936] type=1400 audit(1400290043.760:16): avc:  denied  { read } for  pid=2998 comm="SharedPreferenc" name="BackupTransport.backupScheduler.xml" dev=mmcblk0p9 ino=112852 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
      <4>[  399.371792] type=1400 audit(1400290043.760:17): avc:  denied  { getattr } for  pid=2998 comm="SharedPreferenc" path="/data/data/com.google.android.backuptransport/shared_prefs/BackupTransport.backupScheduler.xml" dev=mmcblk0p9 ino=112852 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
      <4>[  399.372219] type=1400 audit(1400290043.760:18): avc:  denied  { open } for  pid=2998 comm="SharedPreferenc" name="BackupTransport.backupScheduler.xml" dev=mmcblk0p9 ino=112852 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
      
      Change-Id: I65dcfa8e77a63cb61551a1010358f0e45956dbbf
      5ce079b9
  28. May 14, 2014
  29. May 12, 2014
    • Nick Kralevich's avatar
      Revisit kernel setenforce · abae8a9b
      Nick Kralevich authored
      Kernel userspace helpers may be spawned running in the kernel
      SELinux domain. Those userspace helpers shouldn't be able to turn
      SELinux off.
      
      This change revisits the discussion in
      https://android-review.googlesource.com/#/c/71184/
      
      At the time, we were debating whether or not to have an allow rule,
      or a dontaudit rule. Both have the same effect, as at the time we
      switch to enforcing mode, the kernel is in permissive and the operation
      will be allowed.
      
      Change-Id: If335a5cf619125806c700780fcf91f8602083824
      abae8a9b
  30. May 09, 2014
  31. May 08, 2014
    • Stephen Smalley's avatar
      Drop rw access to unlabeled files. · e69a32a1
      Stephen Smalley authored
      
      Should no longer be required due to restorecon_recursive of /data
      by init.rc (covers everything outside of /data/data) and due to
      restorecon_recursive of /data/data by installd (covers /data/data
      directories).
      
      Move the neverallow rule on relabelto to the neverallow section.
      We could potentially drop this altogether, along with the relabelto_domain
      macro and its callers, since its motivation was to provide some
      safeguard in spite of allowing relabelfrom to unlabeled files for
      all domains and this change removes relabelfrom.
      
      unconfined still retains rw access to unlabeled, as do specific domains
      that are explicitly allowed it.
      
      Change-Id: Ied84f8b4b1a0896c1b9f7d783b7463ce09d4807b
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      e69a32a1
  32. Apr 18, 2014
    • Stephen Smalley's avatar
      Audit accesses on unlabeled files. · 25628434
      Stephen Smalley authored
      
      To see whether we can safely remove these allow rules on unlabeled files
      since we now have restorecon_recursive /data in init.rc to fully relabel
      legacy userdata partitions, audit all accesses on such files.
      
      Exclude the init domain since it performs the restorecon_recursive /data
      and therefore will read unlabeled directories, stat unlabeled files,
      and relabel unlabeled directories and files on upgrade.  init may also
      create/write unlabeled files in /data prior to the restorecon_recursive
      /data being called.
      
      Exclude the kernel domain for search on unlabeled:dir as this happens
      during cgroup filesystem initialization in the kernel as a side effect
      of populating the cgroup directory during the superblock initialization
      before SELinux has set the label on the root directory.
      
      Change-Id: Ieb5d807f529db9a4bf3e6c93e6b37c9648c04633
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      25628434
  33. Apr 09, 2014
    • Stephen Smalley's avatar
      Define a type for /data/dalvik-cache/profiles. · 19c50903
      Stephen Smalley authored
      
      I9b8e59e3bd7df8a1bf60fa7ffd376a24ba0eb42f added a profiles
      subdirectory to /data/dalvik-cache with files that must be
      app-writable.  As a result, we have denials such as:
      W/Profiler( 3328): type=1400 audit(0.0:199): avc:  denied  { write } for  name="com.google.android.setupwizard" dev="mmcblk0p28" ino=106067 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file
      W/Profiler( 3328): type=1300 audit(0.0:199): arch=40000028 syscall=322 per=800000 success=yes exit=33 a0=ffffff9c a1=b8362708 a2=20002 a3=0 items=1 ppid=194 auid=4294967295 uid=10019 gid=10019 euid=10019 suid=10019 fsuid=10019 egid=10019 sgid=10019 fsgid=10019 tty=(none) ses=4294967295 exe="/system/bin/app_process" subj=u:r:untrusted_app:s0 key=(null)
      W/auditd  (  286): type=1307 audit(0.0:199):  cwd="/"
      W/auditd  (  286): type=1302 audit(0.0:199): item=0 name="/data/dalvik-cache/profiles/com.google.android.setupwizard" inode=106067 dev=b3:1c mode=0100664 ouid=1012 ogid=50019 rdev=00:00 obj=u:object_r:dalvikcache_data_file:s0
      
      We do not want to allow untrusted app domains to write to the
      existing type on other /data/dalvik-cache files as that could be used
      for code injection into another app domain, the zygote or the system_server.
      So define a new type for this subdirectory.  The restorecon_recursive /data
      in init.rc will fix the labeling on devices that already have a profiles
      directory created.  For correct labeling on first creation, we also need
      a separate change to installd under the same change id.
      
      Bug: 13927667
      Change-Id: I4857d031f9e7e60d48b8c72fcb22a81b3a2ebaaa
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      19c50903
  34. Mar 10, 2014
    • Stephen Smalley's avatar
      Deduplicate neverallow rules on selinuxfs operations. · 853ffaad
      Stephen Smalley authored
      
      We already have neverallow rules for all domains about
      loading policy, setting enforcing mode, and setting
      checkreqprot, so we can drop redundant ones from netd and appdomain.
      Add neverallow rules to domain.te for setbool and setsecparam
      and exclude them from unconfined to allow fully eliminating
      separate neverallow rules on the :security class from anything
      other than domain.te.
      
      Change-Id: I0122e23ccb2b243f4c5376893e0c894f01f548fc
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      853ffaad
  35. Mar 06, 2014
Loading