Skip to content
Snippets Groups Projects
  1. Oct 11, 2018
    • 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
  2. Oct 10, 2018
    • Nick Kralevich's avatar
      property files: remove ioctl and lock · 0e791073
      Nick Kralevich authored
      They are unneeded.
      
      Test: device boots and no obvious problems.
      Change-Id: Ib788a89645c893c8c36acbe7fb34ce93bf6a57d7
      0e791073
    • Nick Kralevich's avatar
      Move to ioctl whitelisting for plain files / directories · ebc3a1a3
      Nick Kralevich authored
      Remove kernel attack surface associated with ioctls on plain files. In
      particular, we want to ensure that the ioctls FS_IOC_ENABLE_VERITY and
      FS_IOC_MEASURE_VERITY are not exposed outside a whitelisted set of
      entities. However, it's straight forward enough to turn on ioctl
      whitelisting for everything, so we choose to do so.
      
      Test: policy compiles and device boots
      Test: device boots with data wipe
      Test: device boots without data wipe
      Change-Id: I545ae76dddaa2193890eeb1d404db79d1ffa13c2
      ebc3a1a3
    • Nick Kralevich's avatar
      Revert "Constrain cgroups access." · cacea25e
      Nick Kralevich authored
      This reverts commit 9899568f.
      
      Reason for revert: Reports of high numbers of SELinux denials
      showing up on the SELinux dashboard.
      
      Bug: 110043362
      Change-Id: Id8fc260c47ffd269ac2f15ff7dab668c959e3ab0
      cacea25e
  3. Oct 09, 2018
    • Tri Vo's avatar
      Constrain cgroups access. · 9899568f
      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.
      
      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
      Change-Id: I9e441b26792f1edb1663c660bcff422ec7a6332b
      9899568f
  4. Oct 08, 2018
    • Igor Murashkin's avatar
      iorapd: Add new binder service iorapd. · 72a88b19
      Igor Murashkin authored
      This daemon is very locked down. Only system_server can access it.
      
      Bug: 72170747
      Change-Id: I7b72b9191cb192be96001d84d067c28292c9688f
      72a88b19
    • Mark Salyzyn's avatar
      fs_mgr: add /mnt/scratch to possible overlayfs support directories · 1369dfca
      Mark Salyzyn authored
      A default set of options are available, but can override in a fstab
      overlay entry with upperdir=, lowerdir= to the same mount point,
      workdir=.  The default is a valid /mnt/scratch/overlay/
      or /cache/overlay/ directory, with .../<mount_point>/upper and
      .../<mount_point>/work, associated with each system partition
      <mount_point>.
      
      Test: manual
      Bug: 109821005
      Change-Id: I5662c01fad17d105665be065f6dcd7c3fdc40d95
      1369dfca
  5. Oct 04, 2018
    • Martijn Coenen's avatar
      Add policy for apexd. · ac097ac4
      Martijn Coenen authored
      apexd is a new daemon for managing APEX packages installed
      on the device. It hosts a single binder service, "apexservice".
      
      Bug: 112455435
      Test: builds, binder service can be registered,
            apexes can be accessed, verified and mounted
      Change-Id: I634ad100f10b2edcd9a9c0df0d33896fa5d4ed97
      ac097ac4
  6. Sep 27, 2018
    • Nick Kralevich's avatar
      Introduce system_file_type · 5e37271d
      Nick Kralevich authored
      system_file_type is a new attribute used to identify files which exist
      on the /system partition. It's useful for allow rules in init, which are
      based off of a blacklist of writable files. Additionally, it's useful
      for constructing neverallow rules to prevent regressions.
      
      Additionally, add commented out tests which enforce that all files on
      the /system partition have the system_file_type attribute. These tests
      will be uncommented in a future change after all the device-specific
      policies are cleaned up.
      
      Test: Device boots and no obvious problems.
      Change-Id: Id9bae6625f042594c8eba74ca712abb09702c1e5
      5e37271d
  7. Sep 19, 2018
    • Benjamin Gordon's avatar
      sepolicy: grant dac_read_search to domains with dac_override · 342362ae
      Benjamin Gordon authored
      kernel commit 2a4c22426955d4fc04069811997b7390c0fb858e (fs: switch order
      of CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH checks) swapped the order of
      dac_override and dac_read_search checks.  Domains that have dac_override
      will now generate spurious denials for dac_read_search unless they also
      have that permission.  Since dac_override is a strict superset of
      dac_read_search, grant dac_read_search to all domains that already have
      dac_override to get rid of the denials.
      
      Bug: 114280985
      Bug: crbug.com/877588
      Test: Booted on a device running 4.14.
      Change-Id: I5c1c136b775cceeb7f170e139e8d4279e73267a4
      342362ae
  8. Sep 14, 2018
    • Nick Kralevich's avatar
      Strengthen ptrace neverallow rules · 095fbea5
      Nick Kralevich authored
      Add additional compile time constraints on the ability to ptrace various
      sensitive domains.
      
      llkd: remove some domains which llkd should never ptrace, even on
      debuggable builds, such as kernel threads and init.
      
      crash_dump neverallows: Remove the ptrace neverallow checks because
      it duplicates other neverallow assertions spread throughout the policy.
      
      Test: policy compiles and device boots
      Change-Id: Ia4240d1ce7143b983bb048e046bb4729d0af5a6e
      095fbea5
  9. Sep 11, 2018
    • Martijn Coenen's avatar
      Allow init to use binder. · a720d3d0
      Martijn Coenen authored
      But in a very restricted form:
      1) Nobody can initiate calls into init
      2) Nobody can transfer binder objects into init, except servicemanager
      
      Bug: 112684055
      Test: device boots
      Change-Id: Icfb218f2871e234284c74e096eccd7a2e786cf94
      a720d3d0
  10. Aug 28, 2018
  11. Aug 13, 2018
    • Nick Kralevich's avatar
      more mmaps · bedfb22a
      Nick Kralevich authored
      Linux kernel 4.14+ SELinux starts explicit map
      permission check for file mmap operations. For backards
      compat, add mmap in more places where we explicitly
      list out individual file permissions.
      
      Test: policy compiles
      Change-Id: Idc4ca53769f2e7aa12ed93ab27191ed92da37a3e
      bedfb22a
  12. Aug 08, 2018
    • Mark Salyzyn's avatar
      fs_mgr: add overlayfs handling for squashfs system filesystems · 9b398f3f
      Mark Salyzyn authored
      /cache/overlay directory in support of overlayfs mounts on userdebug
      and eng devices.  Overlayfs in turn can be capable of supporting
      adb remount for read-only or restricted-storage filesystems like
      squashfs or right-sized (zero free space) system partitions
      respectively.
      
      Test: compile
      Bug: 109821005
      Bug: 110985612
      Change-Id: I3ece03886db7cc97f864497cf93ec6c6c39bccd1
      9b398f3f
  13. Aug 02, 2018
    • Nick Kralevich's avatar
      Start partitioning off privapp_data_file from app_data_file · 23c9d91b
      Nick Kralevich authored
      Currently, both untrusted apps and priv-apps use the SELinux file label
      "app_data_file" for files in their /data/data directory. This is
      problematic, as we really want different rules for such files. For
      example, we may want to allow untrusted apps to load executable code
      from priv-app directories, but disallow untrusted apps from loading
      executable code from their own home directories.
      
      This change adds a new file type "privapp_data_file". For compatibility,
      we adjust the policy to support access privapp_data_files almost
      everywhere we were previously granting access to app_data_files
      (adbd and run-as being exceptions). Additional future tightening is
      possible here by removing some of these newly added rules.
      
      This label will start getting used in a followup change to
      system/sepolicy/private/seapp_contexts, similar to:
      
        -user=_app isPrivApp=true domain=priv_app type=app_data_file levelFrom=user
        +user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user
      
      For now, this newly introduced label has no usage, so this change
      is essentially a no-op.
      
      Test: Factory reset and boot - no problems on fresh install.
      Test: Upgrade to new version and test. No compatibility problems on
            filesystem upgrade.
      
      Change-Id: I9618b7d91d1c2bcb5837cdabc949f0cf741a2837
      23c9d91b
  14. Jul 31, 2018
  15. Jun 14, 2018
    • Mark Salyzyn's avatar
      access to /proc/slabinfo · d6eaed85
      Mark Salyzyn authored
      init, dumpstate and shell
      
      Test: check avc for init is now gone
      Bug: 7232205
      Bug: 109821005
      Change-Id: I299a0ba29bcc97a97047f12a5c48f6056f5e6de5
      d6eaed85
  16. May 29, 2018
    • Jeff Vander Stoep's avatar
      Improve tests protecting private app data · ab82125f
      Jeff Vander Stoep authored
      In particular, add assertions limiting which processes may
      directly open files owned by apps. Reduce this to just apps, init,
      and installd. App data is protected by a combination of selinux
      permissions and Unix permissions, so limiting the open permission to
      just apps (which are not allowed to have CAP_DAC_OVERRIDE or
      CAP_DAC_READ_SEARCH) ensures that only installd and init have
      complete access an app's private directory.
      
      In addition to apps/init/installd, other processes currently granted
      open are mediaserver, uncrypt, and vold. Uncrypt's access appears to
      be deprecated (b/80299612). Uncrypt now uses /data/ota_package
      instead. b/80418809 and b/80300620 track removal for vold and
      mediaserver.
      
      Test: build/boot aosp_taimen-userdebug. Verify no "granted" audit
      messages in the logs.
      Bug: 80190017
      Bug: 80300620
      Bug: 80418809
      Fixes: 80299612
      Change-Id: I153bc7b62294b36ccd596254a5976dd887fed046
      ab82125f
  17. May 18, 2018
  18. May 07, 2018
  19. May 04, 2018
    • Jeff Vander Stoep's avatar
      Start the process of locking down proc/net · 7a4af30b
      Jeff Vander Stoep authored
      Files in /proc/net leak information. This change is the first step in
      determining which files apps may use, whitelisting benign access, and
      otherwise removing access while providing safe alternative APIs.
      
      To that end, this change:
      * Introduces the proc_net_type attribute which will assigned to any
      new SELinux types in /proc/net to avoid removing access to privileged
      processes. These processes may be evaluated later, but are lower
      priority than apps.
      * Labels /proc/net/{tcp,tcp6,udp,udp6} as proc_net_vpn due to existing
      use by VPN apps. This may be replaced by an alternative API.
      * Audits all other proc/net access for apps.
      * Audits proc/net access for other processes which are currently
      granted broad read access to /proc/net but should not be including
      storaged, zygote, clatd, logd, preopt2cachename and vold.
      
      Bug: 9496886
      Bug: 68016944
      Test: Boot Taimen-userdebug. On both wifi and cellular: stream youtube
          navigate maps, send text message, make voice call, make video call.
          Verify no avc "granted" messages in the logs.
      Test: A few VPN apps including "VPN Monster", "Turbo VPN", and
      "Freighter". Verify no logspam with the current setup.
      Test: atest CtsNativeNetTestCases
      Test: atest netd_integration_test
      Test: atest QtaguidPermissionTest
      Test: atest FileSystemPermissionTest
      
      Change-Id: I7e49f796a25cf68bc698c6c9206e24af3ae11457
      Merged-In: I7e49f796a25cf68bc698c6c9206e24af3ae11457
      (cherry picked from commit 08731895)
      7a4af30b
  20. May 01, 2018
  21. Apr 23, 2018
  22. Apr 20, 2018
  23. Apr 18, 2018
    • Jeff Vander Stoep's avatar
      Protect dropbox service data with selinux · 4d3ee1a5
      Jeff Vander Stoep authored
      Create a new label for /data/system/dropbox, and neverallow direct
      access to anything other than init and system_server.
      
      While all apps may write to the dropbox service, only apps with
      android.permission.READ_LOGS, a signature|privileged|development
      permission, may read them. Grant access to priv_app, system_app,
      and platform_app, and neverallow access to all untrusted_apps.
      
      Bug: 31681871
      Test: atest CtsStatsdHostTestCases
      Test: atest DropBoxTest
      Test: atest ErrorsTests
      Change-Id: Ice302b74b13c4d66e07b069c1cdac55954d9f5df
      4d3ee1a5
  24. Apr 09, 2018
    • Alan Stokes's avatar
      Installd doesn't need to create cgroup files. · 06bac37f
      Alan Stokes authored
      cgroupfs doesn't allow files to be created, so this can't be needed.
      
      Also remove redundant neverallow and dontaudit rules. These are now
      more broadly handled by domain.te.
      
      Bug: 74182216
      
      Test: Denials remain silenced.
      
      Change-Id: If7eb0e59f567695d987272a2fd36dbc251516e9f
      
      (cherry picked from commit 8e8c1093)
      06bac37f
  25. Apr 06, 2018
    • Alan Stokes's avatar
      Installd doesn't need to create cgroup files. · 8e8c1093
      Alan Stokes authored
      cgroupfs doesn't allow files to be created, so this can't be needed.
      
      Also remove redundant neverallow and dontaudit rules. These are now
      more broadly handled by domain.te.
      
      Bug: 74182216
      
      Test: Denials remain silenced.
      
      Change-Id: If7eb0e59f567695d987272a2fd36dbc251516e9f
      8e8c1093
  26. Mar 16, 2018
    • padarshr's avatar
      Init: Enable init to relabel symlinks for recovery_block_device. · ecab4010
      padarshr authored
      Allow init the ability to relabel recovery block devices. In the case
      where we have recovery as a chain partition, due to its presence in
      early mount node, init, in first stage itself would require relabel
      permissions for the restorecon operation on recovery block device.
      
      Bug: 73642793
      Test: On bootup, recovery partition gets the appropriate se-label.
            Perform OTA on non-A/B device with recovery as chain partition,
            now the recovery partition gets upgraded successfully, now that
            it has the correct se-label.
      
      Change-Id: I370c510320e78ab78c9c55573073415b4983d0f6
      Merged-In: I370c510320e78ab78c9c55573073415b4983d0f6
      (cherry picked from commit bc14ee3c)
      ecab4010
  27. Mar 15, 2018
    • padarshr's avatar
      Init: Enable init to relabel symlinks for recovery_block_device. · bc14ee3c
      padarshr authored
      Allow init the ability to relabel recovery block devices. In the case
      where we have recovery as a chain partition, due to its presence in
      early mount node, init, in first stage itself would require relabel
      permissions for the restorecon operation on recovery block device.
      
      Bug: 73642793
      Test: On bootup, recovery partition gets the appropriate se-label.
            Perform OTA on non-A/B device with recovery as chain partition,
            now the recovery partition gets upgraded successfully, now that
            it has the correct se-label.
      
      Change-Id: I370c510320e78ab78c9c55573073415b4983d0f6
      bc14ee3c
  28. Feb 27, 2018
    • Alan Stokes's avatar
      Allow init to create & write to vibrator/trigger. · 5a570606
      Alan Stokes authored
      The write is here: https://android.googlesource.com/platform/system/core/+/master/rootdir/init.rc#257.
      
      Denials (on a device with the sysfs_vibrator label properly applied):
      denied { write } for name="vibrator" dev="sysfs" ino=49613 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_vibrator:s0 tclass=dir
      denied { write } for name="trigger" dev="sysfs" ino=49620 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_vibrator:s0 tclass=file
      denied { open } for path="/sys/devices/<redacted>/vibrator/trigger" dev="sysfs" ino=49620 scontext=u:r:init:s0 tcontext=u:object_r:sysfs_vibrator:s0 tclass=file
      
      Bug: b/72643420
      Test: Device boots, denials gone
      
      Change-Id: Ib50d9a8533303daccb1330685e3204bea3fbd8a8
      5a570606
  29. Feb 22, 2018
    • Sandeep Patil's avatar
      Add label for kernel test files and executables · 34e35e9e
      Sandeep Patil authored
      
      This required for kernel to do loopback mounts on filesystem
      images created by the kernel system call tests in LTP.
      
      Add a corresponding neverallow to stop all domains from accessing
      the location at /data/local/tmp/ltp.
      
      Bug: 73220071
      Test: Boot sailfish successfully
      Test: run vts-kernel -m VtsKernelLtp -t syscalls.fchown04
      
      Change-Id: I73f5f14017e22971fc246a05751ba67be4653bca
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      34e35e9e
  30. Feb 05, 2018
    • Carmen Jackson's avatar
      Use a whitelisting strategy for tracefs. · 2c8ca45d
      Carmen Jackson authored
      This changes tracefs files to be default-enabled in debug mode, but
      default-disabled with specific files enabled in user mode.
      
      Bug: 64762598
      Test: Successfully took traces in user mode.
      
      Change-Id: I572ea22253e0c1e42065fbd1d2fd7845de06fceb
      2c8ca45d
  31. Jan 24, 2018
    • Joel Galenson's avatar
      Fix init error trying to access file. · cf391269
      Joel Galenson authored
      Init tries to write /proc/sys/vm/min_free_order_shift but fails due to
      a SELinux denial.  This gives the file a new label and gives init the
      ability to write it.
      
      Test: Build and booted Sailfish (a couple of days ago).
      Change-Id: Ic93862b85c468afccff2019d84b927af9ed2a84d
      cf391269
  32. Jan 08, 2018
  33. Jan 03, 2018
  34. Jan 02, 2018
    • Chenbo Feng's avatar
      sepolicy: Allow mount cgroupv2 and bpf fs · 254ad0da
      Chenbo Feng authored
      Some necessary sepolicy rule changes for init process to create directory,
      mount cgroupv2 module and mount bpf filesystem. Also allow netd to create
      and pin bpf object as files and read it back from file under the
      directory where bpf filesystem is mounted.
      
      Test: bpf maps show up under /sys/fs/bpf/
      Change-Id: I579d04f60d7e20bd800d970cd28cd39fda9d20a0
      254ad0da
  35. Dec 20, 2017
    • Tri Vo's avatar
      init: tighten sysfs_type permissions · 55039509
      Tri Vo authored
      Removes open, read, setattr permissions to sysfs_type.
      Adds explicit permissions to:
      sysfs_dt_firmware_android
      sysfs_vibrator
      sysfs_wake_lock
      
      Bug: 65643247
      Test: walleye boots without denials to sysfs_type.
      Change-Id: I2e344831655c2c8e8e48b07ecce6a2704f2a206a
      55039509
  36. Dec 13, 2017
    • Tom Cherry's avatar
      Add /dev/__properties__/property_info · 8b5433a9
      Tom Cherry authored
      Allow init to create a serialized property_info file and allow all
      processes to read it.
      
      Bug: 36001741
      Test: boot bullhead, walleye using property_info
      
      Change-Id: Ie51d4c0f0221b128dd087029c811fda15b4d7093
      8b5433a9
  37. Dec 06, 2017
    • Tri Vo's avatar
      init: remove open, read, write access to 'sysfs' type. · 0e3235f4
      Tri Vo authored
      Add write access to:
      sysfs_android_usb
      sysfs_leds
      sysfs_power
      sysfs_zram
      
      Add setattr access to:
      sysfs_android_usb
      sysfs_devices_system_cpu
      sysfs_lowmemorykiller
      sysfs_power
      sysfs_leds
      sysfs_ipv4
      
      Bug: 70040773
      Bug: 65643247
      Change-Id: I68e2e796f5599c9d281897759c8d8eef9363559a
      Test: walleye boots with no denials from init to sysfs.
      0e3235f4
Loading