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
      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
    • 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. May 14, 2014
  8. 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
  9. May 09, 2014
  10. 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
  11. 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
  12. 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
  13. 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
  14. Mar 06, 2014
  15. Mar 05, 2014
    • Stephen Smalley's avatar
      Address system_server denials. · 3dad7b61
      Stephen Smalley authored
      
      Label /proc/sysrq-trigger and allow access.
      Label /dev/socket/mtpd and allow access.
      
      Resolves denials such as:
      avc:  denied  { getattr } for  pid=12114 comm="Binder_2" path="socket:[219779]" dev="sockfs" ino=219779 scontext=u:r:untrusted_app:s0 tcontext=u:r:system_server:s0 tclass=tcp_socket
      
      avc:  denied  { call } for  pid=1007 comm="Binder_8" scontext=u:r:system_server:s0 tcontext=u:r:su:s0 tclass=binder
      
      avc:  denied  { write } for  pid=1024 comm="watchdog" name="sysrq-trigger" dev="proc" ino=4026533682 scontext=u:r:system_server:s0 tcontext=u:object_r:proc:s0 tclass=file
      
      avc:  denied  { write } for  pid=11567 comm="LegacyVpnRunner" name="mtpd" dev="tmpfs" ino=36627 scontext=u:r:system_server:s0 tcontext=u:object_r:socket_device:s0 tclass=sock_file
      
      avc:  denied  { ptrace } for  pid=10924 comm=5369676E616C2043617463686572 scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=process
      
      avc:  denied  { sigkill } for  pid=26077 comm="NativeCrashRepo" scontext=u:r:system_server:s0 tcontext=u:r:zygote:s0 tclass=process
      
      avc:  denied  { write } for  pid=1024 comm="android.bg" scontext=u:r:system_server:s0 tcontext=u:r:system_server:s0 tclass=netlink_socket
      
      avc:  denied  { getattr } for  pid=473 comm="FinalizerDaemon" path="socket:[11467]" dev="sockfs" ino=11467 scontext=u:r:system_server:s0 tcontext=u:r:mediaserver:s0 tclass=tcp_socket
      
      avc:  denied  { getattr } for  pid=473 comm="FinalizerDaemon" path="socket:[12076]" dev="sockfs" ino=12076 scontext=u:r:system_server:s0 tcontext=u:r:mediaserv
      er:s0 tclass=udp_socket
      
      avc:  denied  { getopt } for  pid=473 comm="FinalizerDaemon" laddr=192.168.159.172 lport=51576 faddr=93.127.173.40 fport=554 scontext=u:r:system_server:s0 tcontext=u:r:mediaserver:s0 tclass=tcp_socket
      
      avc:  denied  { getopt } for  pid=473 comm="FinalizerDaemon" lport=15658 scontext=u:r:system_server:s0 tcontext=u:r:mediaserver:s0 tclass=udp_socket
      
      avc:  denied  { read write } for  pid=21384 comm="rtsp" path="socket:[443742]"
      dev="sockfs" ino=443742 scontext=u:r:system_server:s0 tcontext=u:r:mediaserver:s
      0 tclass=tcp_socket
      
      avc:  denied  { read write } for  pid=21384 comm="rtsp" path="socket:[444842]" dev="sockfs" ino=444842 scontext=u:r:system_server:s0 tcontext=u:r:mediaserver:s0 tclass=udp_socket
      
      avc:  denied  { setopt } for  pid=1326 comm="Binder_9" lport=16216 scontext=u:r:system_server:s0 tcontext=u:r:mediaserver:s0 tclass=udp_socket
      
      avc:  denied  { setopt } for  pid=1676 comm="Binder_6" laddr=192.168.156.130 lport=51044 faddr=74.125.214.81 fport=554 scontext=u:r:system_server:s0 tcontext=u:r:mediaserver:s0 tclass=tcp_socket
      
      avc:  denied  { getattr } for  pid=10915 comm="system_server" path="/dev/mdm" dev="tmpfs" ino=7484 scontext=u:r:system_server:s0 tcontext=u:object_r:radio_device:s0 tclass=chr_file
      
      avc:  denied  { read } for  pid=10915 comm="system_server" name="mdm" dev="tmpfs" ino=7484 scontext=u:r:system_server:s0 tcontext=u:object_r:radio_device:s0 tclass=chr_file
      
      avc:  denied  { unlink } for  pid=14866 comm="system_server" name="wallpaper" dev="mmcblk0p9" ino=285715 scontext=u:r:system_server:s0 tcontext=u:object_r:wallpaper_file:s0 tclass=file
      
      avc:  denied  { getattr } for  pid=12114 comm="Binder_2" path="socket:[219779]" dev="sockfs" ino=219779 scontext=u:r:untrusted_app:s0 tcontext=u:r:system_server:s0 tclass=tcp_socket
      
      avc:  denied  { getopt } for  pid=32300 comm="Binder_1" laddr=::ffff:127.0.0.1 lport=4939 faddr=::ffff:127.0.0.1 fport=53318 scontext=u:r:untrusted_app:s0 tcontext=u:r:system_server:s0 tclass=tcp_socket
      
      avc:  denied  { read write } for  pid=10840 comm="pool-17-thread-" path="socket:[205990]" dev="sockfs" ino=205990 scontext=u:r:untrusted_app:s0 tcontext=u:r:system_server:s0 tclass=tcp_socket
      
      avc:  denied  { write } for  pid=20817 comm="dumpsys" path="/mnt/shell/emulated/0/aupt-output/bugreport-2014-02-22-11-17-16.txt.tmp" dev="fuse" ino=3100784040 scontext=u:r:system_server:s0 tcontext=u:object_r:sdcard_internal:s0 tclass=file
      
      Change-Id: I481ac26667b487031a5d3317b0a028a027a8e641
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      3dad7b61
  16. Feb 25, 2014
    • Stephen Smalley's avatar
      Clean up socket rules. · 16011320
      Stephen Smalley authored
      
      Replace * or any permission set containing create with
      create_socket_perms or create_stream_socket_perms.
      
      Add net_domain() to all domains using network sockets and
      delete rules already covered by domain.te or net.te.
      
      For netlink_route_socket, only nlmsg_write needs to be separately
      granted to specific domains that are permitted to modify the routing
      table.   Clarification:  read/write permissions are just ability to
      perform read/recv() or write/send() on the socket, whereas nlmsg_read/
      nlmsg_write permissions control ability to observe or modify the
      underlying kernel state accessed via the socket.
      See security/selinux/nlmsgtab.c in the kernel for the mapping of
      netlink message types to nlmsg_read or nlmsg_write.
      
      Delete legacy rule for b/12061011.
      
      This change does not touch any rules where only read/write were allowed
      to a socket created by another domain (inherited across exec or
      received across socket or binder IPC).  We may wish to rewrite some or all
      of those rules with the rw_socket_perms macro but that is a separate
      change.
      
      Change-Id: Ib0637ab86f6d388043eff928e5d96beb02e5450e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      16011320
  17. Feb 24, 2014
  18. Feb 19, 2014
    • Nick Kralevich's avatar
      initial policy for uncrypt. · 96eeb1ec
      Nick Kralevich authored
      Add initial support for uncrypt, started via the
      pre-recovery service in init.rc. On an encrypted device,
      uncrypt reads an OTA zip file on /data, opens the underlying
      block device, and writes the unencrypted blocks on top of the
      encrypted blocks. This allows recovery, which can't normally
      read encrypted partitions, to reconstruct the OTA image and apply
      the update as normal.
      
      Add an exception to the neverallow rule for sys_rawio. This is
      needed to support writing to the raw block device.
      
      Add an exception to the neverallow rule for unlabeled block devices.
      The underlying block device for /data varies between devices
      within the same family (for example, "flo" vs "deb"), and the existing
      per-device file_context labeling isn't sufficient to cover these
      differences. Until I can resolve this problem, allow access to any
      block devices.
      
      Bug: 13083922
      Change-Id: I7cd4c3493c151e682866fe4645c488b464322379
      96eeb1ec
  19. Feb 12, 2014
  20. Feb 11, 2014
  21. Feb 04, 2014
    • Mark Salyzyn's avatar
      sepolicy: Add write_logd, read_logd & control_logd · 8ed750e9
      Mark Salyzyn authored
      - Add write_logd, read_logd and control_logd macros added along
        with contexts for user space logd.
      - Specify above on domain wide, or service-by-service basis
      - Add logd rules.
      - deprecate access_logcat as unused.
      - 'allow <domain> zygote:unix_dgram_socket write;' rule added to
        deal with fd inheritance. ToDo: investigate means to allow
        references to close, and reopen in context of application
        or call setsockcreatecon() to label them in child context.
      
      Change-Id: I35dbb9d5122c5ed9b8c8f128abf24a871d6b26d8
      8ed750e9
  22. Feb 03, 2014
  23. Jan 30, 2014
    • Stephen Smalley's avatar
      Remove MAC capabilities from unconfined domains. · 04ee5dfb
      Stephen Smalley authored
      
      Linux defines two capabilities for Mandatory Access Control (MAC)
      security modules, CAP_MAC_OVERRIDE (override MAC access restrictions)
      and CAP_MAC_ADMIN (allow MAC configuration or state changes).
      SELinux predates these capabilities and did not originally use them,
      but later made use of CAP_MAC_ADMIN as a way to control the ability
      to set security context values unknown to the currently loaded
      SELinux policy on files.  That facility is used in Linux for e.g.
      livecd creation where a file security context that is being set
      on a generated filesystem is not known to the build host policy.
      Internally, files with such labels are treated as having the unlabeled
      security context for permission checking purposes until/unless the
      context is later defined through a policy reload.
      
      CAP_MAC_OVERRIDE is never checked by SELinux, so it never needs
      to be allowed.  CAP_MAC_ADMIN is only checked if setting an
      unknown security context value; the only legitimate use I can see
      in Android is the recovery console, where a context may need to be set
      on /system that is not defined in the recovery policy.
      
      Remove these capabilities from unconfined domains, allow
      mac_admin for the recovery domain, and add neverallow rules.
      
      Change-Id: Ief673e12bc3caf695f3fb67cabe63e68f5f58150
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      04ee5dfb
  24. Jan 23, 2014
    • Nick Kralevich's avatar
      Support running adbd in the su domain. · 7d0f955e
      Nick Kralevich authored
      When adbd runs as root, it transitions into the
      su domain. Add the various rules to support this.
      
      This is needed to run the adbd and shell domains in
      enforcing on userdebug / eng devices without breaking
      developer workflows.
      
      Change-Id: Ib33c0dd2dd6172035230514ac84fcaed2ecf44d6
      7d0f955e
  25. Jan 16, 2014
    • Stephen Smalley's avatar
      Drop legacy device types. · d9b8ef43
      Stephen Smalley authored
      
      powervr_device is obsoleted by the more general gpu_device.
      akm_device and accelerometer_device are obsoleted by the more
      general sensors_device.
      
      We could also drop the file_contexts entries altogether and
      take them to device-specific policy (in this case, they all
      came from crespo, so that is obsolete for master).
      
      Change-Id: I63cef43b0d66bc99b80b64655416cc050f443e7d
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      d9b8ef43
  26. Jan 09, 2014
    • Stephen Smalley's avatar
      Remove domain init:unix_stream_socket connectto permission. · 39fd7818
      Stephen Smalley authored
      
      We do not want to permit connecting to arbitrary unconfined services
      left running in the init domain.  I do not know how this was originally
      triggered and thus cannot test that it is fixed.  Possible causes:
      - another service was left running in init domain, e.g. dumpstate,
      - there was a socket entry for the service in the init.rc file
      and the service was launched via logwrapper and therefore init did
      not know how to label the socket.
      
      The former should be fixed.  The latter can be solved either by
      removing use of logwrapper or by specifying the socket context
      explicitly in the init.rc file now.
      
      Change-Id: I09ececaaaea2ccafb7637ca08707566c1155a298
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      39fd7818
    • Stephen Smalley's avatar
      Allow access to unlabeled socket and fifo files. · 91c290b8
      Stephen Smalley authored
      
      Just use notdevfile_class_set to pick up all non-device file classes.
      
      Change-Id: Ib3604537ccfc25da67823f0f2b5d70b84edfaadf
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      91c290b8
    • Stephen Smalley's avatar
      Remove unlabeled execute access from domain, add to appdomain. · 959fdaaa
      Stephen Smalley authored
      
      Otherwise all domains can create/write files that are executable
      by all other domains.  If I understand correctly, this should
      only be necessary for app domains executing content from legacy
      unlabeled userdata partitions on existing devices and zygote
      and system_server mappings of dalvikcache files, so only allow
      it for those domains.
      
      If required for others, add it to the individual
      domain .te file, not for all domains.
      
      Change-Id: I6f5715eb1ecf2911e70772b9ab4e531feea18819
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      959fdaaa
  27. Jan 08, 2014
  28. Jan 07, 2014
  29. Jan 04, 2014
    • Nick Kralevich's avatar
      Don't allow zygote init:binder call · a730e50b
      Nick Kralevich authored
      init can't handle binder calls. It's always incorrect
      to allow init:binder call, and represents a binder call
      to a service without an SELinux domain. Adding this
      allow rule was a mistake; the dumpstate SELinux domain didn't
      exist at the time this rule was written, and dumpstate was
      running under init's domain.
      
      Add a neverallow rule to prevent the reintroduction of
      this bug.
      
      Change-Id: I78d35e675fd142d880f15329471778c18972bf50
      a730e50b
  30. Jan 03, 2014
    • Stephen Smalley's avatar
      Address adb backup/restore denials. · c4021ceb
      Stephen Smalley authored
      
      Resolves the following denials seen during an adb backup and restore
      sequence.
      
      <5>[   90.247039] type=1400 audit(1388759567.693:16): avc:  denied  { getopt } for  pid=3503 comm="Thread-149" scontext=u:r:system_server:s0 tcontext=u:r:adbd:s0 tclass=unix_stream_socket
      <5>[   90.249176] type=1400 audit(1388759567.703:17): avc:  denied  { getopt } for  pid=2334 comm="app_process" scontext=u:r:shell:s0 tcontext=u:r:adbd:s0 tclass=unix_stream_socket
      
      Change-Id: I1f6f90f29eecc32ee692764b04b812988f099cde
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      c4021ceb
  31. Jan 02, 2014
    • Stephen Smalley's avatar
      Remove execmem permission from domain, add to appdomain. · ad7df7bb
      Stephen Smalley authored
      
      execmem permission controls the ability to make an anonymous
      mapping executable or to make a private file mapping writable
      and executable.  Remove this permission from domain (i.e.
      all domains) by default, and add it explicitly to app domains.
      It is already allowed in other specific .te files as required.
      There may be additional cases in device-specific policy where
      it is required for proprietary binaries.
      
      Change-Id: I902ac6f8cf2e93d46b3a976bc4dabefa3905fce6
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      ad7df7bb
  32. Dec 18, 2013
    • Stephen Smalley's avatar
      Confine shell domain in -user builds only. · 712ca0a4
      Stephen Smalley authored
      
      Confine the domain for an adb shell in -user builds only.
      The shell domain in non-user builds is left permissive.
      init_shell (shell spawned by init, e.g.  console service)
      remains unconfined by this change.
      Introduce a shelldomain attribute for rules common to all shell
      domains, assign it to the shell types, and add shelldomain.te for
      its rules.
      
      Change-Id: I01ee2c7ef80b61a9db151abe182ef9af7623c461
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      712ca0a4
Loading