Skip to content
Snippets Groups Projects
  1. Apr 06, 2017
    • Dan Cashman's avatar
      Move mapping_sepolicy.cil to /system partition. · 0e9c47c0
      Dan Cashman authored
      This is a necessary first step to finalizing the SELinux policy build
      process.  The mapping_sepolicy.cil file is required to provide backward
      compatibility with the indicated vendor-targeted version.
      
      This still needs to be extended to provide N mapping files and corresponding
      SHA256 outputs, one for each of the N previous platform versions with which
      we're backward-compatible.
      
      Bug: 36783775
      Test: boot device with matching sha256 and non-matching and verify that
      device boots and uses either precompiled or compiled policy as needed. Also
      verify that mapping_sepolicy.cil has moved.
      
      Change-Id: I5692fb87c7ec0f3ae9ca611f76847ccff9182375
      0e9c47c0
  2. Apr 05, 2017
    • Sandeep Patil's avatar
      sepolicy: relabel /vendor · 277a20eb
      Sandeep Patil authored
      
      The CL splits /vendor labeling from /system. Which was allowing all
      processes read, execute access to /vendor.
      
      Following directories will remain world readable
       /vendor/etc
       /vendor/lib(64)/hw/
      
      Following are currently world readable but their scope
      will be minimized to platform processes that require access
       /vendor/app
       /vendor/framework/
       /vendor/overlay
      
      Files labelled with 'same_process_hal_file' are allowed to be
      read + executed from by the world. This is for Same process HALs and
      their dependencies.
      
      Bug: 36527360
      Bug: 36832490
      Bug: 36681210
      Bug: 36680116
      Bug: 36690845
      Bug: 36697328
      Bug: 36696623
      Bug: 36806861
      Bug: 36656392
      Bug: 36696623
      Bug: 36792803
      
      All of the tests were done on sailfish, angler, bullhead, dragon
      Test: Boot and connect to wifi
      Test: Run chrome and load websites, play video in youtube, load maps w/
            current location, take pictures and record video in camera,
            playback recorded video.
      Test: Connect to BT headset and ensure BT audio playback works.
      Test: OTA sideload using recovery
      Test: CTS SELinuxHostTest pass
      
      Change-Id: I278435b72f7551a28f3c229f720ca608b77a7029
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      277a20eb
  3. Apr 04, 2017
  4. Apr 03, 2017
    • Martijn Coenen's avatar
      Add target for vndservice_contexts. · 6676c234
      Martijn Coenen authored
      So we can limit vndservicemanager access to
      just vndservice_contexts.
      
      Bug: 36052864
      Test: servicemanager,vndservicemanager work
      Change-Id: I7b132d4f616ba1edd0daf7be750d4b7174c4e188
      6676c234
    • Alex Klyubin's avatar
      Move TEE rules to vendor image · 304d6536
      Alex Klyubin authored
      "tee" domain is a vendor domain. Hence its rules should live on the
      vendor image.
      
      What's left as public API is that:
      1. tee domain exists and that it is permitted to sys_rawio capability,
      2. tee_device type exists and apps are not permitted to access
         character devices labeled tee_device.
      
      If you were relying on system/sepolicy automatically labeling
      /dev/tf_driver as tee_device or labeling /system/bin/tf_daemon as
      tee_exec, then you need to add these rules to your device-specific
      file_contexts.
      
      Test: mmm system/sepolicy
      Test: bullhead, angler, and sailfish boot up without new denials
      Bug: 36714625
      Bug: 36714625
      Bug: 36720355
      Change-Id: Ie21619ff3c44ef58675c369061b4afdd7e8501c6
      304d6536
  5. Mar 31, 2017
    • Daniel Nicoara's avatar
      VR: Add sepolicy for VR HWC service · 6907e39a
      Daniel Nicoara authored
      VR HWC is being split out of VR Window Manager. It creates a HW binder
      interface used by SurfaceFlinger which implements the HWComposer HAL and
      a regular binder interface which will be used by a system app to receive
      the SurfaceFlinger output.
      
      Bug: b/36051907
      Test: Ran in permissive mode and ensured no permission errors show in
      logcat.
      
      Change-Id: If1360bc8fa339a80100124c4e89e69c64b29d2ae
      6907e39a
  6. Mar 29, 2017
    • Sandeep Patil's avatar
      mac_permissions: explicitly label all mac_permissions files · bb24f3ab
      Sandeep Patil authored
      
      *mac_permissions.xml files need to be explicitly labeled as they are now split
      cross system and vendor and won't have the generic world readable
      'system_file' or 'rootfs' label.
      
      Bug: 36003167
      Test: no new 'mac_perms_file' denials at boot complete on sailfish
      Test: successfully booted into recovery without denials and sideloaded
            OTA update.
      Test: Launch 'chrome' and succesfully load a website.
      Test: Launch Camera and take a picture.
      Test: Launch Camera and record a video, succesfully playback recorded
            video
      
      Change-Id: I1c882872bb78d1242ba273756ef0dc27487f58fc
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      bb24f3ab
    • Sandeep Patil's avatar
      sepolicy: explicitly label all sepolicy files · 136caa1b
      Sandeep Patil authored
      
      sepolicy files need to be explicitly labeled as they are now split
      cross system and vendor and won't have the generic world readable
      'system_file' or 'rootfs' label.
      
      Bug: 36527360
      Test: no new 'sepolicy_file' denials at boot complete on sailfish
      Test: successfully booted into recovery without denials and sideloaded
            OTA update.
      Test: Launch 'chrome' and succesfully load a website.
      Test: Launch Camera and take a picture.
      Test: Launch Camera and record a video, succesfully playback recorded
            video
      
      Change-Id: I6fe8ba31588c2d75521c6e2b0bf7e6d6eaf80a19
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      136caa1b
    • Sandeep Patil's avatar
      seapp_context: explicitly label all seapp context files · 1e149967
      Sandeep Patil authored
      
      seapp_context files need to be explicitly labeled as they are now split
      cross system and vendor and won't have the generic world readable
      'system_file' label.
      
      Bug: 36002414
      Test: no new 'seapp_context' denials at boot complete on sailfish
      Test: successfully booted into recovery without denials and sideloaded
            OTA update.
      Test: ./cts-tradefed run singleCommand cts --skip-device-info \
            --skip-preconditions --skip-connectivity-check --abi \
            arm64-v8a --module CtsSecurityHostTestCases -t \
            android.security.cts.SELinuxHostTest#testAospSeappContexts
      Test: Launch 'chrome' and succesfully load a website.
      Test: Launch Camera and take a picture.
      Test: Launch Camera and record a video, succesfully playback recorded
            video
      
      Change-Id: I19b3e50c6a7c292713d3e56ef0448acf6e4270f7
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      1e149967
    • Sandeep Patil's avatar
      file_context: explicitly label all file context files · c9cf7361
      Sandeep Patil authored
      
      file_context files need to be explicitly labeled as they are now split
      across system and vendor and won't have the generic world readable
      'system_file' label.
      
      Bug: 36002414
      Test: no new 'file_context' denials at boot complete on sailfish
      Test: successfully booted into recovery without denials and sideloaded
      OTA update.
      Test: ./cts-tradefed run singleCommand cts --skip-device-info \
             --skip-preconditions --skip-connectivity-check --abi \
             arm64-v8a --module CtsSecurityHostTestCases -t \
             android.security.cts.SELinuxHostTest#testAospFileContexts
      
      Change-Id: I603157e9fa7d1de3679d41e343de397631666273
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      c9cf7361
    • Sandeep Patil's avatar
      service_contexts: label service_contexts explicitly · 939d16b5
      Sandeep Patil authored
      
      The label applies to all service_contexts regardless of their location.
      This also lets us track the service_contexts usage and limit access to
      the files for the corresponding object manager alone.
      
      Bug: 36002427
      Test: Boot sailfish and observe no denials for 'serice_contexts'
      Test: cts-tradefed run singleCommand cts --skip-device-info \
                --skip-preconditions --skip-connectivity-check \
                --abi arm64-v8a --module CtsSecurityHostTestCases \
                -t android.security.cts.SELinuxHostTest#testAospServiceContexts
      
      Change-Id: I97fc8b24bc99ca5c00d010fb522cd39a35572858
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      939d16b5
    • Sandeep Patil's avatar
      prop_context: correctly label all property_context files · 54a42001
      Sandeep Patil authored
      
      split property context file in vendor and sytem were left untouched by
      the recent changes. This was working accidentally because they were
      still accessible to all domains as 'system_file'.
      
      Bug: 36002573
      Test: Boot sailfish to observe no new denials.
      Test: 'adb sideload' OTA on sailfish successfully
      
      Change-Id: I5bec058b59db83d2a431e9f7e91c5a09af7d2942
      Signed-off-by: default avatarSandeep Patil <sspatil@google.com>
      54a42001
  7. Mar 26, 2017
    • Jeff Sharkey's avatar
      Define policy for "loop-control" device. · a8e0f76c
      Jeff Sharkey authored
      Per loop(4), this device is the preferred way of allocating new
      loop devices since Linux 3.1.
      
      avc: denied { read write } for name="loop-control" dev="tmpfs" ino=15221 scontext=u:r:vold:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=0
      
      Bug: 34903607
      Change-Id: I1f5f62cf0a1c24c6f6453100004812af4b8e1503
      a8e0f76c
  8. Mar 23, 2017
    • Martijn Coenen's avatar
      Initial sepolicy for vndservicemanager. · e7d8f4c3
      Martijn Coenen authored
      vndservicemanager is the context manager for binder services
      that are solely registered and accessed from vendor processes.
      
      Bug: 36052864
      Test: vendorservicemanager runs
      Merged-In: Ifbf536932678d0ff13d019635fe6347e185ef387
      Change-Id: I430f1762eb83825f6cd4be939a69d46a8ddc80ff
      e7d8f4c3
  9. Mar 22, 2017
    • Martijn Coenen's avatar
      Initial sepolicy for vndservicemanager. · cba70be7
      Martijn Coenen authored
      vndservicemanager is the context manager for binder services
      that are solely registered and accessed from vendor processes.
      
      Bug: 36052864
      Test: vendorservicemanager runs
      Change-Id: Ifbf536932678d0ff13d019635fe6347e185ef387
      cba70be7
  10. Mar 21, 2017
  11. Mar 20, 2017
    • Alex Klyubin's avatar
      Switch Allocator HAL policy to _client/_server · 08d6f566
      Alex Klyubin authored
      This switches Allocator HAL policy to the design which enables us to
      identify all SELinux domains which host HALs and all domains which are
      clients of HALs.
      
      Allocator HAL is special in the sense that it's assumed to be always
      binderized. As a result, rules in Camera HAL target hal_allocator_server
      rather than hal_allocator (which would be the server and any client, if
      the Allocator HAL runs in passthrough mode).
      
      Test: Device boots up, no new denials
      Test: YouTube video plays back
      Test: Take photo using Google Camera app, recover a video, record a slow
            motion video
      Bug: 34170079
      Change-Id: Ifbbca554ec221712361ee6cda94c82f254d84936
      08d6f566
  12. Mar 16, 2017
    • Jaesoo Lee's avatar
      enabled /sbin/modprobe for recovery mode · d363b0f9
      Jaesoo Lee authored
      This change defines new policy for modprobe (/sbin/modprobe) that should
      be used in both recovery and android mode.
      
      Denials:
      [   16.986440] c0    437 audit: type=1400 audit(6138546.943:5): avc:
      denied  { read } for  pid=437 comm="modprobe" name="modules" dev="proc"
      ino=4026532405 scontext=u:object_r:modprobe:s0
      tcontext=u:object_r:proc:s0 tclass=file permissive=1
      [   16.986521] c0    437 audit: type=1400 audit(6138546.943:6): avc:
      denied  { open } for  pid=437 comm="modprobe" path="/proc/modules"
      dev="proc" ino=4026532405 scontext=u:object_r:modprobe:s0
      tcontext=u:object_r:proc:s0 tclass=file permissive=1
      [   16.986544] c0    437 audit: type=1400 audit(6138546.943:7): avc:
      denied  { getattr } for  pid=437 comm="modprobe" path="/proc/modules"
      dev="proc" ino=4026532405 scontext=u:object_r:modprobe:s0
      tcontext=u:object_r:proc:s0 tclass=file permissive=1
      
      Bug: 35633646
      Test: Build and tested it works in sailfish recovery. The modprobe is
      invoked in init.rc (at the end of 'on init') with following command line
      
          exec u:r:modprobe:s0 -- /sbin/modprobe -a nilfs2 ftl
      
      Change-Id: Ie70be6f918bea6059f806e2eb38cd48229facafa
      d363b0f9
  13. Mar 15, 2017
    • Fyodor Kupolov's avatar
      Split preloads into media_file and data_file · b238fe66
      Fyodor Kupolov authored
      Untrusted apps should only access /data/preloads/media and demo directory.
      
      Bug: 36197686
      Test: Verified retail mode.
            Checked non-privileged APK cannot access /data/preloads
      Change-Id: I8e9c21ff6aba799aa31bf06893cdf60dafc04446
      b238fe66
  14. Mar 09, 2017
    • Po-Chien Hsueh's avatar
      sepolicy: Move hostapd to vendor · 9a293013
      Po-Chien Hsueh authored
      Move hostapd to vendor/bin/ because it's only used by WIFI HAL.
      This commit is for sepolicy corresponding changes.
      
      Bug: 34236942
      Bug: 34237659
      Test: Hotspot works fine. Integration test.
      
      Change-Id: I2ee165970a20f4015d5d62fc590d448e9acb92c1
      9a293013
  15. Mar 07, 2017
    • Calin Juravle's avatar
      SElinux: Clean up code related to foreign dex use · 2b291121
      Calin Juravle authored
      We simplified the way we track whether or not a dex file is used by
      other apps. DexManager in the framework keeps track of the data and we
      no longer need file markers on disk.
      
      Test: device boots, foreign dex markers are not created anymore
      
      Bug: 32871170
      Change-Id: I464ed6b09439cf0342020ee07596f9aa8ae53b62
      2b291121
    • Roshan Pius's avatar
      sepolicy: Make wpa_supplicant a HIDL service · a976e64d
      Roshan Pius authored
      Note: The existing rules allowing socket communication will be removed
      once we  migrate over to HIDL completely.
      
      (cherry-pick of 2a9595ed) 
      Bug: 34603782
      Test: Able to connect to wifi networks.
      Test: Will be sending for full wifi integration tests
      (go/wifi-test-request)
      Change-Id: I9ee238fd0017ec330f6eb67ef9049211f7bd4615
      a976e64d
  16. Feb 28, 2017
    • Todd Poynor's avatar
      Add /data/misc/reboot and reboot_data_file context · 7290f633
      Todd Poynor authored
      Add a file context for keeping track of last reboot reason and label
      directory /data/misc/reboot/ for this purpose.
      
      (Cherry picked from commit ca051f6d)
      
      Bug: 30994946
      Test: manual: reboot ocmmand, setprop sys.powerctl, SoC thermal mgr
      Change-Id: I9569420626b4029a62448b3f729ecbbeafbc3e66
      7290f633
    • Steven Moreland's avatar
      Bluetooth hal: move to vendor partition. · ba1c5831
      Steven Moreland authored
      Bug: 35328775
      Test: works in both binderized and passthrough modes
      Merged-In: I1f827b4983e5e67c516e4488ad3497dd62db7e20
      Change-Id: I1f827b4983e5e67c516e4488ad3497dd62db7e20
      ba1c5831
  17. Feb 27, 2017
  18. Feb 24, 2017
    • Roshan Pius's avatar
      sepolicy: Make wpa_supplicant a HIDL service · 2a9595ed
      Roshan Pius authored
      Note: The existing rules allowing socket communication will be removed
      once we  migrate over to HIDL completely.
      
      Bug: 34603782
      Test: Able to connect to wifi networks.
      Test: Will be sending for full wifi integration tests
      (go/wifi-test-request)
      Change-Id: I9ee238fd0017ec330f6eb67ef9049211f7bd4615
      2a9595ed
    • Amit Mahajan's avatar
      Move rild to vendor partition. · f7bed71a
      Amit Mahajan authored
      Test: Basic telephony sanity
      Bug: 35672432
      Change-Id: I7d17cc7efda9902013c21d508cefc77baccc06a8
      f7bed71a
  19. Feb 17, 2017
  20. Feb 15, 2017
    • Alex Vakulenko's avatar
      Add SELinux policies for vr_window_manager · c5680561
      Alex Vakulenko authored
      This set of rules is neeeded to allow vr_windows_manager to run
      successfully on the system.
      
      Bug: 32541196
      Test: `m -j32` succeeds. Sailfish device boots.
      Change-Id: I0aec94d80f655a6f47691cf2622dd158ce9e475f
      c5680561
  21. Feb 13, 2017
  22. Feb 12, 2017
    • Nick Kralevich's avatar
      tracefs: avoid overly generic regexes · 4cae28d4
      Nick Kralevich authored
      On boot, Android runs restorecon on a number of virtual directories,
      such as /sys and /sys/kernel/debug, to ensure that the SELinux labels
      are correct. To avoid causing excessive boot time delays, the restorecon
      code aggressively prunes directories, to avoid recursing down directory
      trees which will never have a matching SELinux label.
      
      See:
      * https://android-review.googlesource.com/93401
      * https://android-review.googlesource.com/109103
      
      The key to this optimization is avoiding unnecessarily broad regular
      expressions in file_contexts. If an overly broad regex exists, the tree
      pruning code is ineffective, and the restorecon ends up visiting lots of
      unnecessary directories.
      
      The directory /sys/kernel/debug/tracing contains approximately 4500
      files normally, and on debuggable builds, this number can jump to over
      9000 files when the processing from wifi-events.rc occurs. For
      comparison, the entire /sys/kernel/debug tree (excluding
      /sys/kernel/debug/tracing) only contains approximately 8000 files. The
      regular expression "/sys/kernel(/debug)?/tracing/(.*)?" ends up matching
      a significant number of files, which impacts boot performance.
      
      Instead of using an overly broad regex, refine the regex so only the
      files needed have an entry in file_contexts. This list of files is
      essentially a duplicate of the entries in
      frameworks/native/cmds/atrace/atrace.rc .
      
      This change reduces the restorecon_recursive call for /sys/kernel/debug
      from approximately 260ms to 40ms, a boot time reduction of approximately
      220ms.
      
      Bug: 35248779
      Test: device boots, no SELinux denials, faster boot.
      Change-Id: I70f8af102762ec0180546b05fcf014c097135f3e
      4cae28d4
  23. Feb 11, 2017
    • Nick Kralevich's avatar
      Don't try to relabel tracing directory · 6ebcfe47
      Nick Kralevich authored
      Use the default filesystem label from genfs_contexts for the directory
      /sys/kernel/debug/tracing and /sys/kernel/tracing, instead of explicitly
      attempting to relabel it.
      
      There are three cases we need to consider:
      
      1) Old-style tracing functionality is on debugfs
      2) tracing functionality is on tracefs, but mounted under debugfs
      3) tracefs is mounted at /sys/kernel/tracing
      
      For #1, the label on /sys/kernel/debug/tracing will be debugfs, and all
      processes are allowed debugfs:dir search, so having the label be debugfs
      instead of debugfs_tracing will not result in any permission change.
      
      For #2, the label on /sys/kernel/debug/tracing will be debugfs_tracing,
      which is the same as it is today. The empty directory
      /sys/kernel/tracing wlll retain the sysfs label, avoiding the denial
      below.
      
      For #3, /sys/kernel/debug/tracing won't exist, and /sys/kernel/tracing
      will have the debugfs_tracing label, where processes are allowed search
      access.
      
      Addresses the following denial:
      
      avc:  denied  { associate } for  pid=1 comm="init" name="tracing"
      dev="sysfs" ino=95 scontext=u:object_r:debugfs_tracing:s0
      tcontext=u:object_r:sysfs:s0 tclass=filesystem permissive=0
      
      Bug: 31856701
      Bug: 35197529
      Test: no denials on boot
      Change-Id: I7233ea92c6987b8edfce9c2f1d77eb25c7df820f
      6ebcfe47
  24. Feb 09, 2017
  25. Feb 07, 2017
  26. Feb 06, 2017
    • Todd Poynor's avatar
      Add /data/misc/reboot and reboot_data_file context · ca051f6d
      Todd Poynor authored
      Add a file context for keeping track of last reboot reason and label
      directory /data/misc/reboot/ for this purpose.
      
      Bug: 30994946
      Test: manual: reboot ocmmand, setprop sys.powerctl, SoC thermal mgr
      Change-Id: I9569420626b4029a62448b3f729ecbbeafbc3e66
      ca051f6d
    • Chad Brubaker's avatar
      Merge ephemeral data and apk files into app · 4c40d734
      Chad Brubaker authored
      The rules for the two types were the same and /data/app-ephemeral is
      being removed. Remove these types.
      
      Test: Builds
      Change-Id: I520c026395551ad1362dd2ced53c601d9e6f9b28
      4c40d734
  27. Feb 02, 2017
    • Jiyong Park's avatar
      configstore: add selinux policy for configstore@1.0 hal · ebec1aa2
      Jiyong Park authored
      This change adds selinux policy for configstore@1.0 hal. Currently, only
      surfaceflinger has access to the HAL, but need to be widen.
      
      Bug: 34314793
      Test: build & run
      
      Merged-In: I40e65032e9898ab5f412bfdb7745b43136d8e964
      Change-Id: I40e65032e9898ab5f412bfdb7745b43136d8e964
      (cherry picked from commit 5ff0f178)
      ebec1aa2
  28. Jan 31, 2017
    • Calin Juravle's avatar
      Remove SElinux audit to libart_file · 01ee59a7
      Calin Juravle authored
      Since it was introduced it caused quite a few issues and it spams the
      SElinux logs unnecessary.
      
      The end goal of the audit was to whitelist the access to the
      interpreter. However that's unfeasible for now given the complexity.
      
      Test: devices boots and everything works as expected
            no more auditallow logs
      
      Bug: 29795519
      Bug: 32871170
      Change-Id: I9a7a65835e1e1d3f81be635bed2a3acf75a264f6
      01ee59a7
Loading