Skip to content
Snippets Groups Projects
  1. Jan 30, 2017
  2. Jan 11, 2017
  3. Dec 27, 2016
    • Alex Klyubin's avatar
      Fix warning in recovery.te · 9d8e3ab6
      Alex Klyubin authored
      SELinux policy compiler complained about a quote inside the
      recovery_only section of recovery.te. This section's contents are
      inside quotes and thus can't contain quotes.
      
      Test: mmm system/sepolicy produces no warnings
      Bug: 33700679
      Change-Id: I5bf943166f4f514d04472f7e59b025a9723eb1b8
      9d8e3ab6
  4. Dec 22, 2016
    • Alex Klyubin's avatar
      Restrict access to ro.serialno and ro.boot.serialno · 20151072
      Alex Klyubin authored
      This restricts access to ro.serialno and ro.boot.serialno, the two
      system properties which contain the device's serial number, to a
      select few SELinux domains which need the access. In particular, this
      removes access to these properties from Android apps. Apps can access
      the serial number via the public android.os.Build API. System
      properties are not public API for apps.
      
      The reason for the restriction is that serial number is a globally
      unique identifier which cannot be reset by the user. Thus, it can be
      used as a super-cookie by apps. Apps need to wean themselves off of
      identifiers not resettable by the user.
      
      Test: Set up fresh GMS device, install some apps via Play, update some apps, use Chrome
      Test: Access the device via ADB (ADBD exposes serial number)
      Test: Enable MTP over USB, use mtp-detect to confirm that serial number is reported in MTP DeviceInfo
      Bug: 31402365
      Bug: 33700679
      Change-Id: I4713133b8d78dbc63d8272503e80cd2ffd63a2a7
      20151072
  5. Nov 22, 2016
    • Tao Bao's avatar
      recovery.te: Allow writing to sysfs_devices_system_cpu. · ee7960c0
      Tao Bao authored
      recovery (update_binary) may need to set up cpufreq during an update.
      
      avc:  denied  { write } for  pid=335 comm="update_binary" name="scaling_max_freq" dev="sysfs" ino=7410 scontext=u:r:recovery:s0 tcontext=u:object_r:sysfs_devices_system_cpu:s0 tclass=file permissive=0
      
      Bug: 32463933
      Test: Build a recovery image and apply an OTA package that writes to
            /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq.
      
      Change-Id: Ia90af9dd15e162dd94bcd4722b66aa296e3058c5
      ee7960c0
  6. Oct 14, 2016
  7. 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
  8. Sep 27, 2016
    • Jeff Vander Stoep's avatar
      Audit access to libart · 88cef4df
      Jeff Vander Stoep authored
      Grant access to all processes and audit access. The end goal is to
      whitelist all access to the interpreter. Several processes including
      dex2oat, apps, and zygote were observed using libart, so omit them
      from auditing and explicitly grant them access.
      
      Test: Angler builds and boots
      
      Bug: 29795519
      Change-Id: I9b93c7dbef5c49b95a18fd26307955d05a1c8e88
      88cef4df
  9. Aug 10, 2016
    • Alex Deymo's avatar
      Allow executing update_engine_sideload from recovery. · 27f19427
      Alex Deymo authored
      The recovery flow for A/B devices allows to sideload an OTA downloaded
      to a desktop and apply from recovery. This patch allows the "recovery"
      context to perform all the operations required to apply an update as
      update_engine would do in the background. These rules are now extracted
      into a new attributte called update_engine_common shared between
      recovery and update_engine.
      
      Bug: 27178350
      
      (cherry picked from commit d63084d3)
      
      Change-Id: I1f3e1e83a21e37e09b69cd9c497f87b42b9cbeb1
      27f19427
  10. Aug 09, 2016
    • Alex Deymo's avatar
      Allow executing update_engine_sideload from recovery. · d63084d3
      Alex Deymo authored
      The recovery flow for A/B devices allows to sideload an OTA downloaded
      to a desktop and apply from recovery. This patch allows the "recovery"
      context to perform all the operations required to apply an update as
      update_engine would do in the background. These rules are now extracted
      into a new attributte called update_engine_common shared between
      recovery and update_engine.
      
      Bug: 27178350
      Change-Id: I97b301cb2c039fb002e8ebfb23c3599463ced03a
      d63084d3
  11. Feb 23, 2016
  12. Feb 19, 2016
  13. Jan 26, 2016
  14. Jan 04, 2016
    • Felipe Leme's avatar
      Creates a new permission for /cache/recovery · 549ccf77
      Felipe Leme authored
      This permission was created mostly for dumpstate (so it can include
      recovery files on bugreports when an OTA fails), but it was applied to
      uncrypt and recovery as well (since it had a wider access before).
      
      Grant access to cache_recovery_file where we previously granted access
      to cache_file. Add auditallow rules to determine if this is really
      needed.
      
      BUG: 25351711
      Change-Id: I07745181dbb4f0bde75694ea31b3ab79a4682f18
      549ccf77
  15. Nov 03, 2015
    • Jeff Vander Stoep's avatar
      Create attribute for moving perms out of domain · d22987b4
      Jeff Vander Stoep authored
      Motivation: Domain is overly permissive. Start removing permissions
      from domain and assign them to the domain_deprecated attribute.
      Domain_deprecated and domain can initially be assigned to all
      domains. The goal is to not assign domain_deprecated to new domains
      and to start removing domain_deprecated where it is not required or
      reassigning the appropriate permissions to the inheriting domain
      when necessary.
      
      Bug: 25433265
      Change-Id: I8b11cb137df7bdd382629c98d916a73fe276413c
      d22987b4
  16. Aug 25, 2015
    • Stephen Smalley's avatar
      Only allow toolbox exec where /system exec was already allowed. · a3c97a76
      Stephen Smalley authored
      
      When the toolbox domain was introduced, we allowed all domains to exec it
      to avoid breakage.  However, only domains that were previously allowed the
      ability to exec /system files would have been able to do this prior to the
      introduction of the toolbox domain.  Remove the rule from domain.te and add
      rules to all domains that are already allowed execute_no_trans to system_file.
      Requires coordination with device-specific policy changes with the same Change-Id.
      
      Change-Id: Ie46209f0412f9914857dc3d7c6b0917b7031aae5
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      a3c97a76
  17. Jun 10, 2015
  18. May 15, 2015
    • Jeff Sharkey's avatar
      drop_caches label, vold scratch space on expanded. · c960596c
      Jeff Sharkey authored
      Define an explicit label for /proc/sys/vm/drop_caches and grant to
      the various people who need it, including vold which uses it when
      performing storage benchmarks.
      
      Also let vold create new directories under it's private storage area
      where the benchmarks will be carried out.  Mirror the definition of
      the private storage area on expanded media.
      
      avc: denied { write } for name="drop_caches" dev="proc" ino=20524 scontext=u:r:vold:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=0
      
      Bug: 21172095
      Change-Id: I300b1cdbd235ff60e64064d3ba6e5ea783baf23f
      c960596c
  19. May 07, 2015
    • William Roberts's avatar
      Replace unix_socket_connect() and explicit property sets with macro · 2f5a6a96
      William Roberts authored
      
      A common source of mistakes when authoring sepolicy is properly
      setting up property sets. This is a 3 part step of:
      1. Allowing the unix domain connection to the init/property service
      2. Allowing write on the property_socket file
      3. Allowing the set on class property_service
      
      The macro unix_socket_connect() handled 1 and 2, but could be
      confusing for first time policy authors. 3 had to be explicitly
      added.
      
      To correct this, we introduce a new macros:
      set_prop(sourcedomain, targetprop)
      
      This macro handles steps 1, 2 and 3.
      
      No difference in sediff is expected.
      
      (cherrypicked from commit 625a3526)
      
      Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@linux.intel.com>
      2f5a6a96
    • William Roberts's avatar
      Replace unix_socket_connect() and explicit property sets with macro · 625a3526
      William Roberts authored
      
      A common source of mistakes when authoring sepolicy is properly
      setting up property sets. This is a 3 part step of:
      1. Allowing the unix domain connection to the init/property service
      2. Allowing write on the property_socket file
      3. Allowing the set on class property_service
      
      The macro unix_socket_connect() handled 1 and 2, but could be
      confusing for first time policy authors. 3 had to be explicitly
      added.
      
      To correct this, we introduce a new macros:
      set_prop(sourcedomain, targetprop)
      
      This macro handles steps 1, 2 and 3.
      
      No difference in sediff is expected.
      
      Change-Id: I630ba0178439c935d08062892990d43a3cc1239e
      Signed-off-by: default avatarWilliam Roberts <william.c.roberts@linux.intel.com>
      625a3526
  20. Mar 05, 2015
  21. Dec 09, 2014
  22. Nov 05, 2014
    • Nick Kralevich's avatar
      recovery.te: add /data neverallow rules · a17a266e
      Nick Kralevich authored
      Recovery should never be accessing files from /data.
      In particular, /data may be encrypted, and the files within
      /data will be inaccessible to recovery, because recovery doesn't
      know the decryption key.
      
      Enforce write/execute restrictions on recovery. We can't tighten
      it up further because domain.te contains some /data read-only
      access rules, which shouldn't apply to recovery but do.
      
      Create neverallow_macros, used for storing permission macros
      useful for neverallow rules. Standardize recovery.te and
      property_data_file on the new macros.
      
      Change-Id: I02346ab924fe2fdb2edc7659cb68c4f8dffa1e88
      a17a266e
  23. Oct 23, 2014
    • Nick Kralevich's avatar
      recovery: allow changing unlabeled symbolic links · 5fad3d98
      Nick Kralevich authored
      Currently, recovery is allowed write access to the following three
      file labels:
      
      * system_file (directories, files, and symbolic links)
      * exec_type (directories, files, and symbolic links)
      * unlabeled (directory and files)
      
      system_file is the default label on all files in /system. exec_type
      is the attribute used to mark executables on /system.
      
      The third file type, "unlabeled", refers to filesystem objects where
      the label hasn't been set, or a label is set but isn't defined by the
      currently loaded policy.
      
      The current policy only allows unlabeled files or directories to
      be modified. Symbolic links were accidentally excluded. This causes
      problems when trying to fix up labels/permissions on unlabeled
      symbolic links.
      
      Allow unlabeled symbolic link modifications.
      
      (cherrypicked from commit 683ac49d)
      
      Bug: 18079773
      Change-Id: I8e5c33602cdc38ec9a95b4e83f9ccbb06fe9da7c
      5fad3d98
    • Nick Kralevich's avatar
      recovery: allow changing unlabeled symbolic links · 683ac49d
      Nick Kralevich authored
      Currently, recovery is allowed write access to the following three
      file labels:
      
      * system_file (directories, files, and symbolic links)
      * exec_type (directories, files, and symbolic links)
      * unlabeled (directory and files)
      
      system_file is the default label on all files in /system. exec_type
      is the attribute used to mark executables on /system.
      
      The third file type, "unlabeled", refers to filesystem objects where
      the label hasn't been set, or a label is set but isn't defined by the
      currently loaded policy.
      
      The current policy only allows unlabeled files or directories to
      be modified. Symbolic links were accidentally excluded. This causes
      problems when trying to fix up labels/permissions on unlabeled
      symbolic links.
      
      Allow unlabeled symbolic link modifications.
      
      Bug: 18079773
      Change-Id: I8e5c33602cdc38ec9a95b4e83f9ccbb06fe9da7c
      683ac49d
  24. Jul 15, 2014
  25. Jul 10, 2014
  26. Jul 08, 2014
    • Stephen Smalley's avatar
      Rename sdcard_internal/external types. · 374b2a19
      Stephen Smalley authored
      
      Rename sdcard_internal/external types to fuse and vfat
      respectively to make it clear that they are assigned to any
      fuse or vfat filesystem by default (absent a context= mount option)
      and do not necessarily represent the SDcard.
      
      The sdcard_type attribute is still assigned to both types and
      can still be used in allow rules to permit access to either the
      internal or external SDcard.
      
      Define type aliases for the old names to preserve compatibility
      on policy reload and for device-specific policies that may not yet
      be updated.
      
      Change-Id: I8d91a8c4c1342b94e4f1bb62ca7ffd2ca4b06ba1
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      374b2a19
    • Nick Kralevich's avatar
      recovery: allow read access to fuse filesystem · e9d97b74
      Nick Kralevich authored
      adb sideload depends on the ability to access the fuse
      directory. Flipping recovery into enforcing started triggering
      the following denial:
      
        type=1400 audit(17964905.699:7): avc:  denied  { search } for  pid=132 comm="recovery" name="/" dev="fuse" ino=1 scontext=u:r:recovery:s0 tcontext=u:object_r:sdcard_internal:s0 tclass=dir
      
      Change-Id: I27ee0295fa2e2d0449bfab4f95bfbc076e92cf59
      e9d97b74
  27. Jul 07, 2014
    • Nick Kralevich's avatar
      recovery: start enforcing SELinux rules · c2ba5ed9
      Nick Kralevich authored
      Start enforcing SELinux rules for recovery. I've been monitoring
      denials, and I haven't seen anything which would indicate a problem.
      We can always roll this back if something goes wrong.
      
      Change-Id: I7d3a147f8b9000bf8181d2aa32520f15f291a6f3
      c2ba5ed9
    • Nick Kralevich's avatar
      recovery: allow relabelto unlabeled and other unlabeled rules · 558710cd
      Nick Kralevich authored
      The recovery script may ask to label a file with a label not
      known to the currently loaded policy. Allow it.
      
      Addresses the following denials:
      
        avc:  denied  { relabelto } for  pid=143 comm="update_binary" name="vdc" dev="mmcblk0p25" ino=212 scontext=u:r:recovery:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
        avc:  denied  { setattr } for  pid=143 comm="update_binary" name="vdc" dev="mmcblk0p25" ino=212 scontext=u:r:recovery:s0 tcontext=u:object_r:unlabeled:s0 tclass=file
      
      Change-Id: Iafcc7b0b3aaea5a272adb1264233978365648f94
      558710cd
  28. Jul 02, 2014
  29. Jun 23, 2014
    • Stephen Smalley's avatar
      Align SELinux property policy with init property_perms. · fee49159
      Stephen Smalley authored
      
      Introduce a net_radio_prop type for net. properties that can be
      set by radio or system.
      Introduce a system_radio_prop type for sys. properties that can be
      set by radio or system.
      Introduce a dhcp_prop type for properties that can be set by dhcp or system.
      Drop the rild_prop vs radio_prop distinction; this was an early
      experiment to see if we could separate properties settable by rild
      versus other radio UID processes but it did not pan out.
      
      Remove the ability to set properties from unconfineddomain.
      Allow init to set any property.  Allow recovery to set ctl_default_prop
      to restart adbd.
      
      Change-Id: I5ccafcb31ec4004dfefcec8718907f6b6f3e0dfd
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      fee49159
  30. Jun 19, 2014
    • Stephen Smalley's avatar
      Remove execute_no_trans from unconfineddomain. · f3c3a1aa
      Stephen Smalley authored
      
      execute_no_trans controls whether a domain can execve a program
      without switching to another domain.  Exclude this permission from
      unconfineddomain, add it back to init, init_shell, and recovery for
      files in / and /system, and to kernel for files in / (to permit
      execution of init prior to setcon).  Prohibit it otherwise for the
      kernel domain via neverallow.  This ensures that if a kernel task
      attempts to execute a kernel usermodehelper for which no domain transition
      is defined, the exec will fail.
      
      Change-Id: Ie7b2349923672dd4f5faf7c068a6e5994fd0e4e3
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      f3c3a1aa
    • Stephen Smalley's avatar
      Address recovery denials. · 1095d694
      Stephen Smalley authored
      
      [  265.263738] type=1400 audit(17091747.819:4): avc:  denied  { write } for  pid=132 comm="recovery" name="enable" dev="sysfs" ino=14405 scontext=u:r:recovery:s0 tcontext=u:object_r:sysfs:s0 tclass=file
      [  265.293154] type=1400 audit(17091747.849:5): avc:  denied  { execute } for  pid=177 comm="recovery" name="recovery" dev="rootfs" ino=6376 scontext=u:r:recovery:s0 tcontext=u:object_r:rootfs:s0 tclass=file
      [  265.299479] type=1400 audit(17091747.859:6): avc:  denied  { setgid } for  pid=177 comm="recovery" capability=6  scontext=u:r:recovery:s0 tcontext=u:r:recovery:s0 tclass=capability
      [  265.299511] type=1400 audit(17091747.859:7): avc:  denied  { read write } for  pid=178 comm="recovery" name="android_adb" dev="tmpfs" ino=6739 scontext=u:r:recovery:s0 tcontext=u:object_r:adb_device:s0 tclass=chr_file
      [  265.299531] type=1400 audit(17091747.859:8): avc:  denied  { open } for  pid=178 comm="recovery" name="android_adb" dev="tmpfs" ino=6739 scontext=u:r:recovery:s0 tcontext=u:object_r:adb_device:s0 tclass=chr_file
      [  265.299863] type=1400 audit(17091747.859:9): avc:  denied  { setuid } for  pid=177 comm="recovery" capability=7  scontext=u:r:recovery:s0 tcontext=u:r:recovery:s0 tclass=capability
      
      Change-Id: I024d5a797b86b9766f10bbb2a6a6462cafc9c26a
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      1095d694
  31. Jun 16, 2014
    • Stephen Smalley's avatar
      Restrict use of context= mount options. · 75e2ef92
      Stephen Smalley authored
      
      Prior to this change, the init and recovery domains were
      allowed unrestricted use of context= mount options to force
      all files within a given filesystem to be treated as having a
      security context specified at mount time.  The context= mount
      option can be used in device-specific fstab.<board> files
      to assign a context to filesystems that do not support labeling
      such as vfat where the default label of sdcard_external is not
      appropriate (e.g. /firmware on hammerhead).
      
      Restrict the use of context= mount options to types marked with the
      contextmount_type attribute, and then remove write access from
      such types from unconfineddomain and prohibit write access to such
      types via neverallow.  This ensures that the no write to /system
      restriction cannot be bypassed via context= mount.
      
      Change-Id: I4e773fadc9e11328d13a0acec164124ad6e840c1
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      75e2ef92
Loading