Skip to content
Snippets Groups Projects
  1. Feb 28, 2014
    • Nick Kralevich's avatar
      uncrypt: allow /dev/block directory access. · 0a5f561c
      Nick Kralevich authored
      Uncrypt needs search in /dev/block to open block devices.
      Allow it.
      
      Addresses the following denial:
      
      [11105.601711] type=1400 audit(1393550350.528:30): avc:  denied  { search } for  pid=14597 comm="uncrypt" name="block" dev="tmpfs" ino=7200 scontext=u:r:uncrypt:s0 tcontext=u:object_r:block_device:s0 tclass=dir
      
      Change-Id: I4592784135a04ff5bff2715e1250661744f12aa1
      0a5f561c
  2. Feb 25, 2014
    • Stephen Smalley's avatar
      Move qemud and /dev/qemu policy bits to emulator-specific sepolicy. · 0296b943
      Stephen Smalley authored
      
      Change-Id: I620d4aef84a5d4565abb1695db54ce1653612bce
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      0296b943
    • Stephen Smalley's avatar
      Drop obsolete keystore_socket type and rules. · 2c347e0a
      Stephen Smalley authored
      
      Change I6dacdc43bcc1a56e47655e37e825ee6a205eb56b switched
      the keystore to using binder instead of a socket, so this
      socket type and rules have been unused for a while.  The type
      was only ever assigned to a /dev/socket socket file (tmpfs) so
      there is no issue with removing the type (no persistent files
      will have this xattr value).
      
      Change-Id: Id584233c58f6276774c3432ea76878aca28d6280
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      2c347e0a
    • Nick Kralevich's avatar
      Merge "Clean up socket rules." · dc1cedf1
      Nick Kralevich authored
      dc1cedf1
    • Nick Kralevich's avatar
    • 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
    • Stephen Smalley's avatar
      Resolve overlapping rules between app.te and net.te. · 85708ec4
      Stephen Smalley authored
      
      There is some overlap between socket rules in app.te and the net.te rules,
      but they aren't quite identical since not all app domains presently include
      the net_domain() macro and because the rules in app.te allow more permissions
      for netlink_route_socket and allow rawip_socket permissions for ping.
      The current app.te rules prevent one from ever creating a non-networked app
      domain.  Resolve this overlap by:
      
      1) Adding the missing permissions allowed by app.te to net.te for
      netlink_route_socket and rawip_socket.
      2) Adding net_domain() calls to all existing app domains that do not already
      have it.
      3) Deleting the redundant socket rules from app.te.
      
      Then we'll have no effective change in what is allowed for apps but
      allow one to define app domains in the future that are not allowed
      network access.
      
      Also cleanup net.te to use the create_socket_perms macro rather than *
      and add macros for stream socket permissions.
      
      Change-Id: I6e80d65b0ccbd48bd2b7272c083a4473e2b588a9
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      85708ec4
    • Stephen Smalley's avatar
      Add a domain for mdnsd and allow connecting to it. · 96ff4c05
      Stephen Smalley authored
      
      Change-Id: I0a06fa32a46e515671b4e9a6f68e1a3f8b2c21a8
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      96ff4c05
    • Nick Kralevich's avatar
      Merge "Remove fsetid from netd." · d107abd1
      Nick Kralevich authored
      d107abd1
    • Stephen Smalley's avatar
      Remove fsetid from netd. · d581b812
      Stephen Smalley authored
      
      fsetid checks are triggered by chmod on a directory or file owned by
      a group other than one of the groups assigned to the current process
      to see if the setgid bit should be cleared, regardless of whether the
      setgid bit was even set.  We do not appear to truly need this
      capability for netd to operate, so remove it.  Potential dontaudit
      candidate.
      
      Change-Id: I5ab4fbaaa056dcd1c7e60ec28632e7bc06f826bf
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      d581b812
  3. Feb 24, 2014
  4. Feb 22, 2014
  5. Feb 21, 2014
    • Stephen Smalley's avatar
      Address SELinux denials with clatd. · a770ee5b
      Stephen Smalley authored
      
      <5>[  216.710405] type=1400 audit(1392934645.702:17): avc:  denied  { use } for  pid=2273 comm="clatd" path="socket:[9368]" dev="sockfs" ino=9368 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=fd
      
      <5>[  216.710553] type=1400 audit(1392934645.702:18): avc:  denied  { read write } for  pid=2273 comm="clatd" path="socket:[9368]" dev="sockfs" ino=9368 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=netlink_kobject_uevent_socket
      
      <5>[  216.710727] type=1400 audit(1392934645.702:19): avc:  denied  { read } for  pid=2273 comm="clatd" path="pipe:[9369]" dev="pipefs" ino=9369 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=fifo_file
      
      <5>[  216.710872] type=1400 audit(1392934645.702:20): avc:  denied  { read write } for  pid=2273 comm="clatd" path="socket:[8214]" dev="sockfs" ino=8214 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=unix_stream_socket
      
      <5>[  216.711037] type=1400 audit(1392934645.702:21): avc:  denied  { write } for  pid=2273 comm="clatd" path="pipe:[9369]" dev="pipefs" ino=9369 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=fifo_file
      
      <5>[  216.711208] type=1400 audit(1392934645.702:22): avc:  denied  { read write } for  pid=2273 comm="clatd" path="socket:[9370]" dev="sockfs" ino=9370 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=netlink_route_socket
      
      <5>[  216.711334] type=1400 audit(1392934645.702:23): avc:  denied  { read write } for  pid=2273 comm="clatd" path="socket:[9372]" dev="sockfs" ino=9372 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=netlink_nflog_socket
      
      <5>[  216.711513] type=1400 audit(1392934645.702:24): avc:  denied  { read write } for  pid=2273 comm="clatd" path="socket:[11078]" dev="sockfs" ino=11078 scontext=u:r:clatd:s0 tcontext=u:r:netd:s0 tclass=udp_socket
      
      <5>[  216.713390] type=1400 audit(1392934645.702:25): avc:  denied  { dac_override } for  pid=2273 comm="clatd" capability=1 scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=capability
      
      <5>[  216.713528] type=1400 audit(1392934645.702:26): avc:  denied  { read write } for  pid=2273 comm="clatd" name="tun" dev="tmpfs" ino=6127 scontext=u:r:clatd:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file
      
      <5>[  314.513898] type=1400 audit(1392934743.501:42): avc:  denied  { setopt } for  pid=2273 comm="clatd" scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=netlink_route_socket
      
      <5>[  314.514482] type=1400 audit(1392934743.501:43): avc:  denied  { getattr } for  pid=2273 comm="clatd" scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=netlink_route_socket
      
      <5>[  314.515196] type=1400 audit(1392934743.501:44): avc:  denied  { write } for  pid=2273 comm="clatd" scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=netlink_route_socket
      
      <5>[  314.516077] type=1400 audit(1392934743.501:45): avc:  denied  { connect } for  pid=2273 comm="clatd" scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=netlink_route_socket
      
      <5>[ 22.257024] type=1400 audit(1393016186.443:12): avc: denied { open } for pid=1934 comm="clatd" name="tun" dev="tmpfs" ino=6117 scontext=u:r:clatd:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file
      
      <5>[ 22.257274] type=1400 audit(1393016186.443:13): avc: denied { net_admin } for pid=1934 comm="clatd" capability=12 scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=capability
      
      <5>[ 22.257445] type=1400 audit(1393016186.443:14): avc: denied { write } for pid=1934 comm="clatd" name="forwarding" dev="proc" ino=10684 scontext=u:r:clatd:s0 tcontext=u:object_r:proc_net:s0 tclass=file
      
      <5>[ 22.257618] type=1400 audit(1393016186.443:15): avc: denied { setgid } for pid=1934 comm="clatd" capability=6 scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=capability
      
      <5>[ 22.257753] type=1400 audit(1393016186.443:16): avc: denied { setuid } for pid=1934 comm="clatd" capability=7 scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=capability
      
      <5>[ 22.385005] type=1400 audit(1393016186.573:17): avc: denied { ioctl } for pid=1934 comm="clatd" path="/dev/tun" dev="tmpfs" ino=6117 scontext=u:r:clatd:s0 tcontext=u:object_r:tun_device:s0 tclass=chr_file
      
      <5>[ 22.385269] type=1400 audit(1393016186.573:18): avc: denied { create } for pid=1934 comm="clatd" scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=tun_socket
      
      <5>[ 22.388955] type=1400 audit(1393016186.573:19): avc: denied { nlmsg_write } for pid=1934 comm="clatd" scontext=u:r:clatd:s0 tcontext=u:r:clatd:s0 tclass=netlink_route_socket
      
      Change-Id: Ic760597df1aa4b33b3cb6e9a504dbcbd6f5d0116
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      a770ee5b
    • Nick Kralevich's avatar
    • Nick Kralevich's avatar
    • Nick Kralevich's avatar
    • Stephen Smalley's avatar
      Clarify init_shell, shell, and su domain usage. · b3cb9695
      Stephen Smalley authored
      
      init_shell domain is now only used for shell commands or scripts
      invoked by init*.rc files, never for an interactive shell.  It
      was being used for console service for a while but console service
      is now assigned shell domain via seclabel in init.rc.  We may want
      to reconsider the shelldomain rules for init_shell and whether they
      are still appropriate.
      
      shell domain is now used by both adb shell and console service, both
      of which also run in the shell UID.
      
      su domain is now used not only for /system/bin/su but also for
      adbd and its descendants after an adb root is performed.
      
      Change-Id: I502ab98aafab7dafb8920ccaa25e8fde14a8f572
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      b3cb9695
    • Stephen Smalley's avatar
      Clarify meaning of untrusted_app and app domain assignment logic. · d823f83e
      Stephen Smalley authored
      The current inline documentation is not entirely accurate and caused
      user confusion, e.g. see:
      https://groups.google.com/d/msg/android-security-discuss/javBrPT8ius/C4EVEFUu4ZoJ
      
      
      
      Try to clarify the meaning of untrusted_app, how app domains are
      assigned, and how to move other system apps out of untrusted_app into
      a different domain.
      
      Change-Id: I98d344dd078fe9e2738b68636adaabda1f4b3c3a
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      d823f83e
    • Stephen Smalley's avatar
      Allow stat of /sys/module/lowmemorykiller files by system_server. · 335faf2b
      Stephen Smalley authored
      
      <5>[   43.929760] type=1400 audit(6342882.819:16): avc:  denied  { getattr } for  pid=779 comm="system_server" path="/sys/module/lowmemorykiller/parameters/adj" dev="sysfs" ino=6048 scontext=u:r:system_server:s0 tcontext=u:object_r:sysfs_lowmemorykiller:s0 tclass=file
      
      Change-Id: I48828ca26814c6376c9c71c368f3eff0f7a8f219
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      335faf2b
    • Stephen Smalley's avatar
      Ensure that /data/misc/wifi/sockets is always labeled wpa_socket. · 7ade68d7
      Stephen Smalley authored
      
      It appears that wpa_supplicant tries to rmdir /data/misc/wifi/sockets
      and re-create it at times, so make sure that it remains labeled correctly
      when re-created in this manner via a name-based type transition rule.
      Do the same for hostapd as it also has permissions for creating/removing
      this directory.
      
      <5>[83921.800071] type=1400 audit(1392997522.105:26): avc:  denied  { rmdir } for  pid=3055 comm="wpa_supplicant" name="sockets" dev="mmcblk0p28" ino=618957 scontext=u:r:wpa:s0 tcontext=u:object_r:wpa_socket:s0 tclass=dir
      
      We no longer need the type_transition for sock_file as it will inherit
      the type from the parent directory which is set via restorecon_recursive
      /data/misc/wifi/sockets or via type_transition, so drop it.
      
      Change-Id: Iffa61c426783eb03205ba6964c624c6ecea32630
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      7ade68d7
  6. Feb 20, 2014
  7. 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
    • Nick Kralevich's avatar
      41f221f4
    • Nick Kralevich's avatar
      Merge "lmkd: add sys_resource" · a08cbe1f
      Nick Kralevich authored
      a08cbe1f
    • Nick Kralevich's avatar
      lmkd: add sys_resource · 1c73a5cd
      Nick Kralevich authored
      Addresses the following denial / error:
      
      E/lowmemorykiller(  187): Error writing /proc/1148/oom_adj; errno=13
      
      [  118.264668] type=1400 audit(947231128.209:140): avc:  denied { sys_resource } for  pid=187 comm="lmkd" capability=24 scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability
      
      Change-Id: Ief2a7ead9cdd8a33e3add111ee99f7a29c12a3f2
      1c73a5cd
    • Stephen Smalley's avatar
      Add support for and use new path= specifier in seapp_contexts. · 6139de50
      Stephen Smalley authored
      
      Extend check_seapp to accept the use of the new path= specifier
      in seapp_contexts and use it to ensure proper labeling of the cache
      subdirectory of com.android.providers.downloads for restorecon.
      
      After this change, restorecon /data/data/com.android.providers.downloads/cache
      does not change the context, leaving it in download_file rather than
      relabeling it to platform_app_data_file.
      
      Depends on Iddaa3931cfd4ddd5b9f62cd66989e1f26553baa1.
      
      Change-Id: Ief65b8c8dcb44ec701d53e0b58c52d6688cc2a14
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      6139de50
Loading