Skip to content
Snippets Groups Projects
  1. 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
      Create a separate recovery policy. · e60723ab
      Stephen Smalley authored
      
      Create a separate recovery policy and only include the
      recovery domain allow rules in it.
      
      Change-Id: I444107f9821eabf4164ba07a44d03bd71e719989
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      e60723ab
    • Nick Kralevich's avatar
    • Stephen Smalley's avatar
      Explictly allow init and kernel unlabeled access. · 73b0346a
      Stephen Smalley authored
      
      These permissions are already allowed indirectly via unconfineddomain
      and via domain, but ultimately we plan to remove them from those two
      attributes.  Explicitly allow the ones we expect to be required,
      matching the complement of the auditallow rules in domain.te.
      
      Change-Id: I43edca89d59c159b97d49932239f8952a848031c
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      73b0346a
    • 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
  2. May 29, 2014
    • Stephen Smalley's avatar
      Allow installd, vold, system_server unlabeled access. · f85c1fc2
      Stephen Smalley authored
      The bugs that motivated bringing back the unlabeled allowall rules,
      https://android-review.googlesource.com/#/c/94971/
      should be resolved by the following changes:
      https://android-review.googlesource.com/#/c/94966/
      https://android-review.googlesource.com/#/c/96080/
      
      
      
      Beyond those changes, installd needs to be able to remove package directories
      for apps that no longer exist or have moved (e.g. to priv-app) on upgrades, so
      allow it the permissions required for this purpose.  vold needs to be able
      to chown/chmod/restorecon files in asec containers so allow it the
      permissions to do so.  system_server tries to access all /data/data
      subdirectories so permit it to do so.  installd and system_server
      read the pkg.apk file before it has been relabeled by vold and therefore
      need to read unlabeled files.
      
      Change-Id: I70da7d605c0d037eaa5f3f5fda24f5e7715451dc
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      f85c1fc2
    • Stephen Smalley's avatar
      Clean up kernel, init, and recovery domains. · eb1bbf26
      Stephen Smalley authored
      
      Narrow the relabelto rules to a more specific type set
      for each domain.
      
      Drop mount permissions from the kernel domain since mounting
      occurs after switching to the init domain.  This was likely
      a residual of when all processes were left in the kernel domain
      on a recovery boot due to the missing setcon statement in the
      recovery init.rc.
      
      Be consistent with unlabeled filesystems (i.e. filesystems
      without any matching fs_use or genfs_contexts entry) so
      that we can also unmount them.
      
      Add comments to note the reason for various rules.
      
      Change-Id: I269a1744ed7bf8c6be899494c5dc97847e5a994d
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      eb1bbf26
    • Nick Kralevich's avatar
      4553074c
    • 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
    • Nick Kralevich's avatar
      Merge "Label ril.cdma with radio_prop." · d6aa23df
      Nick Kralevich authored
      d6aa23df
    • 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
    • Stephen Smalley's avatar
      Label ril.cdma with radio_prop. · 3a099879
      Stephen Smalley authored
      
      Resolves denials such as:
      avc:  denied  { set } for property=ril.cdma.inecmmode scontext=u:r:radio:s0 tcontext=u:object_r:rild_prop:s0 tclass=property_service
      
      This makes ril.cdma consistent with net.cdma.
      
      We may ultimately need to coalesce rild_prop and radio_prop; they
      were an attempt to distinguish what can be set by rild from what can be
      set by com.android.phone, but the init property service DAC checking
      permits any of them to be set by anything with the radio AID.  We
      presently allow rild to set either type, but radio can only set radio_prop.
      
      Change-Id: Ia3852db187e52427e18075e24b2beab19dd59c1f
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      3a099879
    • Nick Kralevich's avatar
      Merge "remove syslog_* from unconfined" · c8859c2d
      Nick Kralevich authored
      c8859c2d
  3. May 28, 2014
  4. May 27, 2014
    • Nick Kralevich's avatar
      dontaudit su · af7deffb
      Nick Kralevich authored
      Denials generated from the su domain aren't meaningful security
      warnings, and just serve to confuse people. Don't log them.
      
      Change-Id: Id38314d4e7b45062c29bed63df4e50e05e4b131e
      af7deffb
    • Stephen Smalley's avatar
      Restore system_app access to system-owned /data directories. · f1ea707a
      Stephen Smalley authored
      
      System UID apps want to be able to create/write to system-owned
      /data directories outside of their own /data/data package directory,
      such as /data/system/cache and /data/misc/keychain.  Restore access
      (which was removed by Ifa10e3283b07f6bd6ecc16eceeb663edfd756cea when
      system_app_data_file was introduced for the /data/data package
      directories of system UID apps), but audit writes to system_data_file
      so we can look at introducing separate types for these directories in
      the future and ultimately remove access to the rest of the system-owned
      data.
      
      Change-Id: I573f120f23f2dd2d228aa738b31ad2cb3044ec6e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      f1ea707a
    • Nick Kralevich's avatar
    • Nick Kralevich's avatar
    • Stephen Smalley's avatar
      Remove setting /proc/self/attr/* from unconfined. · f853715d
      Stephen Smalley authored
      
      Change I6a2fb1279318625a80f3ea8e3f0932bdbe6df676 removed
      these permissions from domain.te and added them to specific domains
      as required.  Remove the permissions from unconfineddomain as well
      so that they are only allowed where explicitly allowed.  The earlier
      change already added the necessary permissions to init, kernel,
      and recovery so we do not need to add them here.
      
      Change-Id: Ifeb5438532a7525e64328e1c54b436e9b6f7fd3b
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      f853715d
    • Torne (Richard Coles)'s avatar
      Define SELinux policy for RELRO sharing support. · 9786af2b
      Torne (Richard Coles) authored
      Define a domain and appropriate access rules for shared RELRO files
      (used for loading the WebView native library). Any app is permitted to
      read the files as they are public data, but only the shared_relro
      process is permitted to create/update them.
      
      Bug: 13005501
      Change-Id: I9d5ba9e9eedb9b8c80fe6f84a3fc85a68553d52e
      9786af2b
  5. 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
    • Nick Kralevich's avatar
      Introduce wakelock_use() · 8599e34b
      Nick Kralevich authored
      Introduce wakelock_use(). This macro declares that a domain uses
      wakelocks.
      
      Wakelocks require both read-write access to files in /sys/power, and
      CAP_BLOCK_SUSPEND. This macro helps ensure that both capabilities and
      file access are granted at the same time.
      
      Still TODO: fix device specific wakelock use.
      
      Change-Id: Ib98ff374a73f89e403acd9f5e024988f59f08115
      8599e34b
    • Nick Kralevich's avatar
      ccb9f7a1
    • 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
  6. May 22, 2014
    • Nick Kralevich's avatar
      Label /dev/socket/zygote_secondary · 7cba5da2
      Nick Kralevich authored
      zygote_secondary talks over a different socket named
      /dev/socket/zygote_secondary. Make sure it's properly labeled.
      
      See https://android-review.googlesource.com/89604
      
      Addresses the following denial:
      
      <12>[   48.442004] type=1400 audit(1400801842.179:5): avc:  denied  { write } for  pid=1082 comm="main" name="zygote_secondary" dev="tmpfs" ino=9953 scontext=u:r:system_server:s0 tcontext=u:object_r:socket_device:s0 tclass=sock_file permissive=1
      
      Bug: 13647418
      Change-Id: I1ff5f1d614295a5870bb8a3992ad9167e1656c92
      7cba5da2
    • Nick Kralevich's avatar
      Fix use of valgrind via app wrapping · 4fce0ef9
      Nick Kralevich authored
      On userdebug / eng builds, Android supports the concept of app wrapping.
      You can run an app wrapped by another process. This is traditionally used
      to run valgrind on apps, looking for memory leaks and other problems.
      
      App wrapping is enabled by running the following command:
      
        adb shell setprop wrap.com.android.foo "TMPDIR=/data/data/com.android.foo logwrapper valgrind"
      
      Valgrind attempts to mmap exec /system/bin/app_process, which is being denied
      by SELinux. Allow app_process exec.
      
      Addresses the following denial:
      
        <4>[   82.643790] type=1400 audit(16301075.079:26): avc:  denied  { execute } for  pid=1519 comm="memcheck-arm-li" path="/system/bin/app_process32" dev="mmcblk0p25" ino=61 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:zygote_exec:s0 tclass=file
      
      Bug: 15146424
      
      Change-Id: I65394938c53da9252ea57856d9f2de465bb30c25
      4fce0ef9
  7. May 20, 2014
  8. 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
  9. 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
    • Elliott Hughes's avatar
      7d755eb2
    • Elliott Hughes's avatar
      Allow readlink(2) of /proc from debuggerd. · 38138c24
      Elliott Hughes authored
      Bug: 15021938
      Change-Id: Id815640302efde3ae089da33ff8e2cb7daee8bfd
      38138c24
  10. May 16, 2014
Loading