Skip to content
Snippets Groups Projects
  1. Nov 15, 2018
    • Nick Kralevich's avatar
      allow apps tun_device ioctl TUNGETIFF; · 3b2df198
      Nick Kralevich authored
      Commit 619c1ef2 ("tun_device: enforce
      ioctl restrictions") completely removed the ability of untrusted apps to
      issue ioctl calls to tun_device. It turns out that this was too
      aggressive. Wireshark apparently uses the TUNGETIFF ioctl.
      
      Fixes the following denial:
      
      audit(0.0:384744): avc: denied { ioctl } for comm=4173796E635461736B202332 path="/dev/tun" dev="tmpfs" ino=19560 ioctlcmd=54d2 scontext=u:r:untrusted_app:s0:c51,c257,c512,c768 tcontext=u:object_r:tun_device:s0 tclass=chr_file permissive=1 app=com.wireguard.android
      
      Test: policy compiles.
      Change-Id: I71bb494036ea692781c00af37580748ab39d1332
      3b2df198
  2. Nov 14, 2018
  3. Nov 13, 2018
    • Risan's avatar
      SELinux changes for AppFuse · 0c1848b1
      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: I827a108bd118090542354360a8c90b295e6a0fef
      0c1848b1
  4. Nov 12, 2018
    • Tri Vo's avatar
      Remove mtd_device type. · ced1751e
      Tri Vo authored
      mtd_device does not label any /dev node present on walleye, and the only
      permission to that type is:
      allow hal_telephony_server mtd_device:dir search;
      I suspect there is no need to keep mtd_device around.
      
      Bug: 110962171
      Test: boot aosp_walleye
      Change-Id: If74b1258b21edeca38c8b7dc07a3a10b751a7e85
      ced1751e
    • Eugene Susla's avatar
      Add SELinux service for RoleManagerService · c496db32
      Eugene Susla authored
      Test: ensure no build failures;
      add RoleManagerService as a boot phase
      ensure no SecurityException in logcat on boot
      Change-Id: Ia0803c0fb084fe2b12f5c20f5e46354d0dd1aedf
      c496db32
  5. Nov 09, 2018
    • Tri Vo's avatar
      Remove dead *_device types from system sepolicy. · b805adaa
      Tri Vo authored
      No coredomain domain has access to these types and corresponding /dev
      nodes don't exist on the device:
      
      audio_seq_device
      audio_timer_device
      full_device
      i2c_device
      vcs_device
      
      Bug: 110962171
      Test: m selinux_policy
      Test: boot walleye
      Change-Id: I89ad4755e6760aa166cb22e2655567e5905dc672
      b805adaa
    • Hongyi Zhang's avatar
      Sepolicies for server configural flags reset · b965e3c5
      Hongyi Zhang authored
      Test: m -j succeeded and manual tested on device
      
      Change-Id: I3415c58335361a9da4ef2368e61bc4e0250a91bb
      b965e3c5
  6. Nov 08, 2018
    • Felipe Leme's avatar
      Added system property (dumpstate.unroot) to run dumpstate as shell. · da54e5f2
      Felipe Leme authored
      This is useful to test how it would behave on devices with user builds.
      
      Bug: 117980186
      Test: adb shell setprop dumpstate.unroot true && \
            adb shell cmd activity bug-report --progress
      
      Change-Id: If9094bbe0c29e8180f1b35d2b4ac95343a1bd0eb
      da54e5f2
    • Martijn Coenen's avatar
      Allow the kernel to access apexd file descriptors. · ac2b2d44
      Martijn Coenen authored
      In earlier kernel versions (<4.0), the loopback driver issues
      requests from a kernel thread. Therefore, the kernel needs access
      to APEX file descriptors and data files (which are loopback
      mounted).
      
      Bug: 119220815
      Test: mounting works on sailfish
      Change-Id: I75b2bade41c64cf6fa6040d9c2f5489a206e04c6
      ac2b2d44
  7. Nov 07, 2018
  8. Nov 06, 2018
    • Luke Huang's avatar
      Clatd: allow clatd use ioctl · c7eb1cd5
      Luke Huang authored
      Test: built, flashed, booted
            Clatd works well
      Bug: 119006129
      
      Change-Id: Ie3b2a7b44040755787787ff2b8e6199cac7aec8e
      c7eb1cd5
  9. Nov 05, 2018
    • Tri Vo's avatar
      Neverallow vendor access to system_file. · 9410105c
      Tri Vo authored
      Bug: 111243627
      Test: m selinux_policy
      Change-Id: I37d03906b93c8810f1d33af736f19fd6ab241c35
      9410105c
    • Felipe Leme's avatar
      New service: intelligence_service · 5bf0c636
      Felipe Leme authored
      Bug: 111276913
      Test: manual verification
      
      Change-Id: Icb309bb07e4e4b39cdc912b1d3dc1ece9cb55f5f
      5bf0c636
    • Kenny Root's avatar
      Allow SystemUI to talk to ADB service · 41ab29ee
      Kenny Root authored
      Mark the ADB service as a system_api_service so that SystemUI can tell
      it that the device is accepted. Refactoring split the AdbService out of
      the UsbService. UsbService is marked as an app_api_service which SystemUI
      is allowed to connect to; AdbService must be marked similarly as either
      system_api_service or app_api_service. However, only system apps should
      talk to AdbService currently.
      
      SELinux : avc:  denied  { find } for service=adb pid=1737 uid=10041 scontext=u:r:platform_app:s0:c512,c768 tcontext=u:object_r:adb_service:s0 tclass=service_manager permissive=0
      
      Introduced in Change-Id Ibf23964665a115a5bc835820dcff98aaf7ba610f
      
      Test: Flash userdebug, accept ADB key, and replug USB
      Bug: 118999282
      Change-Id: I47b5090908ed84d0ba7a9fca100b299011bf8796
      41ab29ee
  10. Nov 02, 2018
  11. 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
    • Nick Kralevich's avatar
      sgdisk: add blk_file ioctls · 79d36513
      Nick Kralevich authored
      Add support for the HDIO_GETGEO and BLKGETSIZE ioctls when operating on
      /dev/block/vold/ block devices.
      
      HDIO_GETGEO is needed by the sgdisk code to get the number of heads on
      the disk drive, likely a side effect of the age of this code.
      https://android.googlesource.com/platform/external/gptfdisk/+/646af625ced09e5d81e07fe8c02c32017e3cbc07/diskio-unix.cc#193
      
      Addresses the following denial:
        audit(0.0:1775): avc: denied { ioctl } for comm="sgdisk" path="/dev/block/vold/disk:8,96" dev="tmpfs" ino=10740855 ioctlcmd=0x301 scontext=u:r:sgdisk:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0
      
      BLKGETSIZE is used to determine the size of the block device. Ideally
      code should not be using this ioctl, as it fails for devices >= 2T in
      size. Technically we don't need to grant this, as the sgdisk code will
      fall back to using BLKGETSIZE64 if BLKGETSIZE fails.
      https://android.googlesource.com/platform/external/gptfdisk/+/646af625ced09e5d81e07fe8c02c32017e3cbc07/diskio-unix.cc#430
      
      Addresses the following denial:
        audit(0.0:1778): avc: denied { ioctl } for comm="sgdisk" path="/dev/block/vold/disk:8,96" dev="tmpfs" ino=10740855 ioctlcmd=0x1260 scontext=u:r:sgdisk:s0 tcontext=u:object_r:vold_device:s0 tclass=blk_file permissive=0
      
      Test: policy compiles.
      Change-Id: Iaa5274721e8a7d1741591570e9e5305723aad640
      79d36513
    • Mark Salyzyn's avatar
      fastboot: /mnt/scratch refined access on userdebug · 33442f57
      Mark Salyzyn authored
      Already has permissions to remove the scratch partition, but to allow
      more refined cleansing (eg: just remove vendor override), need the
      ability to mount and scrub overlay directories.
      
      Test: manual
      Bug: 117605276
      Change-Id: Ibc272c0aa7ce207280023912f5f119ccf5079a7f
      33442f57
    • Hongyi Zhang's avatar
      sepolicy for server configurable flags · a6f98924
      Hongyi Zhang authored
      Test: manual on device
      Change-Id: Ibafe1b345489c88a49a7ed3e2e61e5cc5e1880a1
      a6f98924
    • Minchan Kim's avatar
      export init.svc.bugreport · fac9bc0a
      Minchan Kim authored
      
      Vendor need to hook bugreport propery as well as dumpstatez.
      This CL exports it.
      
      Test: Confirmed verndor can get property trigger hook manually
      Bug: 118718191
      Change-Id: I64a0e38716fb863ccd8923c6c41a776ea341f2d1
      Signed-off-by: default avatarMinchan Kim <minchan@google.com>
      fac9bc0a
  12. Oct 31, 2018
    • 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
  13. Oct 30, 2018
    • David Anderson's avatar
      Allow BLKIOMIN and BLKALIGNOFF ioctls to the super device in fastbootd. · bf0bf05a
      David Anderson authored
      These ioctls are similar to BLKGETSIZE64; they return benign information
      about the partition's alignment, and are used by liblp to optimally
      align dynamic partition extents.
      
      The system_block_device is included here because on retrofit devices,
      the "super" partition is mapped to the system partition.
      
      Bug: 116802789
      Test: fastboot flashall
      Change-Id: I38282904828105cf5f16ce9d4b5884d2b0e89d38
      bf0bf05a
    • Nick Kralevich's avatar
      Revert "SELinux changes for AppFuse" · c4cf9860
      Nick Kralevich authored
      This reverts commit 67ed4328.
      
      Reason for revert: Broken CTS test. See b/118642091
      
      Bug: 118642091
      Bug: 110379912
      Change-Id: I5afd16bf23149c74f2740720cdd248a255ff1497
      c4cf9860
  14. Oct 27, 2018
    • Jeff Sharkey's avatar
      vold does more than LOOP_GET_STATUS64. · f2cad2d9
      Jeff Sharkey authored
      Update the "allowxperm" to reflect the various ioctl() performed in
      the vold source code.
      
      Bug: 118437832
      Test: atest android.os.storage.cts.StorageManagerTest
      Change-Id: Ide3a09104d8b4ce7fa2b7e23e9b215139186f595
      f2cad2d9
  15. Oct 26, 2018
    • 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
  16. Oct 25, 2018
  17. Oct 24, 2018
    • Jack Yu's avatar
      Added a new system properties for IWLAN operation mode · b10f4eba
      Jack Yu authored
      Added a new flag to specify the IWLAN operation mode. Also
      allowed this system properties for vendor native service to
      access.
      
      Test: Manual
      Bug: 73659459
      Change-Id: I23197e451557fae36a0cc5da4b50b3a00f9233dc
      b10f4eba
    • 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
  18. Oct 23, 2018
    • Nick Kralevich's avatar
      update_engine_common: expand default allowed ioctl list · 7b5e82a8
      Nick Kralevich authored
      update_engine does a lot to keep partitions secure and tidy. Allow the
      ioctls necessary to allow that to happen.
      
      Addresses the following denials:
      
      update_engine: type=1400 audit(0.0:6): avc: denied { ioctl } for path="/dev/block/sda20" dev="tmpfs" ino=13850 ioctlcmd=1277 scontext=u:r:update_engine:s0 tcontext=u:object_r:boot_block_device:s0 tclass=blk_file permissive=0
      update_engine: type=1400 audit(0.0:8): avc: denied { ioctl } for path="/dev/block/sda20" dev="tmpfs" ino=13850 ioctlcmd=127c scontext=u:r:update_engine:s0 tcontext=u:object_r:boot_block_device:s0 tclass=blk_file permissive=0
      update_engine: type=1400 audit(0.0:9): avc: denied { ioctl } for path="/dev/block/sda20" dev="tmpfs" ino=13850 ioctlcmd=127f scontext=u:r:update_engine:s0 tcontext=u:object_r:boot_block_device:s0 tclass=blk_file permissive=0
      update_engine: type=1400 audit(0.0:13): avc: denied { ioctl } for path="/dev/block/sda18" dev="tmpfs" ino=12601 ioctlcmd=127d scontext=u:r:update_engine:s0 tcontext=u:object_r:custom_ab_block_device:s0 tclass=blk_file permissive=0
      
      Bug: 118319505
      Test: policy compiles.
      Change-Id: I424f2a13ced2324b4c0c35b0f510b9aea748d5aa
      7b5e82a8
    • Nick Kralevich's avatar
      Expand BLKROGET and BLKROSET to all block devices. · e844681c
      Nick Kralevich authored
      Update engine is responsible for updating various partitions, which
      includes enabling or disabling the read-only bit on the underlying block
      device.
      
      Rather than try to list out each block device separately, generalize the
      ioctl rules to apply to all block device nodes. If the ioctl permission
      is granted via a normal allow rule, then the allowxperm statement will
      allow BLKROGET and BLKROSET by default on those block devices.
      
      Test: policy compiles
      Bug: 118150702
      Change-Id: I7bca52e0f442df7320748f6d6371e5016aa6dd0b
      e844681c
    • Nick Kralevich's avatar
      vold.te: allow BLKSECDISCARD · 787fc8d0
      Nick Kralevich authored
      vold needs to securely delete content from various block devices. Allow
      it.
      
      Addresses the following denials:
      
      type=1400 audit(0.0:66): avc: denied { ioctl } for comm="secdiscard" path="/dev/block/dm-3" dev="tmpfs" ino=17945 ioctlcmd=0x127d scontext=u:r:vold:s0 tcontext=u:object_r:dm_device:s0 tclass=blk_file permissive=0
      type=1400 audit(0.0:43): avc: denied { ioctl } for comm="secdiscard" path="/dev/block/sda45" dev="tmpfs" ino=17485 ioctlcmd=127d scontext=u:r:vold:s0 tcontext=u:object_r:userdata_block_device:s0 tclass=blk_file permissive=0
      
      Test: policy compiles.
      Change-Id: Ie7b4b8ac4698d9002a4e8d142d4e463f8d42899a
      787fc8d0
  19. Oct 22, 2018
    • Tri Vo's avatar
      asan: restore global access to system_asan_options_file. · 3d2e200b
      Tri Vo authored
      Bug: 118161817
      Test: SANITIZE_TARGET=address m selinux_policy
      Change-Id: I4dabcb3692c59b810a06567e272bca9f0e9c3ecd
      3d2e200b
    • Joel Galenson's avatar
      Allow dumpstate to call mediaswcodec over binder · 33ded4a6
      Joel Galenson authored
      This prevents denials while taking a bugreport.
      
      Test: cts-tradefed run cts -m CtsSecurityHostTestCases -t
      android.security.cts.SELinuxHostTest#testNoBugreportDenials
      
      Change-Id: I381b39fa127f82fcef5d820a04209fd1ba4f63cd
      33ded4a6
    • Nick Kralevich's avatar
      update_engine_common: allow BLKROGET and BLKROSET · eacbcc98
      Nick Kralevich authored
      Allow BLKROGET and BLKROSET on the block devices underlying the /system
      and rootfs partitions. As part of the Android boot process, the system
      sets the block devices read-only to prevent accidental modification to
      these partitions. Update engine needs the ability to adjust the block
      device read-only flag in order to apply updates.
      
      Addresses the following denials:
      
      update_engine: type=1400 audit(0.0:96): avc: denied { ioctl } for path="/dev/block/sda33" dev="tmpfs" ino=15369 ioctlcmd=125e scontext=u:r:update_engine:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0
      update_engine: type=1400 audit(0.0:97): avc: denied { ioctl } for path="/dev/block/sda33" dev="tmpfs" ino=15369 ioctlcmd=125d scontext=u:r:update_engine:s0 tcontext=u:object_r:system_block_device:s0 tclass=blk_file permissive=0
      
      Test: policy compiles
      Bug: 118150702
      Change-Id: I65a3d041b6d6b7955bcd901637a543524fc34a06
      eacbcc98
    • Nick Kralevich's avatar
      fastbootd.te: Delete allowxperm statement · 392ac0fd
      Nick Kralevich authored
      system/sepolicy commit 4c8eaba7, reviewed in
      https://android-review.googlesource.com/c/platform/system/sepolicy/+/793958
      started enforcing explicit ioctl permission checks for all block device
      files. As part of that commit, the following lines were added to
      domain.te:
      
        # If a domain has access to perform an ioctl on a block device, allow these
        # very common, benign ioctls
        allowxperm domain dev_type:blk_file ioctl { BLKGETSIZE64 BLKSSZGET };
      
      In essence, if a domain is granted ioctl access to any device in
      policy (for example, via adding "ioctl" to the allow rule, or by using
      the macro "r_file_perms" which includes the ioctl permission), then the
      two ioctls BLKGETSIZE64 and BLKSSZGET will be automatically allowed. As
      such, it is redundent for a domain to explicitly request these two
      ioctls.
      
      Delete the now redundant allowxperm rule.
      
      Test: policy compiles
      Change-Id: I1964ed93a7c7601393cc9e2416f3640ea22db51b
      392ac0fd
Loading