Skip to content
Snippets Groups Projects
  1. Jan 29, 2018
  2. Jan 02, 2018
    • Max Bires's avatar
      Adding a traceur_app domain to remove it from shell · 4ea5569f
      Max Bires authored
      This CL creates a traceur_app domain with userdebug privileges akin to
      what shell has with regards to being able to find most services on
      device. Previously, traceur was running as shell which was an
      unintentional abuse of selinux architecture.
      
      Bug: 68126425
      Test: Traceur functions outside of shell user privilege
      Change-Id: Ib5090e7e8225ad201b3ec24b506fe2717101d0f1
      4ea5569f
  3. Nov 13, 2017
    • Chad Brubaker's avatar
      Allow Instant/V2 apps to load code from /data/data · 7650669f
      Chad Brubaker authored
      This restriction causes issues with dynamite.
      
      Since untrusted_v2_app was about enforcing this constraint put installed
      v2 applications back into the normal untrusted_app domain.
      
      Bug: 64806320
      Test: Manual test with app using dynamite module
      
      (cherrypicked from commit fe836817)
      
      Change-Id: I3abf3ade64aaf689039a515de642759dd39ae6f7
      7650669f
  4. Oct 23, 2017
    • Nick Kralevich's avatar
      Revert "Ensure only com.android.shell can run in the shell domain." · bf0c2a59
      Nick Kralevich authored
      The following error is occurring on master:
      
      10-23 16:24:24.785 shell  4884  4884 E SELinux : seapp_context_lookup:  No match for app with uid 2000, seinfo platform, name com.google.android.traceur
      10-23 16:24:24.785 shell  4884  4884 E SELinux : selinux_android_setcontext:  Error setting context for app with uid 2000, seinfo platform:targetSdkVersion=23:complete: Success
      10-23 16:24:24.785 shell  4884  4884 E Zygote  : selinux_android_setcontext(2000, 0, "platform:targetSdkVersion=23:complete", "com.google.android.traceur") failed
      10-23 16:24:24.785 shell  4884  4884 F zygote64: jni_internal.cc:593] JNI FatalError called: frameworks/base/core/jni/com_android_internal_os_Zygote.cpp:648: selinux_android_setcontext failed
      10-23 16:24:24.818 shell  4884  4884 F zygote64: runtime.cc:535] Runtime aborting...
      
      Bug: 68126425
      Bug: 68032516
      
      This reverts commit 714ee5f2.
      
      Change-Id: I7356c4e4facb1e532bfdeb575acf2d83761a0852
      bf0c2a59
  5. Oct 20, 2017
    • Nick Kralevich's avatar
      Ensure only com.android.shell can run in the shell domain. · 714ee5f2
      Nick Kralevich authored
      Don't allow apps to run with uid=shell or selinux domain=shell unless
      the package is com.android.shell.
      
      Add a neverallow assertion (compile time assertion + CTS test) to ensure
      no regressions.
      
      Bug: 68032516
      Test: policy compiles, device boots, and no obvious problems.
      Change-Id: Ic6600fa5608bfbdd41ff53840d904f97d17d6731
      714ee5f2
  6. Sep 27, 2017
    • Dan Cashman's avatar
      Fix build. Split mediaprovider from priv_app. · 3e21c5f1
      Dan Cashman authored
      This CL was accidentally reverted a second time by commit:
      cb5129f9.  Submit it for the third,
      and final, time.
      
      (cherry-pick of 5637587d
      which was in AOSP and internal master but not stage-aosp-master)
      
      Bug: 62102757
      Test: Builds and boots.
      Change-Id: I0394907e808c737422e644aec452baa3e777cf6f
      3e21c5f1
  7. Jul 10, 2017
  8. Jun 08, 2017
    • Jerry Zhang's avatar
      Revert "Split mediaprovider from priv_app." · cb5129f9
      Jerry Zhang authored
      This reverts commit c147b592.
      
      The new domain changed neverallows, breaking CTS compatability.
      Revert the domain now, with the intention to re-add for the next
      release.
      
      Bug: 62102757
      Test: domain is set to priv_app
      Change-Id: I907ff7c513cd642a306e3eaed3937352ced90005
      cb5129f9
  9. Jun 07, 2017
  10. Jun 02, 2017
    • Jerry Zhang's avatar
      Revert "Split mediaprovider from priv_app." · c00c07c1
      Jerry Zhang authored
      This reverts commit c147b592.
      
      The new domain changed neverallows, breaking CTS compatability.
      Revert the domain now, with the intention to re-add for the next
      release.
      
      Bug: 62102757
      Test: domain is set to priv_app
      Change-Id: I907ff7c513cd642a306e3eaed3937352ced90005
      c00c07c1
  11. Apr 17, 2017
    • Jerry Zhang's avatar
      Split mediaprovider from priv_app. · c147b592
      Jerry Zhang authored
      MediaProvider requires permissions that diverge from those
      of a typical priv_app. This create a new domain and removes
      Mtp related permissions from priv_app.
      
      Bug: 33574909
      Test: Connect with MTP, download apps and files, select ringtones
      Test: DownloadProvider instrument tests, CtsProviderTestCases
      
      Change-Id: I950dc11f21048c34af639cb3ab81873d2a6730a9
      c147b592
    • Jerry Zhang's avatar
      Split mediaprovider as a separate domain from priv_app · 9f152d98
      Jerry Zhang authored
      MediaProvider requires permissions that diverge from those
      of a typical priv_app. This create a new domain and removes
      Mtp related permissions from priv_app.
      
      Bug: 33574909
      Test: Connect with MTP, download apps and files, select ringtones
      Test: DownloadProvider instrument tests, CtsProviderTestCases
      
      Change-Id: I950dc11f21048c34af639cb3ab81873d2a6730a9
      9f152d98
  12. Mar 02, 2017
  13. Feb 21, 2017
    • Chad Brubaker's avatar
      Add new untrusted_v2_app domain · a782a816
      Chad Brubaker authored
      untrusted_v2_app is basically a refinement of untrusted_app with legacy
      capabilities removed and potentially backwards incompatible changes.
      
      This is not currently hooked up to anything.
      
      Bug: 33350220
      Test: builds
      Change-Id: Ic9fad57476bc2b6022b1eaca8667bf6d844753c2
      a782a816
  14. Feb 14, 2017
    • Jeff Vander Stoep's avatar
      untrusted_app: policy versioning based on targetSdkVersion · bacb6d79
      Jeff Vander Stoep authored
      Motivation:
      Provide the ability to phase in new security policies by
      applying them to apps with a minimum targetSdkVersion.
      
      Place untrusted apps with targetSdkVersion<=25 into the
      untrustd_app_25 domain. Apps with targetSdkVersion>=26 are placed
      into the untrusted_app domain. Common rules are included in the
      untrusted_app_all attribute. Apps with a more recent targetSdkVersion
      are granted fewer permissions.
      
      Test: Marlin builds and boots. Apps targeting targetSdkVersion<=25
      run in untrusted_app_25 domain. Apps targeting the current development
      build >=26 run in the untrusted_app domain with fewer permissions. No
      new denials observed during testing.
      Bug: 34115651
      Bug: 35323421
      Change-Id: Ie6a015566fac07c44ea06c963c40793fcdc9a083
      bacb6d79
    • Michael Peck's avatar
      Add minTargetSdkVersion input selector to seapp_contexts · f54b3622
      Michael Peck authored
      This new input selector allows phasing in new security policies by
      giving app developers an opportunity to make any needed compatibility
      changes before updating each app's targetSdkVersion.
      
      When all else is equal, matching entries with higher
      minTargetSdkVersion= values are preferred over entries with lower
      minTargetSdkVersion= values.
      
      Test: Marlin builds and boots. Apps targeting targetSdkVersion<=25
      run in untrusted_app_25 domain. Apps targeting the current development
      build >=26 run in the untrusted_app domain with fewer permissions. No
      new denials observed during testing.
      Bug: 34115651
      Change-Id: I14bf4f51dbe26cb9bd3f62ad0b281085441d9806
      f54b3622
  15. Feb 06, 2017
  16. Dec 19, 2016
  17. Dec 13, 2016
    • Jeff Sharkey's avatar
      Partially revert "mediaprovider" SELinux domain. · 52da39d9
      Jeff Sharkey authored
      The new domain wasn't fully tested, and it caused many regressions
      on the daily build.  Revert back to using "priv_app" domain until we
      can fully test and re-land the new domain.
      
      Temporarily add the USB functionfs capabilities to priv_app domain
      to keep remainder of MtpService changes working; 33574909 is tracking
      removing that from the priv_app domain.
      
      Test: builds, boots, verified UI and downloads
      Bug: 33569176, 33568261, 33574909
      Change-Id: I1bd0561d52870df0fe488e59ae8307b89978a9cb
      52da39d9
  18. Dec 12, 2016
    • Jerry Zhang's avatar
      Move MediaProvider to its own domain, add new MtpServer permissions · f921dd9c
      Jerry Zhang authored
      Also move necessary priv_app permissions into MediaProvider domain and
      remove MediaProvider specific permissions from priv_app.
      
      The new MtpServer permissions fix the following denials:
      
      avc: denied { write } for comm=6D747020666673206F70656E name="ep0" dev="functionfs" ino=12326 scontext=u:r:priv_app:s0:c512,c768 tcontext=u:object_r:functionfs:s0 tclass=file permissive=1
      
      denial from setting property sys.usb.ffs.mtp.ready, context priv_app
      
      Bug: 30976142
      Test: Manual, verify permissions are allowed
      Change-Id: I4e66c5a8b36be21cdb726b5d00c1ec99c54a4aa4
      f921dd9c
  19. Oct 07, 2016
  20. Oct 06, 2016
    • dcashman's avatar
      Split general policy into public and private components. · cc39f637
      dcashman authored
      Divide policy into public and private components.  This is the first
      step in splitting the policy creation for platform and non-platform
      policies.  The policy in the public directory will be exported for use
      in non-platform policy creation.  Backwards compatibility with it will
      be achieved by converting the exported policy into attribute-based
      policy when included as part of the non-platform policy and a mapping
      file will be maintained to be included with the platform policy that
      maps exported attributes of previous versions to the current platform
      version.
      
      Eventually we would like to create a clear interface between the
      platform and non-platform device components so that the exported policy,
      and the need for attributes is minimal.  For now, almost all types and
      avrules are left in public.
      
      Test: Tested by building policy and running on device.
      
      Change-Id: Idef796c9ec169259787c3f9d8f423edf4ce27f8c
      cc39f637
  21. Nov 09, 2015
    • Jeff Vander Stoep's avatar
      Add autoplay_app domain · 400d3ac1
      Jeff Vander Stoep authored
      Initial check in of empty autoplay_app.te policy file.
      
      Create isAutoPlayApp input selector. Give this selector high precedence -
      only below isSystemServer.
      
      Add neverallow rule disallowing an app context with isAutoPlayApp=true from
      running in a domain other than autoplay_app.
      
      Change-Id: I1d06669d2f1acf953e50867dfa2b264ccaee29a4
      400d3ac1
  22. Oct 14, 2015
  23. Jun 25, 2015
    • William Roberts's avatar
      check_seapp: add support for "neverallow" checks · 81e1f90c
      William Roberts authored
      
      Introduce "neverallow" rules for seapp_contexts. A neverallow rule is
      similar to the existing key-value-pair entries but the line begins
      with "neverallow". A neverallow violation is detected when all keys,
      both inputs and outputs are matched. The neverallow rules value
      parameter (not the key) can contain regular expressions to assist in
      matching. Neverallow rules are never output to the generated
      seapp_contexts file.
      
      Also, unless -o is specified, checkseapp runs in silent mode and
      outputs nothing. Specifying - as an argument to -o outputs to stdout.
      
      Sample Output:
      Error: Rule in File "external/sepolicy/seapp_contexts" on line 87: "user=fake domain=system_app type=app_data_file" violates neverallow in File "external/sepolicy/seapp_contexts" on line 57: "user=((?!system).)* domain=system_app"
      
      Change-Id: Ia4dcbf02feb774f2e201bb0c5d4ce385274d8b8d
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@intel.com>
      81e1f90c
  24. Feb 24, 2015
  25. Jan 07, 2015
    • Nick Kralevich's avatar
      restore shared_relro functionality · b5ffbb7e
      Nick Kralevich authored
      Commit 92dfa31f added "seinfo=platform"
      to all fixed UID domains. However, that caused problems for shared_relro.
      shared_relro runs like an isolated app, and doesn't have an seinfo field
      associated with it.
      
      This causes a crash when system_server attempts to start shared_relro.
      
        W art     : PreZygoteFork called when we already have a zygote space.
        E SELinux : seapp_context_lookup:  No match for app with uid 1037, seinfo (null), name WebViewLoader-armeabi-v7a
        E SELinux : selinux_android_setcontext:  Error setting context for app with uid 1037, seinfo (null): Success
        E Zygote  : selinux_android_setcontext(1037, 0, "(null)", "WebViewLoader-armeabi-v7a") failed
        F art     : art/runtime/jni_internal.cc:508] JNI FatalError called: RuntimeAbort
        I ActivityManager: Start proc WebViewLoader-armeabi-v7a [android.webkit.WebViewFactory$RelroFileCreator] for : pid=2717 uid=1037 gids={} abi=armeabi-v7a
        W libbacktrace: virtual bool BacktraceThread::Unwind(size_t, ucontext_t*): tgkill 1176 failed: No such process
        W libbacktrace: virtual bool BacktraceThread::Unwind(size_t, ucontext_t*): tgkill 1176 failed: No such process
        F art     : art/runtime/runtime.cc:331] Runtime aborting...
        F art     : art/runtime/runtime.cc:331] Aborting thread:
        F art     : art/runtime/runtime.cc:331] "main" prio=5 tid=1 Native
        F art     : art/runtime/runtime.cc:331]   | group="" sCount=0 dsCount=0 obj=0x7298f000 self=0xb4827800
        F art     : art/runtime/runtime.cc:331]   | sysTid=1176 nice=0 cgrp=default sched=0/0 handle=0xb6f22d80
        F art     : art/runtime/runtime.cc:331]   | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
        F art     : art/runtime/runtime.cc:331]   | stack=0xbe39d000-0xbe39f000 stackSize=8MB
        F art     : art/runtime/runtime.cc:331]   | held mutexes= "abort lock" "mutator lock"(shared held)
        F art     : art/runtime/runtime.cc:331]   kernel: (couldn't read /proc/self/task/1176/stack)
        F art     : art/runtime/runtime.cc:331]   native: (backtrace::Unwind failed for thread 1176)
        F art     : art/runtime/runtime.cc:331]   at com.android.internal.os.Zygote.nativeForkAndSpecialize(Native method)
        F art     : art/runtime/runtime.cc:331]   at com.android.internal.os.Zygote.forkAndSpecialize(Zygote.java:91)
        F art     : art/runtime/runtime.cc:331]   at com.android.internal.os.ZygoteConnection.runOnce(ZygoteConnection.java:227)
      
      removing seinfo=platform from shared_relro fixed this bug, but then
      revealed two new SELinux denials:
      
        E SELinux : avc:  denied  { find } for service=webviewupdate scontext=u:r:shared_relro:s0 tcontext=u:object_r:system_server_service:s0 tclass=service_manager
        E SELinux : avc:  denied  { find } for service=activity scontext=u:r:shared_relro:s0 tcontext=u:object_r:system_server_service:s0 tclass=service_manager
      
      Add the needed SELinux rule.
      
      Change-Id: I4372ccfe2e9f3d982796d2c0dc79259aa8a31810
      b5ffbb7e
  26. Sep 29, 2014
  27. Sep 23, 2014
    • Stephen Smalley's avatar
      Enable per-user isolation for normal apps. · a833763b
      Stephen Smalley authored
      
      Add levelFrom=user to the entries for apps other than those
      that run in the predefined platform UIDs (e.g. system, nfc, radio, ...).
      This causes libselinux to assign a per-user category set computed from
      the user ID portion of the Linux UID to each app process and its
      /data/data/<pkgdir> or /data/user/N/<pkgdir> directory.  These
      per-user category sets can be seen in the last field of ps -Z output for
      apps and ls -Z /data/data or /data/user/N output for the package
      directories.
      
      With this applied, apps running on behalf of one user cannot read
      or write files created by apps running on behalf of another user,
      even if the file is world-readable or -writable.  Similar isolation is
      enforced over process interactions (including /proc/pid file access),
      local socket communications, and System V IPC, as expressed in the
      set of constraints defined in the mls configuration.  At present,
      Binder IPC is not restricted by the mls configuration; if desired,
      there is a constraint in the configuration that can be uncommented
      to also apply isolation on direct binder IPC, although communication
      will still be possible indirectly via the system_server.
      
      Bug: 13507660
      Change-Id: I3972f846ff5e7363799ba521f1258d662b18d64e
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      a833763b
  28. Sep 15, 2014
  29. Jul 01, 2014
  30. 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
  31. May 07, 2014
    • 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
  32. 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
  33. Mar 28, 2014
    • Stephen Smalley's avatar
      Move shell entry up with other platform UID entries. · 6d8fa695
      Stephen Smalley authored
      
      This is a trivial change to seapp_contexts to force a relabel
      of /data/data directories by PMS/installd by yielding a
      different hash value for comparison against /data/system/seapp_hash.
      This change does not alter any actual app process or data directory
      labeling decisions.  The seapp_contexts entries are sorted upon
      loading by libselinux to match the precedence rules described
      in the comment header, so ordering in this file should not matter.
      
      This should not be merged before the code changes with the same Change-Id.
      
      Change-Id: Ie440cba2c96f0907458086348197e1506d31c1b6
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      6d8fa695
  34. Mar 14, 2014
  35. 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
  36. Feb 24, 2014
  37. Feb 19, 2014
    • 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
  38. Sep 17, 2013
    • Alex Klyubin's avatar
      1/2: Rename domain "system" to "system_server". · 1fdee11d
      Alex Klyubin authored
      This is a follow-up CL to the extraction of "system_app" domain
      from the "system" domain which left the "system" domain encompassing
      just the system_server.
      
      Since this change cannot be made atomically across different
      repositories, it temporarily adds a typealias "server" pointing to
      "system_server". Once all other repositories have been switched to
      "system_server", this alias will be removed.
      
      Change-Id: I90a6850603dcf60049963462c5572d36de62bc00
      1fdee11d
Loading