Skip to content
Snippets Groups Projects
  1. Nov 07, 2018
  2. Nov 06, 2018
  3. Nov 05, 2018
  4. Nov 02, 2018
  5. Nov 01, 2018
    • Nick Kralevich's avatar
      tun_device: enforce ioctl restrictions · 619c1ef2
      Nick Kralevich authored
      Require all SELinux domains which have permission to perform ioctls on
      /dev/tun explicitly specify what ioctls they perform. Only allow the
      safe defaults FIOCLEX and FIONCLEX, which are alternate, uncommon ways
      to set and unset the O_CLOEXEC flag.
      
      Remove app's ability to issue *any* ioctls on /dev/tun, period. Add
      neverallow assertions (compile time assertion + CTS test) to prevent
      regressions.
      
      Limit system_server's ability to perform ioctls on /dev/tun to FIOCLEX,
      FIONCLEX, TUNGETIFF, and TUNSETIFF. Testing and source code examination
      shows that only TUNGETIFF and TUNSETIFF are used by system_server.
      
      The goal of this change is to put SELinux ioctl controls in place for
      /dev/tun, so we don't have to maintain the custom kernel patch at
      https://android.googlesource.com/kernel/common/+/11cee2be0c2062ba88f04eb51196506f870a3b5d%5E%21
      
      Delete the neverallow assertion in isolated_app.te. This is already
      covered by the assertion present in app_neverallows.te.
      
      Test: cts-tradefed run cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideVpnTests
      Test: cts-tradefed run cts -m CtsHostsideNetworkTests
      Test: cts-tradefed run cts -m CtsNetTestCases
      Bug: 111560739
      Bug: 111560570
      Change-Id: Ibe1c3a9e880db0bee438535554abdbc6d84eec45
      619c1ef2
    • Hongyi Zhang's avatar
      sepolicy for server configurable flags · a6f98924
      Hongyi Zhang authored
      Test: manual on device
      Change-Id: Ibafe1b345489c88a49a7ed3e2e61e5cc5e1880a1
      a6f98924
  6. Oct 31, 2018
    • Nick Kralevich's avatar
      isolated_app: add mmaps · 00252207
      Nick Kralevich authored
      Kernel commit 3ba4bf5f1e2c ("selinux: add a map permission check for mmap")
      added a map permission check on mmap so that we can
      distinguish memory mapped access (since it has different implications
      for revocation). system/sepolicy commit
      4397f082 introduced the permission to
      Android and updated common macros. Since then, we've been adding more
      mmap support where it was accidentally omitted.
      
      Add the ability for isolated_apps to mmap() app data files. There's no
      reason why this should be blocked. Also fixup sdcard access which has
      similar problems.
      
      Bug: 118760652
      Bug: https://crbug.com/892014
      Test: policy compiles.
      Change-Id: I3823f313103c9dcedf3b21d081a22f8fbb271c02
      00252207
    • Nick Kralevich's avatar
      Transient SELinux domain for system_server JIT · caf42d61
      Nick Kralevich authored
      Create a transient SELinux domain where system_server can perform
      certain JIT setup. The idea is that system_server will start in the
      system_server_startup domain, setup certain JIT pages, then perform a
      one-way transition into the system_server domain. From that point,
      further JITing operations are disallowed.
      
      Bug: 62356545
      Test: device boots, no permission errors
      Change-Id: Ic55b2cc5aba420ebcf62736622e08881a4779004
      caf42d61
    • Nick Kralevich's avatar
      Revert "Enforce execve() restrictions for API > 28" · 15d1a12f
      Nick Kralevich authored
      This reverts commit 0dd738d8.
      
      Reason for revert: CtsSimpleperfTestCases CTS test case failures.
      See b/118704604 for details.
      
      Bug: 112357170
      Bug: 118704604
      Change-Id: Ibe921f3bbc3404694542ef695883c1a30777d68b
      15d1a12f
  7. Oct 30, 2018
  8. Oct 29, 2018
    • Nick Kralevich's avatar
      Enforce execve() restrictions for API > 28 · 0dd738d8
      Nick Kralevich authored
      untrusted_app: Remove the ability to run execve() on files within an
      application's home directory. Executing code from a writable /home
      directory is a W^X violation (https://en.wikipedia.org/wiki/W%5EX).
      Additionally, loading code from application home directories violates a
      security requirement that all executable code mapped into memory must
      come from signed sources, or be derived from signed sources.
      
      Note: this change does *not* remove the ability to load executable code
      through other mechanisms, such as mmap(PROT_EXEC) of a file descriptor
      from the app's home directory. In particular, functionality like
      dlopen() on files in an app's home directory continues to work even
      after this change.
      
      untrusted_app_25 and untrusted_app_27: For backwards compatibility,
      continue to allow these domains to execve() files from the
      application's home directory.
      
      seapp_contexts: Bump the minimum API level required to enter the
      untrusted_app domain. This will run API level 27-28 processes in
      the API level 27 sandbox. API level 28 will continue to run with
      levelFrom=all, and API level 27 will continue to run with
      levelFrom=user.
      
      Bug: 112357170
      Test: Device boots and no obvious problems.
      Test: See CTS test at https://android-review.googlesource.com/c/platform/cts/+/804228
      Change-Id: Ief9ae3a227d16ab5792f43bacbb577c1e70185a0
      0dd738d8
  9. Oct 27, 2018
    • Nick Kralevich's avatar
      drop priv_app app_data_file:file execute; · e1ddd741
      Nick Kralevich authored
      system/sepolicy commit 23c9d91b
      introduced a new type called privapp_data_file. This type is used to
      label priv-app's /home files. For backwards compatibility, priv-app
      rules involving normal app_data_files were preserved. Subsequently,
      system/sepolicy commit 5d175519
      assigned the file label privapp_data_file to /home files owned
      by priv-apps.
      
      Because of the previous labeling of priv-app data files, priv-apps were
      granted the ability to mmap(PROT_EXEC) any other app's /home files,
      regardless of how trustworthy or untrustworthy those files were. Commit
      23c9d91b preserved the status quo.
      However, now that we have a more refined label for priv-app /home files,
      we no longer need to be as permissive.
      
      Drop the ability for priv-apps to map executable code from
      untrusted_apps home directories. "execute" is removed in this change,
      and "execute_no_trans" was previously removed in commit
      8fb4cb8b. Add a neverallow assertion
      (compile time assertion + CTS test) to prevent regressions.
      
      Further clarify why we need to support priv-apps loading executable code
      from their own home directories, at least for now. b/112037137 covers
      further tightening we can do in this area.
      
      Bug: 112357170
      Test: Device boots and no problems.
      Change-Id: Ia6a9eb4c2ed8a02ad45644d025181ba3c8424cda
      e1ddd741
  10. Oct 26, 2018
    • Nick Kralevich's avatar
      Switch to r_file_perms · 0bfa7b53
      Nick Kralevich authored
      The current rule is missing mmap. r_file_perm implicitly adds mmap, so
      we should just use that instead.
      
      Test: policy compiles.
      Change-Id: I4051d1eb4c36a2b6ff2b5f26ce53355287cbe2b4
      0bfa7b53
    • Risan's avatar
      SELinux changes for AppFuse · 67ed4328
      Risan authored
      We are moving AppFuse mount from system_server's mount namespace to
      vold. Hence, we could reduce the SELinux permissions given to
      system_server, in the expense of adding allow rules to vold and
      letting appdomain have access to vold's fd.
      
      Bug: 110379912
      Test: testOpenProxyFileDescriptor passes (after vold and
      system_server code changes)
      
      Change-Id: I4731a8ec846c5cb84ec4b680d51938494e8ddd75
      67ed4328
    • Tri Vo's avatar
      same_process_hal_file: access to individual coredomains · 90cf5a7f
      Tri Vo authored
      Remove blanket coredomain access to same_process_hal_file in favor of
      granular access. This change takes into account audits from go/sedenials
      (our internal dogfood program)
      
      Bug: 37211678
      Test: m selinux_policy
      Change-Id: I5634fb65c72d13007e40c131a600585a05b8c4b5
      90cf5a7f
    • Jiyong Park's avatar
      Allow apexd more ioctl cmds for loop devices · 173a1d9a
      Jiyong Park authored
      apexd is using following additional ioctl cmds to mount the mini
      filesystem inside APEXs:
      
       LOOP_SET_STATUS64
       LOOP_SET_FD
       LOOP_SET_BLOCK_SIZE
       LOOP_SET_DIRECT_IO
       LOOP_CLR_FD
      
      Test: m; m apex.test; adb push <the_built_apex> /data/apex; adb reboot
      
      /apex/com.android.example.apex exists
      
      Change-Id: I68388cc4f323e4fcff370c8cdc0958cbd827e9cc
      173a1d9a
    • Tri Vo's avatar
      Don't label /dev/tegra.* from core policy · 2ea956c0
      Tri Vo authored
      /dev/tegra.* is not used in android platform and is device-specific
      
      Bug: 110962171
      Test: boot walleye
      Change-Id: I4cc790d28457b429a3ed9829de223dae357eb498
      2ea956c0
  11. Oct 25, 2018
  12. Oct 24, 2018
    • Anton Hansson's avatar
      Properly escape dots in file_contexts filenames · c6742dbb
      Anton Hansson authored
      I found these with the regex (?<!\\)\.(?!\*|\+)
      
      Test: make
      Change-Id: I1c2e817d164b1074cb359cdb6d46bcf71e220765
      c6742dbb
    • Tom Cherry's avatar
      Combine vendor-init-actionable with vendor-init-readable · 30dd7111
      Tom Cherry authored
      Historically, vendor-init-actionable was created since the various
      property_contexts files were not yet available when init parses its
      scripts.  Since then, the property_contexts files are now always
      available when init parses its scripts, so we can collapse these two
      categories.
      
      Specifically, this change ensures that all of the properties in the
      previous 'stable_properties.h' file in init, which contained the
      vendor-init-actionable properties, are able to be read by init
      according to SEPolicy.
      
      Bug: 71814576
      Test: vendor_init fails to use non-readable properties as a trigger
      Test: vendor_init successfully uses readable properties as a trigger
      
      Change-Id: Ic6d9919b6047f3076a1a19fc26295c6a77aca627
      30dd7111
  13. Oct 23, 2018
    • Sudheer Shanka's avatar
      Track vrcore_app SELinux denial · 95767cce
      Sudheer Shanka authored
      Bug: 118185801
      Test: bug no. appears in the denial logs
      Change-Id: Ib1d1bbbdf25e0e63ac8a7dec98aca08cafc3f870
      95767cce
    • Anton Hansson's avatar
      Add sepolicy for preloads_copy script · edd13bc3
      Anton Hansson authored
      Copied from device/google/crosshatch-sepolicy.
      
      Test: diff files in system/etc/selinux before and after for aosp_marlin
      Change-Id: I518c43af9c217483bdab02424e4aef0270aad366
      edd13bc3
    • ji, zhenlong z's avatar
      sepolicy: Allow apps to get info from priv_app by ashmem · fdfa42bf
      ji, zhenlong z authored
      This is used to address a CTS testcase failure. This CTS
      testcase need to access the content of Contact, some data
      from ContactProvider is transfered through ashmem.
      
      Currently ashmem is backed by the tmpfs filesystem, ContactProvider
      in android run as a priv_app, so the file context of the ashmem
      created by ContactProvider is priv_app_tmpfs. CTS runs as an
      untrusted_app, need to be granted the read permission to the
      priv_app_tmpfs files.
      
      Bug: 117961216
      
      [Android Version]:
      android_p_mr0_r0
      
      [Kernel Version]:
      4.19.0-rc8
      
      [CTS Version]:
      cts-9.0_r1
      
      [Failed Testcase]:
      com.android.cts.devicepolicy.ManagedProfileTest#testManagedContactsPolicies
      
      [Error Log]:
      11-11 11:15:50.479 12611 12611 W AndroidTestSuit: type=1400 audit(0.0:811):
      avc: denied { read } for path=2F6465762F6173686D656D202864656C6574656429
      dev="tmpfs" ino=174636 scontext=u:r:untrusted_app:s0:c113,c256,c522,c768
      tcontext=u:object_r:priv_app_tmpfs:s0:c522,c768 tclass=file permissive=0
      
      [Test Result With This Patch]:
      PASS
      
      Change-Id: I45efacabe64af36912a53df60ac059889fde1629
      fdfa42bf
  14. Oct 18, 2018
    • Nick Kralevich's avatar
      start enforcing ioctl restrictions on blk_file · 4c8eaba7
      Nick Kralevich authored
      Start enforcing the use of ioctl restrictions on all Android block
      devices. Domains which perform ioctls on block devices must be explicit
      about what ioctls they issue. The only ioctls allowed by default are
      BLKGETSIZE64, BLKSSZGET, FIOCLEX, and FIONCLEX.
      
      Test: device boots and no problems.
      Change-Id: I1195756b20cf2b50bede1eb04a48145a97a35867
      4c8eaba7
    • Nick Kralevich's avatar
      priv_app: remove /proc/net access · dfc3c336
      Nick Kralevich authored
      Remove most of /proc/net access for priv_apps. Files in /proc/net leak
      unique device identifiers and side channel information about other app's
      network connections.
      
      Access for most third party applications was removed in commit
      d78e07cb. This change applies the same
      constraints to priv-apps that we apply to normal apps.
      
      Bug: 114475727
      Bug: 9496886
      Bug: 68016944
      Test: policy compiles and device boots
      Change-Id: I5c41ba57fcd6b81d72c4f3a40b310d2188fc79c3
      dfc3c336
    • Nick Kralevich's avatar
      Move class bpf definition · f5a1b1bf
      Nick Kralevich authored
      No functional change. This reorg just makes it easier to perform diffs
      against https://github.com/SELinuxProject/refpolicy/blob/master/policy/flask/access_vectors
      
      Test: policy builds.
      Change-Id: I10cf9547d57981c76ee7e76daa382bb504e36d0b
      f5a1b1bf
    • Jiyong Park's avatar
      Allow apexd to realpath(3) on apex_key_files · ecc09871
      Jiyong Park authored
      apexd uses realpath(3) to ensure that the public key file that will use
      is under /system/etc/security/apex directory. In order to support it,
      allow apexd to getattr on apex_key_files.
      
      The canonicalization is required because the key name from APEX might be
      wrong. For example, if the key name from an APEX is '../../some/path'
      then apexd will use '/system/etc/security/apex/../../some/path' as the
      public key file, which is incorrect.
      
      Bug: 115721587
      Test: m apex.test; m
      /apex/com.android.example.apex@1 exists
      
      Change-Id: I6dc5efa0de369f8497e4f6526e0164e2de589c67
      ecc09871
  15. Oct 17, 2018
    • Nick Kralevich's avatar
      mediaprovider: add functionfs ioctl · a73f58ae
      Nick Kralevich authored
      Addresses the following denial:
      
      type=1400 audit(0.0:51894): avc: denied { ioctl } for comm="MtpServer" path="/dev/usb-ffs/mtp/ep1" dev="functionfs" ino=30291 ioctlcmd=0x6782 scontext=u:r:mediaprovider:s0:c512,c768 tcontext=u:object_r:functionfs:s0 tclass=file permissive=0 app=com.android.providers.media
      
      Test: policy compiles.
      Change-Id: I5290abb2848e5824669dae4cea829d4cbea98ab4
      a73f58ae
    • Dario Freni's avatar
      Allow apexd to create symlink in /apex. · bab267a8
      Dario Freni authored
      Bug: 115710947
      Test: on device
      Change-Id: Ie712689d80fb829f16de70e865cac4f0ff4e9b35
      bab267a8
  16. Oct 16, 2018
    • Bowgo Tsai's avatar
      Allow input config to be under /vendor/odm · 59129311
      Bowgo Tsai authored
      Input config should be under /odm when it's "device-specific",
      instead of /vendor (for "SoC-specific").
      
      However, not all device have /odm partition so having the fallback
      symlink: /odm -> /vendor/odm is important
      
      Bug: 112880217
      Test: build
      Change-Id: I294e2b172d06d58a42c51c128e448c7644f854dc
      59129311
  17. Oct 15, 2018
    • Chong Zhang's avatar
      add media.codec.update service · 52fb3edb
      Chong Zhang authored
      Add a service in mediaswcodec to load updated codecs,
      and restrict it to userdebug/eng. Reuse existing
      mediaextractor_update_service since the codec update
      service is identical, this avoids adding a new one
      for now as we may not need the service anymore
      after switching to APEX.
      
      Bug: 111407413
      Bug: 117290290
      
      Change-Id: Ia75256f47433bd13ed819c70c1fb34ecd5d507b4
      52fb3edb
    • Florian Mayer's avatar
      Add heapprofd selinux config. · 4fde9ec7
      Florian Mayer authored
      This does not actually grant any permissions but just adds the
      necessary boilerplate for a new service.
      
      Bug: 117762471
      Bug: 117761873
      
      Change-Id: I7cdd2ae368616cfd54fc685c15f775604bfc80d4
      4fde9ec7
  18. Oct 13, 2018
    • Tri Vo's avatar
      Audit access to same_process_hal_file. · 81ade3dd
      Tri Vo authored
      same_process_hal_file is exempted from many Treble neverallows. We want
      to know which processes access this type to eventually constrain access
      to it.
      
      Bug: 37211678
      Test: m selinux_policy
      Change-Id: I61c0df21250eb1b1ae2d9c5fa9c801a828539813
      81ade3dd
  19. Oct 12, 2018
    • Tri Vo's avatar
      Add type for /system/bin/tcpdump. · e8b33c31
      Tri Vo authored
      We add this type with the intent to expose /system/bin/tcpdump to
      vendor on userdebug devices only.
      
      Bug: 111243627
      Test: device boots /system/bin/tcpdump correctly labeled as
      tcpdump_exec, can browse internet, turn wifi on/off
      Change-Id: Icb35e84c87120d198fbb2b44edfa5edf6021d0f0
      e8b33c31
    • Siarhei Vishniakou's avatar
      Allow system_server to read vendor_file · 3639f579
      Siarhei Vishniakou authored
      Input device configuration files .idc, .kl that are placed in /vendor
      are currently not accessible.
      Allow the read access here.
      
      Bug: 112880217
      Test: move .idc and .kl files from /system to /vendor, then observe
      logcat. With this patch, avc denials disappear.
      
      Change-Id: I72ad62b9adf415f787565adced73fd8aaff38832
      3639f579
  20. Oct 11, 2018
    • Chong Zhang's avatar
      add mediaswcodec service · bdbfff1b
      Chong Zhang authored
      Set up a new service for sw media codec services.
      
      Bug: 111407413
      
      Test: cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice
      Change-Id: Ia1c6a9ef3f0c1d84b2be8756eb1853ffa0597f8e
      bdbfff1b
    • Nick Kralevich's avatar
      remove system_app proc_net_type access · 2e251461
      Nick Kralevich authored
      The auditallow added in 7a4af30b has not triggered. This is safe to
      remove.
      
      Test: device boots and no obvious problems.
      Test: No audit messages seen since May 2018 on go/sedenials
      Bug: 9496886
      Bug: 68016944
      Change-Id: I3861b462467e1fc31e67a263ad06716a4111dcb8
      2e251461
    • Tri Vo's avatar
      Constrain cgroups access. · f55c989d
      Tri Vo authored
      What changed:
      - Removed cgroup access from untrusted and priv apps.
      - Settings app writes to /dev/stune/foreground/tasks, so system_app domain
      retains access to cgroup.
      - libcutils exports API to /dev/{cpuset, stune}/*. This API seems to be used
      abundantly in native code. So added a blanket allow rule for (coredomain - apps)
      to access cgroups.
      - For now, only audit cgroup access from vendor domains. Ultimately, we want to
      either constrain vendor access to individual domains or, even better, remove
      vendor access and have platform manage cgroups exclusively.
      
      Changes from original aosp/692189 which was reverted:
      - There seem to be spurious denials from vendor-specific apps. So added
      back access from { appdomain -all_untrusted_apps -priv_app } to cgroup.
      Audit this access with intent to write explicit per-domain rules for it.
      
      Bug: 110043362
      Test: adb shell setprop ro.config.per_app_memcg true, device correctly populates
      /dev/memcg on a per app basis on a device that supports that.
      Test: aosp_sailfish, wahoo boot without cgroup denials
      This reverts commit cacea25e.
      Change-Id: I05ab404f348a864e8409d811346c8a0bf49bc47a
      f55c989d
  21. Oct 10, 2018
    • Sooraj Sasindran's avatar
      Add ians service contexts · ffaf66d4
      Sooraj Sasindran authored
      Add ians service contexts
      
      Bug: 113106744
      Test: verified from service list that ianas is
            registered
      Change-Id: Iea653416ffa45cba07a544826e0a2395d31cedca
      Merged-In: Iea653416ffa45cba07a544826e0a2395d31cedca
      ffaf66d4
Loading