Skip to content
Snippets Groups Projects
  1. 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
  2. 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
  3. 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
  4. Apr 04, 2018
  5. Mar 30, 2018
  6. Mar 22, 2018
    • Primiano Tucci's avatar
      Reland: perfetto: allow traced_probes to execute atrace · feaf22b1
      Primiano Tucci authored
      This CL adds the SELinux permissions required to execute
      atrace and get userspace tracing events from system services.
      This is to enable tracing of events coming from surfaceflinger,
      audio HAL, etc.
      atrace, when executed, sets a bunch of debug.atrace. properties
      and sends an IPC via binder/hwbinder to tell the services to
      reload that property.
      
      This CL does NOT affect systrace. In that case (i.e. when
      atrace is executed from adb/shell) atrace still runs in
      the shell domain and none of those changes apply.
      
      Change-Id: I11b096d5c5c5593f18bce87f06c1a7b1ffa7910e
      Bug: b/73340039
      feaf22b1
  7. Mar 01, 2018
    • Jerry Zhang's avatar
      Add functionfs access to system_server. · 1d401545
      Jerry Zhang authored
      UsbDeviceManager in system_server now
      helps set up the endpoint files.
      
      Bug: 72877174
      Test: No selinux denials
      Change-Id: I96b11ee68799ac29b756d2034e7f5e4660dbed98
      1d401545
  8. Feb 13, 2018
    • Primiano Tucci's avatar
      Allow perfetto traced_probes to access tracefs on user · b4b31f9d
      Primiano Tucci authored
      Allows the traced_probes daemon to access the core ftrace
      functionalities on user builds. Specifically this involves:
      - Whitelisting the per_cpu/ subdirectory to access:
        1) trace_pipe_raw file to allow perfetto to read the raw
           ftrace buffer (rather than the text-based /trace endpoint)
        2) cpuX/stats and cpuX/buffer_size_kb that allow to
           tune the buffer size per-cpu pipe and to get basic
           statistics about the ftrace buffer (#events, overruns)
      - Whitelistiing the full event directories rather than the
        /enable files. This gives also access to the /format files
        for the events that are already enabled on user builds.
        /format files simply describe the memory layout
        of the binary logs. Example: https://ghostbin.com/paste/f8m4k
      
      This still does NOT allow enabling the events labeled as
      "_debug" (mostly events that return activity on inodes).
      We'll deal with that separately as soon as we get a POC
      of inode resolution and a sensible blacklist/whitelist model.
      
      Bug: 70942310
      Change-Id: Ic15cca0a9d7bc0e45aa48097a94eadef44c333f8
      b4b31f9d
  9. 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
  10. Feb 02, 2018
    • Jeff Vander Stoep's avatar
      Enable Traceur on user builds. · de04528c
      Jeff Vander Stoep authored
      Test: Standard Traceur workflow works successfully with no
      selinux denials on a user build.
      Bug: 64762598
      Change-Id: I0dfe506d463b63d70c5bda03f8706041ea7ab448
      de04528c
  11. Jan 29, 2018
    • Tom Cherry's avatar
      Remove vendor_init from coredomain · 9c778045
      Tom Cherry authored
      vendor_init exists on the system partition, but it is meant to be an
      extention of init that runs with vendor permissions for executing
      vendor scripts, therefore it is not meant to be in coredomain.
      
      Bug: 62875318
      Test: boot walleye
      Merged-In: I01af5c9f8b198674b15b90620d02725a6e7c1da6
      Change-Id: I01af5c9f8b198674b15b90620d02725a6e7c1da6
      9c778045
  12. Jan 23, 2018
    • Tri Vo's avatar
      dumpstate: remove access to 'proc' and 'sysfs' types. · 218d87c0
      Tri Vo authored
      And grant appropriate permissions to more granular types.
      
      Bug: 29319732
      Bug: 65643247
      Test: adb bugreport; no new denials to /proc or /sys files.
      
      Change-Id: Ied99546164e79bfa6148822858c165177d3720a5
      218d87c0
  13. Jan 20, 2018
  14. Jan 18, 2018
  15. Jan 17, 2018
  16. Jan 10, 2018
    • Primiano Tucci's avatar
      Perfetto SELinux policies · c80f9e03
      Primiano Tucci authored
      Perfetto is a performance instrumentation and logging framework,
      living in AOSP's /external/pefetto.
      Perfetto introduces in the system one binary and two daemons
      (the binary can specialize in either depending on the cmdline).
      
      1) traced: unprivileged daemon. This is architecturally similar to logd.
         It exposes two UNIX sockets:
         - /dev/socket/traced_producer : world-accessible, allows to stream
           tracing data. A tmpfs file descriptor is sent via SCM_RIGHTS
           from traced to each client process, which needs to be able to
           mmap it R/W (but not X)
         - /dev/socket/traced_consumer : privilege-accessible (only from:
           shell, statsd). It allows to configure tracing and read the trace
           buffer.
      2) traced_probes: privileged daemon. This needs to:
         - access tracingfs (/d/tracing) to turn tracing on and off.
         - exec atrace
         - connect to traced_producer to stream data to traced.
      
      init.rc file:
      https://android-review.googlesource.com/c/platform/external/perfetto/+/575382/14/perfetto.rc
      
      Bug: 70942310
      Change-Id: Ia3b5fdacbd5a8e6e23b82f1d6fabfa07e4abc405
      c80f9e03
  17. Jan 02, 2018
    • Max Bires's avatar
      Adding a traceur_app domain to remove it from shell · 4ea5569f
      Max Bires authored
      This CL creates a traceur_app domain with userdebug privileges akin to
      what shell has with regards to being able to find most services on
      device. Previously, traceur was running as shell which was an
      unintentional abuse of selinux architecture.
      
      Bug: 68126425
      Test: Traceur functions outside of shell user privilege
      Change-Id: Ib5090e7e8225ad201b3ec24b506fe2717101d0f1
      4ea5569f
  18. Dec 11, 2017
    • Tri Vo's avatar
      Remove access to 'sysfs' files from healtd and charger. · d276b434
      Tri Vo authored
      We rely on vendors to label all dependencies of healthd/charger under
      /sys/class/power_supply with sysfs_batteryinfo type.
      
      Bug: 65643247
      Bug: 32659667
      Test: boots without denials from healthd, to sysfs_batteryinfo or to
      sysfs_msm_subsys.
      Test: charging with device turned off works without /sys denials.
      
      Change-Id: I893f309ecad8a0caf7d0b81f5f945725907255c2
      d276b434
  19. Dec 08, 2017
  20. Nov 21, 2017
    • Benjamin Gordon's avatar
      sepolicy: Add rules for non-init namespaces · 9b2e0cbe
      Benjamin Gordon authored
      In kernel 4.7, the capability and capability2 classes were split apart
      from cap_userns and cap2_userns (see kernel commit
      8e4ff6f228e4722cac74db716e308d1da33d744f). Since then, Android cannot be
      run in a container with SELinux in enforcing mode.
      
      This change applies the existing capability rules to user namespaces as
      well as the root namespace so that Android running in a container
      behaves the same on pre- and post-4.7 kernels.
      
      This is essentially:
        1. New global_capability_class_set and global_capability2_class_set
           that match capability+cap_userns and capability2+cap2_userns,
           respectively.
        2. s/self:capability/self:global_capability_class_set/g
        3. s/self:capability2/self:global_capability2_class_set/g
        4. Add cap_userns and cap2_userns to the existing capability_class_set
           so that it covers all capabilities.  This set was used by several
           neverallow and dontaudit rules, and I confirmed that the new
           classes are still appropriate.
      
      Test: diff new policy against old and confirm that all new rules add
            only cap_userns or cap2_userns;
            Boot ARC++ on a device with the 4.12 kernel.
      Bug: crbug.com/754831
      
      Change-Id: I4007eb3a2ecd01b062c4c78d9afee71c530df95f
      9b2e0cbe
  21. Nov 17, 2017
    • Tri Vo's avatar
      shell: neverallow access to 'proc' label. · c4ef3630
      Tri Vo authored
      Added access to proc_uptime and proc_asound to address these denials:
      
      avc: denied { read } for name="uptime" dev="proc" ino=4026532080
      scontext=u:r:shell:s0 tcontext=u:object_r:proc_uptime:s0 tclass=file
      permissive=1
      
      avc: denied { getattr } for path="/proc/asound/version" dev="proc"
      ino=4026532017 scontext=u:r:shell:s0 tcontext=u:object_r:proc_asound:s0
      tclass=file permissive=1
      
      Bug: 65643247
      Test: device boots with no denial from 'shell' domain.
      Test: lsmod, ps, top, netstat
      Test: No denials triggered from CtsSecurityHostTestCases
      Test: external/toybox/run-tests-on-android.sh does not pass, but triggers
      no denials from 'shell' domain to 'proc' type.
      
      Change-Id: Ia4c26fd616e33e5962c6707a855dc24e338ec153
      c4ef3630
    • Tri Vo's avatar
      mediaserver: remove access to 'sysfs' type. · 2ea12cd3
      Tri Vo authored
      Bug: 65643247
      Test: cts-tradefed run cts-dev -m \
      CtsMediaTestCases --compatibility:module-arg \
      CtsMediaTestCases:include-annotation:\
      android.platform.test.annotations.RequiresDevice
      No denials from mediaserver domain to sysfs type are observed.
      Change-Id: Icb5c12f04af213452d82e226993fe13085c5c33f
      2ea12cd3
  22. Nov 15, 2017
  23. Nov 13, 2017
  24. Nov 08, 2017
    • Tri Vo's avatar
      init: label /proc dependencies and remove access to proc · 84e181bc
      Tri Vo authored
      New types and files labeled with them:
      1. proc_abi:
        /proc/sys/abi/swp
      
      2. proc_dirty:
        /proc/sys/vm/dirty_background_ratio
        /proc/sys/vm/dirty_expire_centisecs
      
      3. proc_diskstats:
        /proc/diskstats
      
      4. proc_extra_free_kbytes:
        /proc/sys/vm/extra_free_kbytes
      
      5. proc_hostname:
        /proc/sys/kernel/domainname
        /proc/sys/kernel/hostname
      
      6. proc_hung_task:
        /proc/sys/kernel/hung_task_timeout_secs
      
      7. proc_max_map_count:
        /proc/sys/vm/max_map_count
      
      8. proc_panic:
        /proc/sys/kernel/panic_on_oops
      
      9. proc_sched:
        /proc/sys/kernel/sched_child_runs_first
        /proc/sys/kernel/sched_latency_ns
        /proc/sys/kernel/sched_rt_period_us
        /proc/sys/kernel/sched_rt_runtime_us
        /proc/sys/kernel/sched_tunable_scaling
        /proc/sys/kernel/sched_wakeup_granularity_ns
      
      10. proc_uptime:
        /proc/uptime
      
      Files labeled with already existing types:
      1. proc_perf:
        /proc/sys/kernel/perf_event_paranoid
      
      2. proc_sysrq:
        /proc/sys/kernel/sysrq
      
      3. usermodehelper:
        /proc/sys/kernel/core_pipe_limit
      
      Changes to init domain:
      1. Removed access to files with 'proc' label.
      2. Added access to newly introduced types + proc_kmsg.
      
      Bug: 68949041
      Test: walleye boots without denials from u:r:init:s0.
      Test: system/core/init/grab-bootchart.sh does not trigger denials from
      u:r:init:s0
      Change-Id: If1715c3821e277679c320956df33dd273e750ea2
      84e181bc
  25. Nov 07, 2017
  26. Nov 03, 2017
    • Tri Vo's avatar
      radio: neverallow access to proc and sysfs types. · 5aac163b
      Tri Vo authored
      Bug: 65643247
      Test: build aosp_sailfish-userdebug
      Test: build walleye-userdebug from internal
      This CL does not change runtime behavior.
      Change-Id: I82c520579b986ea2a4a6f030ec60d5345c00b54f
      5aac163b
  27. Nov 02, 2017
    • Tri Vo's avatar
      Neverallow coredomain to kernel interface files. · 233c7a6b
      Tri Vo authored
      Core domains should not be allowed access to kernel interfaces,
      which are not explicitly labeled. These interfaces include
      (but are not limited to):
      
      1. /proc
      2. /sys
      3. /dev
      4. debugfs
      5. tracefs
      6. inotifyfs
      7. pstorefs
      8. configfs
      9. functionfs
      10. usbfs
      11. binfmt_miscfs
      
      We keep a lists of exceptions to the rule, which we will be gradually shrinking.
      This will help us prevent accidental regressions in our efforts to label
      kernel interfaces.
      
      Bug: 68159582
      Bug: 68792382
      Test: build aosp_sailfish-user
      Test: build aosp_sailfish-userdebug
      Test: CP to internal and build walleye-user
      Change-Id: I1b2890ce1efb02a08709a6132cf2f12f9d88fde7
      233c7a6b
    • Tobias Thierer's avatar
      Revert "Neverallow coredomain to kernel interface files." · 83a06805
      Tobias Thierer authored
      This reverts commit 502e43f7.
      
      Reason for revert: Suspected to have broken a build, see b/68792382
      
      Bug: 68792382
      Change-Id: Ib5d465b7a50a73e3d8d8edd4e6b3426a7bde4249
      83a06805
  28. Oct 31, 2017
    • Tri Vo's avatar
      Neverallow coredomain to kernel interface files. · 502e43f7
      Tri Vo authored
      Core domains should not be allowed access to kernel interfaces,
      which are not explicitly labeled. These interfaces include
      (but are not limited to):
      
      1. /proc
      2. /sys
      3. /dev
      4. debugfs
      5. tracefs
      6. inotifyfs
      7. pstorefs
      8. configfs
      9. functionfs
      10. usbfs
      11. binfmt_miscfs
      
      We keep a lists of exceptions to the rule, which we will be gradually shrinking.
      This will help us prevent accidental regressions in our efforts to label
      kernel interfaces.
      
      Bug: 68159582
      Test: bullhead, sailfish can build
      Change-Id: I8e466843e1856720f30964546c5c2c32989fa3a5
      502e43f7
  29. Apr 12, 2017
    • Shawn Willden's avatar
      Add keystore_key:attest_unique_id to priv_app. · a0c7f012
      Shawn Willden authored
      Only privileged apps are supposed to be able to get unique IDs from
      attestation.
      
      Test: CTS test verifies the negative condition, manual the positive
      Bug: 34671471
      Change-Id: I9ab3f71b1e11ed1d7866ff933feece73152d2578
      a0c7f012
  30. Feb 16, 2017
  31. Jan 18, 2017
    • Josh Gao's avatar
      Introduce crash_dump debugging helper. · cb3eb4ee
      Josh Gao authored
      Replace the global debuggerd with a per-process debugging helper that
      gets exec'ed by the process that crashed.
      
      Bug: http://b/30705528
      Test: crasher/crasher64, `debuggerd <pid>`, `kill -ABRT <pid>`
      Change-Id: Iad1b7478f7a4e2690720db4b066417d8b66834ed
      cb3eb4ee
  32. Jan 07, 2017
    • ynwang's avatar
      Storaged permissions for task I/O · e68d2d2c
      ynwang authored
      Allow storaged to read /proc/[pid]/io
      Grant binder access to storaged
      Add storaged service
      Grant storaged_exec access to dumpstate
      Grant storaged binder_call to dumpstate
      
      Bug: 32221677
      
      Change-Id: Iecc9dba266c5566817a99ac6251eb943a0bac630
      e68d2d2c
  33. Dec 06, 2016
    • dcashman's avatar
      sepolicy: add version_policy tool and version non-platform policy. · 2e00e637
      dcashman authored
      In order to support platform changes without simultaneous updates from
      non-platform components, the platform and non-platform policies must be
      split.  In order to provide a guarantee that policy written for
      non-platform objects continues to provide the same access, all types
      exposed to non-platform policy are versioned by converting them and the
      policy using them into attributes.
      
      This change performs that split, the subsequent versioning and also
      generates a mapping file to glue the different policy components
      together.
      
      Test: Device boots and runs.
      Bug: 31369363
      Change-Id: Ibfd3eb077bd9b8e2ff3b2e6a0ca87e44d78b1317
      2e00e637
Loading