Skip to content
Snippets Groups Projects
  1. Mar 07, 2014
  2. Mar 05, 2014
    • Nick Kralevich's avatar
      temp fix for build breakage. · d9d9d2f4
      Nick Kralevich authored
      libsepol.check_assertion_helper: neverallow on line 8857 violated by allow system_server sdcard_external:file { ioctl read write getattr lock append open };
      Error while expanding policy
      make: *** [out/target/product/manta/obj/ETC/sepolicy_intermediates/sepolicy] Error 1
      
      Change-Id: I181707ed66bad3db56f9084b3d9ba161d13b34bd
      d9d9d2f4
    • Stephen Smalley's avatar
      Do not allow system_server to access SDcard files. · d331e00b
      Stephen Smalley authored
      As per:
      https://android-review.googlesource.com/#/c/84130/3/system_server.te@240
      
      
      it is unsafe to allow such access.
      
      Add a neverallow rule to prohibit any rules on sdcard_type in the
      future.
      
      Change-Id: Ife714b65b07144eb6228a048a55ba82181595213
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      d331e00b
    • 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
    • Nick Kralevich's avatar
      allow lmkd to kill processes. · 23a52e6b
      Nick Kralevich authored
      The previous patch wasn't sufficient. Allow the kill signal.
      
      Addresses the following denial:
      
      <5>[  775.819223] type=1400 audit(1393978653.489:18): avc:  denied  { sigkill } for  pid=118 comm="lmkd" scontext=u:r:lmkd:s0 tcontext=u:r:untrusted_app:s0 tclass=process
      
      Bug: 13084787
      Change-Id: I6af1ed4343b590049809a59e4f2797f6049f12e4
      23a52e6b
  3. Mar 04, 2014
    • Stephen Smalley's avatar
      Allow stat/read of /data/media files by app domains. · 2737ceff
      Stephen Smalley authored
      
      Resolves denials such as:
      avc:  denied  { read } for  pid=23862 comm="Binder_4" path="/data/media/0/DCIM/.thumbnails/1390499643135.jpg" dev="mmcblk0p28" ino=171695 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:media_rw_data_file:s0 tclass=file
      
      avc:  denied  { getattr } for  pid=26800 comm="ImageLoader" path="/data/media/0/DCIM/.thumbnails/1390499643135.jpg" dev="mmcblk0p28" ino=171695 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:media_rw_data_file:s0 tclass=file
      
      Change-Id: I8221359123ecc41ea28e4fcbce4912b42a6510f0
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      2737ceff
    • Stephen Smalley's avatar
      Allow getopt / getattr to bluetooth unix_stream_socket. · 495e9d12
      Stephen Smalley authored
      
      Resolve denials such as:
      
      avc:  denied  { getattr } for  pid=16226 comm="Thread-2096" path="socket:[414657]" dev="sockfs" ino=414657 scontext=u:r:untrusted_app:s0 tcontext=u:r:bluetooth:s0 tclass=unix_stream_socket
      
      avc:  denied  { getopt } for  pid=5890 comm="FinalizerDaemon" scontext=u:r:untrusted_app:s0 tcontext=u:r:bluetooth:s0 tclass=unix_stream_socket
      
      Change-Id: Iea7790aa4f8e24f3ec0d2c029933a3902333472e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      495e9d12
  4. Mar 03, 2014
    • Stephen Smalley's avatar
      Deduplicate binder_call rules. · 28afdd92
      Stephen Smalley authored
      
      A number of binder_call rules are duplicated by other rules
      written in terms of attributes/sets (e.g. appdomain, binderservicedomain).
      Get rid of the duplicates.
      
      Also use binder_use() in racoon.te rather than manually writing the
      base rule for communicating with the servicemanager.
      
      Change-Id: I5a459cc2154b1466bcde6eccef253dfcdcb44e0a
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      28afdd92
  5. Feb 28, 2014
    • Nick Kralevich's avatar
      restore system_server zygote socket rules · 63b98b17
      Nick Kralevich authored
      16011320 removed the getattr/getopt
      support for system_server, which is needed to close the zygote socket.
      See b/12061011 for details.
      
      system_server still needs this rule, and it's expected to stay
      permanently. Restore the rule and remove the comment about it eventually
      being deleted.
      
      Addresses the following denials:
      
      <5>[   86.307639] type=1400 audit(1393376281.530:5): avc:  denied  { getattr } for  pid=656 comm="main" path="socket:[7195]" dev=sockfs ino=7195 scontext=u:r:system_server:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      <5>[   86.307945] type=1400 audit(1393376281.530:6): avc:  denied  { getopt } for  pid=656 comm="main" path="/dev/socket/zygote" scontext=u:r:system_server:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      
      Bug: 12114500
      Change-Id: I47033766dea3ba2fdaa8ce9b4251370bd64aea6d
      63b98b17
    • Nick Kralevich's avatar
    • Nick Kralevich's avatar
      Merge "Give lmkd kill capability" · b19a191a
      Nick Kralevich authored
      b19a191a
    • 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
  6. Feb 27, 2014
    • Nick Kralevich's avatar
      Give lmkd kill capability · 24be3916
      Nick Kralevich authored
      lmkd needs the capability to kill processes.
      
      Addresses the following denial:
      
      <5>[12619.064604] type=1400 audit(1393540506.745:2565): avc:  denied  { kill } for  pid=116 comm="lmkd" capability=5  scontext=u:r:lmkd:s0 tcontext=u:r:lmkd:s0 tclass=capability
      
      Addresses the following errors:
      
      02-27 13:13:50.995   116   116 I lowmemorykiller: Killing 'com.google.android.deskclock' (7133), adj 15
      02-27 13:13:50.995   116   116 I lowmemorykiller:    to free 33836kB because cache 118512kB is below limit 122880kB for oom_adj 15
      02-27 13:13:50.995   116   116 I lowmemorykiller:    Free memory is -28472kB below reserved
      02-27 13:13:50.995   116   116 E lowmemorykiller: kill(7133): errno=1
      
      Change-Id: I7cca238610307aba9d77aa2e52a32ebd6aec3f3c
      24be3916
    • Stephen Smalley's avatar
      Remove system_server and zygote unlabeled execute access. · 37afd3f6
      Stephen Smalley authored
      
      Now that all of /data outside of /data/data should be labeled
      even on legacy devices as a result of
      Ib8d9751a47c8e0238cf499fcec61898937945d9d, there
      should be no reason to permit the system_server or zygote
      execute access to unlabeled files.
      
      This is the only remaining case where a type writable by
      app domains can be executed by system services, so eliminating
      it is desirable.
      
      That said, I have not specifically tested the non-SE to SE
      upgrade path to confirm that this causes no problems.
      
      Change-Id: Ie488bd6e347d4a210806a3308ab25b00952aadb4
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      37afd3f6
  7. 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
  8. Feb 24, 2014
  9. Feb 22, 2014
  10. 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
Loading