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
  2. May 28, 2014
  3. May 27, 2014
    • 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
  4. May 22, 2014
    • 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
  5. May 14, 2014
    • dcashman's avatar
      Remove duplicate neverallow rule. · 71db4110
      dcashman authored
      Commit: 7ffb9972 added protection against low
      memory mapping for all domains, a superset of appdomain.  Remove the same,
      redundant neverallow rule from appdomain.
      
      Change-Id: Ia41c02763f6b5a260c56d10adfbab649d9f3f97c
      71db4110
  6. May 08, 2014
  7. May 07, 2014
    • Greg Hackmann's avatar
      Add policies for Atomic Display Framework · 7004789d
      Greg Hackmann authored
      
      ADF is a modern replacement for fbdev.
      
      ADF's device nodes (/dev/adf[X]), interface nodes
      (/dev/adf-interface[X].[Y]), and overlay engine nodes
      (/dev/adf-overlay-engine[X].[Y]) are collectively used in similar
      contexts as fbdev nodes.  Vendor HW composers (via SurfaceFlinger) and
      healthd will need to send R/W ioctls to these nodes to prepare and
      update the display.
      
      Ordinary apps should not talk to ADF directly.
      
      Change-Id: Ic0a76b1e82c0cc1e8f240f219928af1783e79343
      Signed-off-by: default avatarGreg Hackmann <ghackmann@google.com>
      7004789d
    • Stephen Smalley's avatar
      Label app data directories for system UID apps with a different type. · 91a4f8d4
      Stephen Smalley authored
      
      We were using system_data_file for the /data/data directories of
      system UID apps to match the DAC ownership of system UID shared with
      other system files.  However, we are seeing cases where files created
      in these directories must be writable by other apps, and we would like
      to avoid allowing write to system data files outside of these directories.
      So introduce a separate system_app_data_file type and assign it.
      This should also help protect against arbitrary writes by system UID
      apps to other system data directories.
      
      This resolves the following denial when cropping or taking a user photo
      for secondary users:
      avc:  denied  { write } for  path="/data/data/com.android.settings/cache/TakeEditUserPhoto2.jpg" dev="mmcblk0p28" ino=82120 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      
      avc:  denied  { write } for path="/data/data/com.android.settings/cache/CropEditUserPhoto.jpg" dev="mmcblk0p30" ino=602905 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:system_data_file:s0 tclass=file
      
      Bug: 14604553
      Change-Id: Ifa10e3283b07f6bd6ecc16eceeb663edfd756cea
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      91a4f8d4
  8. May 05, 2014
    • Nick Kralevich's avatar
      allow untrusted_app to write to MMS files · 1545b606
      Nick Kralevich authored
      Commit 3fbc536d allowed untrusted
      app to read radio data files passed via binder, but didn't allow
      write access. Write access is needed when sending MMS messages.
      
      Steps to reproduce:
      1) have some photos on the device
      2) Launch messaging app
      3) Attach a MMS (Picture, capture video, capture picture, audio recording etc..)
      4) Send
      
      EXPECTED RESULTS:
      No crash
      
      OBSERVED RESULTS:
      - Messaging crashes on sending MMS
      - messages are stuck in sending state
      
      Additional details:
        05-05 10:14:01.196  2457  2457 W Binder_3: type=1400 audit(0.0:20): avc:  denied  { write } for  path="/data/data/com.android.providers.telephony/app_parts/PART_1399310041183_temp.jpg" dev="mmcblk0p23" ino=604417 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
        05-05 10:14:01.202 27809 28219 E JavaBinder: !!! FAILED BINDER TRANSACTION !!!
        05-05 10:14:01.203 27809 28219 E PduPersister: Failed to open Input/Output stream.
        05-05 10:14:01.203 27809 28219 E PduPersister: java.io.FileNotFoundException: Failed opening content provider: content://mms/part/4
        05-05 10:14:01.203 27809 28219 E PduPersister:        at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:966)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at android.content.ContentResolver.openOutputStream(ContentResolver.java:674)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at android.content.ContentResolver.openOutputStream(ContentResolver.java:650)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at com.google.android.mms.pdu.PduPersister.persistData(PduPersister.java:837)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at com.google.android.mms.pdu.PduPersister.persistPart(PduPersister.java:761)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at com.google.android.mms.pdu.PduPersister.persist(PduPersister.java:1398)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage.createDraftMmsMessage(WorkingMessage.java:1577)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage.sendMmsWorker(WorkingMessage.java:1431)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage.access$700(WorkingMessage.java:82)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at com.android.mms.data.WorkingMessage$2.run(WorkingMessage.java:1228)
        05-05 10:14:01.203 27809 28219 E PduPersister:        at java.lang.Thread.run(Thread.java:818)
        05-05 10:14:01.221 27809 28219 E AndroidRuntime: FATAL EXCEPTION: WorkingMessage.send MMS
        05-05 10:14:01.221 27809 28219 E AndroidRuntime: Process: com.android.mms, PID: 27809
        05-05 10:14:01.221 27809 28219 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getLastPathSegment()' on a null object reference
        05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at android.content.ContentUris.parseId(ContentUris.java:85)
        05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.model.SlideshowModel.finalResize(SlideshowModel.java:691)
        05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.data.WorkingMessage.sendMmsWorker(WorkingMessage.java:1448)
        05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.data.WorkingMessage.access$700(WorkingMessage.java:82)
        05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at com.android.mms.data.WorkingMessage$2.run(WorkingMessage.java:1228)
        05-05 10:14:01.221 27809 28219 E AndroidRuntime:      at java.lang.Thread.run(Thread.java:818)
        05-05 10:14:01.222   659  5253 W ActivityManager:   Force finishing activity com.android.mms/.ui.ComposeMessageActivity
      
      Bug: 14562421
      Change-Id: Iba6914eeec4bf0c8c04ee83584327a4824c0a9a9
      1545b606
  9. Apr 26, 2014
  10. 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
  11. 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
  12. Apr 04, 2014
    • Stephen Smalley's avatar
      Coalesce shared_app, media_app, release_app into untrusted_app. · 9ba844fe
      Stephen Smalley authored
      
      This change folds the shared_app, media_app, and release_app
      domains into untrusted_app, reducing the set of app domains down
      to just distinct domains for the fixed UID apps (e.g. system_app, bluetooth,
      nfc, radio), a single domain for apps signed by the platform key
      (platform_app), and a single domain for all other apps (untrusted_app).
      Thus, SELinux only distinguishes when already distinguished by a predefined
      Android ID (AID) or by the platform certificate (which get the signature-only
      Android permissions and thus may require special OS-level accesses).
      
      It is still possible to introduce specific app domains for specific
      apps by adding signer and package stanzas to mac_permissions.xml,
      but this can be done on an as-needed basis for specialized apps that
      require particular OS-level permissions outside the usual set.
      
      As there is now only a single platform app domains, get rid of the
      platformappdomain attribute and platform_app_domain() macro.  We used
      to add mlstrustedsubject to those domains but drop this since we are not
      using MLS in AOSP presently; we can revisit which domains need it if/when
      we use MLS.
      
      Since we are dropping the shared, media, and release seinfo entries from
      seapp_contexts, drop them from mac_permissions.xml as well.  However,
      we leave the keys.conf entries in case someone wants to add a signer
      entry in the future for specific apps signed by those keys to
      mac_permissions.xml.
      
      Change-Id: I877192cca07360c4a3c0ef475f016cc273e1d968
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      9ba844fe
  13. Mar 27, 2014
    • Stephen Smalley's avatar
      Allow reading of radio data files passed over binder. · 3fbc536d
      Stephen Smalley authored
      
      Addresses denials such as:
       avc:  denied  { read } for  pid=5114 comm="le.android.talk" path="/data/data/com.android.providers.telephony/app_parts/PART_1394223232515_recording88476874.amr" dev="mmcblk0p23" ino=64522 scontext=u:r:mediaserver:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
       avc:  denied  { getattr } for  pid=29199 comm="Binder_4" path="/data/data/com.android.providers.telephony/app_parts/PART_1394223232515_recording88476874.amr" dev="mmcblk0p23" ino=64522 scontext=u:r:mediaserver:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
       avc:  denied  { read } for  pid=29199 comm="Binder_4" path="/data/data/com.android.providers.telephony/app_parts/PART_1394223232515_recording88476874.amr" dev="mmcblk0p23" ino=64522 scontext=u:r:drmserver:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
       avc:  denied  { getattr } for  pid=9338 comm="MediaLoader" path="/data/data/com.android.providers.telephony/app_parts/PART_1394848620510_image.jpg" dev="mmcblk0p28" ino=287374 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
       avc:  denied  { read } for  pid=9896 comm="Binder_7" path="/data/data/com.android.providers.telephony/app_parts/PART_1394594346187_image.jpg" dev="mmcblk0p28" ino=287522 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
      
      This does not allow write denials such as:
       avc:  denied  { write } for  pid=1728 comm="Binder_4" path="/data/data/com.android.providers.telephony/app_parts/PART_1394818738798_image.jpg" dev="mmcblk0p28" ino=82279 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:radio_data_file:s0 tclass=file
      
      Need to understand whether write access is in fact required.
      
      Change-Id: I7693d16cb4f9855909d790d3f16f8bf281764468
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      3fbc536d
  14. Mar 14, 2014
  15. Mar 13, 2014
    • Stephen Smalley's avatar
      Get rid of separate platform_app_data_file type. · dc88dca1
      Stephen Smalley authored
      
      The original concept was to allow separation between /data/data/<pkgdir>
      files of "platform" apps (signed by one of the four build keys) and
      untrusted apps.  But we had to allow read/write to support passing of
      open files via Binder or local socket for compatibilty, and it seems
      that direct open by pathname is in fact used in Android as well,
      only passing the pathname via Binder or local socket.  So there is no
      real benefit to keeping it as a separate type.
      
      Retain a type alias for platform_app_data_file to app_data_file until
      restorecon /data/data support is in place to provide compatibility.
      
      Change-Id: Ic15066f48765322ad40500b2ba2801bb3ced5489
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      dc88dca1
  16. 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
  17. Mar 07, 2014
    • Stephen Smalley's avatar
      Clean up, unify, and deduplicate app domain rules. · b0db712b
      Stephen Smalley authored
      
      Coalesce a number of allow rules replicated among multiple
      app domains.
      
      Get rid of duplicated rules already covered by domain, appdomain,
      or platformappdomain rules.
      
      Split the platformappdomain rules to their own platformappdomain.te
      file, document them more fully, and note the inheritance in each
      of the relevant *_app.te files.
      
      Generalize isolated app unix_stream_socket rules to all app domains
      to resolve denials such as:
      
      avc:  denied  { read write } for  pid=11897 comm="Binder_2" path="socket:[203881]" dev="sockfs" ino=203881 scontext=u:r:release_app:s0 tcontext=u:r:untrusted_app:s0 tclass=unix_stream_socket
      
      avc:  denied  { getattr } for  pid=11990 comm=4173796E635461736B202334 path="socket:[203881]" dev="sockfs" ino=203881 scontext=u:r:release_app:s0 tcontext=u:r:untrusted_app:s0 tclass=unix_stream_socket
      
      avc:  denied  { getopt } for  pid=11990 comm=4173796E635461736B202334 scontext=u:r:release_app:s0 tcontext=u:r:untrusted_app:s0 tclass=unix_stream_socket
      
      avc:  denied  { read write } for  pid=6890 comm="Binder_10" path="socket:[205010]" dev="sockfs" ino=205010 scontext=u:r:release_app:s0 tcontext=u:r:media_app:s0 tclass=unix_stream_socket
      
      avc:  denied  { getattr } for  pid=11990 comm=4173796E635461736B202334 path="socket:[205010]" dev="sockfs" ino=205010 scontext=u:r:release_app:s0 tcontext=u:r:media_app:s0 tclass=unix_stream_socket
      
      avc:  denied  { getopt } for  pid=11990 comm=4173796E635461736B202334 scontext=u:r:release_app:s0 tcontext=u:r:media_app:s0 tclass=unix_stream_socket
      
      Change-Id: I770d7d51d498b15447219083739153265d951fe5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      b0db712b
  18. 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
  19. 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
  20. 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
  21. Feb 25, 2014
    • 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
    • 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
  22. Feb 06, 2014
    • Dave Platt's avatar
      Finish fixing Zygote descriptor leakage problem · 0b218ec5
      Dave Platt authored
      In order to prevent Zygote descriptors from leaking into the child
      environment, they should be closed by the forked-off child process
      before the child switches to the application UID.  These changes close
      the descriptors via dup2(), substituting a descriptor open to
      /dev/null in their place; this allows the Zygote Java code to close
      the FileDescriptor objects cleanly.
      
      This is a multi-project change: dalvik, art, libcore, frameworks/base,
      and external/sepolicy are affected.  The CLs need to be approved
      together, lest the build break or the software fail to boot.
      
      Bug: 12114500
      Change-Id: Ie45ddf6d661a1ea8570cd49dfea76421f2cadf72
      0b218ec5
  23. 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
  24. Feb 03, 2014
  25. Jan 24, 2014
    • Robert Craig's avatar
      Allow all appdomains to grab file attributes of wallpaper_file. · fc4c6b79
      Robert Craig authored
      
      When setting a static wallpaper on multiple devices the
      following denials were encountered.
         avc:  denied  { getattr } for  pid=1775 comm="llpaper_chooser" path="/data/system/users/0/wallpaper" dev="mmcblk0p23" ino=104679 scontext=u:r:shared_app:s0 tcontext=u:object_r:wallpaper_file:s0 tclass=file
         avc:  denied  { getattr } for  pid=799 comm="ndroid.systemui" path="/data/system/users/0/wallpaper" dev="mmcblk0p23" ino=104679 scontext=u:r:platform_app:s0 tcontext=u:object_r:wallpaper_file:s0 tclass=file
         avc:  denied  { getattr } for  pid=1909 comm=4173796E635461736B202332 path="/data/system/users/0/wallpaper" dev="mmcblk0p28" ino=586422 scontext=u:r:release_app:s0 tcontext=u:object_r:wallpaper_file:s0 tclass=file
      
      platform_app access is from the SystemUI app whereas the other
      denials are from the Launcher that is used on the particular
      device. For instance, Launcher2 triggers the shared_app denial
      whereas release_app (used by Launcher3) triggers the other denial.
      Because of this, add the rule to all appdomains.
      
      The static wallpaper is still set without this change. Just add
      the rule to avoid the noise in the logs.
      
      Change-Id: Ida84d1695d52379d67b87318403f629fd07109a4
      Signed-off-by: default avatarrpcraig <rpcraig@tycho.ncsc.mil>
      fc4c6b79
  26. Jan 21, 2014
    • Nick Kralevich's avatar
      Address bug report denials. · 2e7a301f
      Nick Kralevich authored
      Triggering a bug report via
      Settings > Developer Options > Take bug report
      generates a number of denials.
      
      Two bugs here:
      
      1) According to the "allowed" list in
      frameworks/native/cmds/servicemanager/service_manager.c ,
      media apps, nfc, radio, and apps with system/root UIDs can register
      as a binder service. However, they were not placed into the
      binder_service domain. Fix them.
      
      2) The bugreport mechanism queries all the services and java
      programs and asks them to write to a shell owned file. Grant the
      corresponding SELinux capability.
      
      Addresses the following denials:
      
      <5>[  149.342181] type=1400 audit(1389419775.872:17): avc:  denied  { write } for  pid=4023 comm="dumpsys" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:keystore:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  149.371844] type=1400 audit(1389419775.902:18): avc:  denied  { write } for  pid=4023 comm="dumpsys" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:healthd:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  149.980161] type=1400 audit(1389419776.512:22): avc:  denied  { write } for  pid=4023 comm="dumpsys" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:drmserver:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  150.095066] type=1400 audit(1389419776.622:23): avc:  denied  { write } for  pid=1514 comm="Binder_C" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  150.096748] type=1400 audit(1389419776.632:24): avc:  denied  { getattr } for  pid=3178 comm="Binder_3" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:system_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  150.097090] type=1400 audit(1389419776.632:25): avc:  denied  { write } for  pid=1514 comm="Binder_C" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  154.545583] type=1400 audit(1389419781.072:43): avc:  denied  { write } for  pid=1423 comm="Binder_A" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:media_app:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  156.000877] type=1400 audit(1389419782.532:44): avc:  denied  { write } for  pid=1423 comm="Binder_A" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:radio:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  156.022567] type=1400 audit(1389419782.552:45): avc:  denied  { write } for  pid=1423 comm="Binder_A" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:radio:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  156.043463] type=1400 audit(1389419782.572:46): avc:  denied  { write } for  pid=1423 comm="Binder_A" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:nfc:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      <5>[  156.062550] type=1400 audit(1389419782.592:47): avc:  denied  { write } for  pid=1423 comm="Binder_A" path="/data/data/com.android.shell/files/bugreports/bugreport-2014-01-10-21-55-46.txt.tmp" dev="mmcblk0p28" ino=82094 scontext=u:r:radio:s0 tcontext=u:object_r:shell_data_file:s0 tclass=file
      
      Change-Id: I365d530c38ce176617e48b620c05c4aae01324d3
      2e7a301f
  27. Jan 16, 2014
    • Stephen Smalley's avatar
      Allow mediaserver to connect to bluetooth. · 09f6a99b
      Stephen Smalley authored
      
      Re-purpose the existing bluetooth_socket type, originally
      for /dev/socket/bluetooth used by bluetoothd in the old
      bluetooth stack, for sockets created by bluedroid under
      /data/misc/bluedroid, and allow mediaserver to connect
      to such sockets.  This is required for playing audio
      on paired BT devices.
      
      Based on b/12417855.
      
      Change-Id: I24ecdf407d066e7c4939ed2a0edb97222a1879f6
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      09f6a99b
  28. Jan 13, 2014
  29. Jan 09, 2014
    • 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
  30. Jan 07, 2014
    • Stephen Smalley's avatar
      Remove ping domain. · 396015c3
      Stephen Smalley authored
      
      ping in Android no longer requires any additional privileges beyond
      the caller.  Drop the ping domain and executable file type entirely.
      
      Also add net_domain() to shell domain so that it can create and
      use network sockets.
      
      Change-Id: If51734abe572aecf8f510f1a55782159222e5a67
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      396015c3
  31. Jan 02, 2014
    • Stephen Smalley's avatar
      Only allow PROT_EXEC for ashmem where required. · e7ec2f52
      Stephen Smalley authored
      
      tmpfs_domain() macro defines a per-domain type and
      allows access for tmpfs-backed files, including ashmem
      regions.  execute-related permissions crept into it,
      thereby allowing write + execute to ashmem regions for
      most domains.  Move the execute permission out of tmpfs_domain()
      to app_domain() and specific domains as required.
      Drop execmod for now we are not seeing it.
      
      Similarly, execute permission for /dev/ashmem crept into
      binder_use() as it was common to many binder using domains.
      Move it out of binder_use() to app_domain() and specific domains
      as required.
      
      Change-Id: I66f1dcd02932123eea5d0d8aaaa14d1b32f715bb
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      e7ec2f52
    • 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
    • Stephen Smalley's avatar
      Allow use of art as the Android runtime. · 527316a2
      Stephen Smalley authored
      
      system_server and app domains need to map dalvik-cache files with PROT_EXEC.
      
      type=1400 msg=audit(13574814.073:132): avc: denied { execute } for pid=589 comm="system_server" path="/data/dalvik-cache/system@priv-app@SettingsProvider.apk@classes.dex" dev="mmcblk0p30" ino=684132 scontext=u:r:system_server:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file
      
      Apps need to map cached dex files with PROT_EXEC.  We already allow this
      for untrusted_app to support packaging of shared objects as assets
      but not for the platform app domains.
      
      type=1400 audit(1387810571.697:14): avc:  denied  { execute } for  pid=7822 comm="android.youtube" path="/data/data/com.google.android.youtube/cache/ads1747714305.dex" dev="mmcblk0p30" ino=603259 scontext=u:r:platform_app:s0 tcontext=u:object_r:platform_app_data_file:s0 tclass=file
      
      Change-Id: I309907d591ea6044e3e6aeb57bde7508e426c033
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      527316a2
  32. Dec 18, 2013
  33. Dec 17, 2013
    • Nick Kralevich's avatar
      app.te: allow getopt/getattr on zygote socket · 61dc3507
      Nick Kralevich authored
      The closure of /dev/socket/zygote occurs in the zygote child
      process, after Zygote has dropped privileges and changed
      SELinux domains. In Google's internal tree, socket closures
      are following a different path, which is causing getopt/getattr
      to be used on the file descriptor. This is generating a large
      number of denials.
      
      Allow the operations for now. getopt/getattr are fairly harmless.
      Long term, we shouldn't be performing these operations on the
      zygote socket.
      
      Addresses the following denials:
      
      18.352783   type=1400 audit(1386374111.043:7): avc:  denied  { getattr } for  pid=682 comm="ndroid.systemui" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:platform_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      18.353088   type=1400 audit(1386374111.043:8): avc:  denied  { getopt } for  pid=682 comm="ndroid.systemui" path="/dev/socket/zygote" scontext=u:r:platform_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      18.833251   type=1400 audit(1386374111.524:9): avc:  denied  { getattr } for  pid=761 comm="d.process.acore" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:shared_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      18.833557   type=1400 audit(1386374111.524:10): avc:  denied  { getopt } for  pid=761 comm="d.process.acore" path="/dev/socket/zygote" scontext=u:r:shared_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      19.042419   type=1400 audit(1386374111.734:11): avc:  denied  { getattr } for  pid=806 comm="d.process.media" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:media_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      19.042724   type=1400 audit(1386374111.734:12): avc:  denied  { getopt } for  pid=806 comm="d.process.media" path="/dev/socket/zygote" scontext=u:r:media_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      19.182830   type=1400 audit(1386374111.874:14): avc:  denied  { getattr } for  pid=825 comm="putmethod.latin" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:untrusted_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      19.183105   type=1400 audit(1386374111.874:15): avc:  denied  { getopt } for  pid=825 comm="putmethod.latin" path="/dev/socket/zygote" scontext=u:r:untrusted_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      19.235473   type=1400 audit(1386374111.924:16): avc:  denied  { getattr } for  pid=840 comm="ndroid.settings" path="socket:[9287]" dev="sockfs" ino=9287 scontext=u:r:system_app:s0 tcontext=u:r:zygote:s0 tclass=unix_stream_socket
      
      Bug: 12061011
      Change-Id: Ie1ec7636185aba7954656802e5eed735f49830c9
      61dc3507
  34. Dec 16, 2013
    • Nick Kralevich's avatar
      initial dumpstate domain · 09e6abd9
      Nick Kralevich authored
      Add the necessary rules to support dumpstate.
      Start off initially in permissive until it has more testing.
      
      Dumpstate is triggered by running "adb bugreport"
      
      Change-Id: Ic17a60cca1f6f40daa4f2c51e9ad6009ef36cfbd
      09e6abd9
  35. Dec 12, 2013
Loading