Commit graph

30 commits

Author SHA1 Message Date
Jeffrey Huang
dd1ce53b27 Allow system server to add StatsHal
Bug: 148794952
Test: m -j
Change-Id: I14cc282bb262f1ec62ab3473d9229763c1a02e21
Merged-In: I14cc282bb262f1ec62ab3473d9229763c1a02e21
2020-02-05 17:24:48 -08:00
Alec Mouri
f5df7b4467 [SfStats] sepolicy for SfStats' global puller
Bug: 119885568
Bug: 136597024
Test: adb shell cmd stats pull-source 10062
Test: statsd_testdrive 10062
Change-Id: Ide8ecd2683b3ea29a3207f89d35d7067490dabb1
2020-01-10 16:34:48 -08:00
Jeffrey Huang
215dd2aa9b system_server: create StatsManagerService
Refactor to split the logic within statscompanion_service
The goal of the refactor is to simplify the binder calls to statsd

This service will talk to statsd.

At the end of the refactor, this service should be the only
service that talks to statsd.

Bug: 146074223
Test: Manual by creating the service with empty implementation
Change-Id: Ib9c2e10ec195d41062f1001e5a82b374696de939
2019-12-16 11:50:16 -08:00
Max Dashouk
febfa8f22d Allows StatsCompanionService to pipe data to statsd.
This fixes presubmit failures for
[1] https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/7555609/8
Presubmit failure before the CL:
https://android-build.googleplex.com/builds/where-is-my-cl/googleplex-android-review/7555609?revision=9&workplanId=L35600000315868357

Test: Created the same CL in internal master (https://googleplex-android-review.git.corp.google.com/c/platform/system/sepolicy/+/7622337) and put it under the same
topic as [1]. Presubmit passes now:
https://android-build.googleplex.com/builds/where-is-my-cl/googleplex-android-review/7622337?revision=4&workplanId=L42800000317195093

Change-Id: I9e5f0a9d501a6728af3f27241300b3bb5c5c2123
2019-05-21 14:45:56 -07:00
Tri Vo
1d34b8cc31 Treble-ize sepolicy for fwk HIDL services.
Bug: 130734497
Test: m selinux_policy; system_server and statds still have permission
to export HIDL services.
Change-Id: I6e87b236bdbdd939fca51fb7255e97635118ed2d
2019-04-22 12:47:53 -07:00
Bookatz
d2f3d18fcd Incidentd gets statsd incident section
There is now an incident section for statsd output data. These selinux
changes must be made for incident to call dump on statsd to get the
data.

Bug: 115678461
Test: adb shell incident -b 3023
and confirm that a valid statsd section is obtained

Change-Id: I761389c160ab3ab6c24556813a1a31088c0f5137
2018-11-13 09:18:34 -08:00
Howard Ro
21bd2aeb08 Allow all app types to socket send to statsdw (statsd socket)
Also move statsd to /public/

Bug: 110538431
Test: manual testing
Change-Id: I58319e169eaab7d997ed3628c3c9709cf7bd0d4a
2018-08-23 16:13:30 -07:00
Andreas Gampe
835881aaa4 Sepolicy: Fix perfprofd permissions
Let statsd find the service. The system server wants to read file
attributes for the perfprofd dropbox file.

Bug: 73175642
Test: m
Test: manual
Change-Id: I0c0b1dac057af90fff440286226093ec15b5e247
2018-05-10 15:07:09 -07:00
yro
db2e6085bb Allow lmkd to log to statsd
Bug: 78603347
Test: build and locally tested
Change-Id: Ib9b041af63d1fac7a689b932e7a2b202fa8d0f83
2018-05-03 16:43:03 -07:00
yro
64c7a758b4 Setting up sepolicies for statsd planB of listening to its own socket
Test: manual
Bug: 78318738
Change-Id: I45c3511860fbe6a1de45c6930052a8865b38986a
2018-04-25 02:20:36 -07:00
Bookatz
1300945c12 Statsd sepolicy hal_health
Statsd monitors battery capacity, which requires calls to the health
hal.

Fixes: 77923174
Bug: 77916472
Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.HostAtomTests#testFullBatteryCapacity
Change-Id: I2d6685d4b91d8fbc7422dfdd0b6ed96bbddc0886
2018-04-12 09:34:00 -07:00
yro
36dd2a410c Update sepolicy to have system_server access stats_data
Test: manually tested to prevent sepolicy violation
Change-Id: I9ebcc86464a9fc61a49d5c9be40f19f3523b6785
2018-03-30 15:58:58 -07:00
Andreas Gampe
488030ee6f Statsd: Allow statsd to contact perfprofd in userdebug
Give statsd rights to connect to perfprofd in userdebug.

Test: mmma system/extras/perfprofd
Change-Id: Idea0a6b757d1b16ec2e6c8719e24900f1e5518fd
2018-03-27 12:08:45 -07:00
Tej Singh
c26ac738e5 Statsd sepolicy for thermal hal
Updates statsd sepolicy so it can use the thermal hal.

Test: verified these policies solved sepolicy issues with thermal hal.
Change-Id: I36839a72494b084d5742c4d83c3ce9814102b974
2018-02-26 20:32:58 -08:00
Bookatz
c9f205b56a Fix benign statsd selinux violations
These two selinux policy violations keep showing up from statsd's CTS
tests, although statsd and the CTS test seemed to function fine despite
them. Nonetheless, they seem reasonable to add to the list.

Bug: 73548694
Test: N/A. It didn't seem to be causing any issues in the first place.
Change-Id: Id36c5229c0d7de83675166caeb07c87b719dc374
2018-02-23 13:06:32 -08:00
Bookatz
18b8b8fc46 Statsd selinux allow shell to interact with statsd
To upload configs and download output, this line
is needed.

Bug: 72961153
Test: The statsd cts test passes
Change-Id: I0943cc841881dd5d15e24ba444b146087a81bf96
2018-02-16 13:28:04 -08:00
Bookatz
022ab0e738 Statsd allow shell in selinux policy
CTS tests need to be able to call, from hostside:
adb shell cmd stats dump-report (and others)
On a user build, this will fail because of an selinux policy violation
from shell. This cl fixes this by granting shell permission.

Similarly, Settings needs to communicate with statsd, so
system_app-statsd binder calls are given permission.

Bug: 72961153
Bug: 73255014
Test: run cts-dev -m CtsStatsdHostTestCases -t android.cts.statsd.atom.HostAtomTests
Test: manual confirmation
Change-Id: I6589ab4ef5c91a4a7f78eb97b63d9bb43e3d8f02
2018-02-13 09:34:55 -08:00
Jeff Vander Stoep
de04528c3b Enable Traceur on user builds.
Test: Standard Traceur workflow works successfully with no
selinux denials on a user build.
Bug: 64762598
Change-Id: I0dfe506d463b63d70c5bda03f8706041ea7ab448
2018-02-02 12:46:36 -08:00
Primiano Tucci
1a9f4f7a7a SELinux policies for Perfetto cmdline client (/system/bin/perfetto)
Instead of having statsd linking the perfetto client library
and talk directly to its socket, we let just statsd exec()
the /system/bin/perfetto cmdline client.

There are two reasons for this:
1) Simplify the interaction between statsd and perfetto, reduce
  dependencies, binary size bloat and isolate faults.
2) The cmdline client also takes care of handing the trace to
  Dropbox. This allows to expose the binder interaction surface
  to the short-lived cmdline client and avoid to grant binder
  access to the perfetto traced daemon.

This cmdline client will be used by:
 - statsd
 - the shell user (for our UI and Studio)

Bug: 70942310
Change-Id: I8cdde181481ad0a1a5cae5937ac446cedac54a1f
2018-01-29 11:06:00 +00:00
Tom Cherry
c2653ae86d Neverallow vendor_init from accessing stats_data_file
The exception for vendor_init in this neverallow was never needed.

Bug: 62875318
Test: Build walleye, bullhead
Change-Id: Iac2b57df30b376492851d7520994e0400a87f1e1
2018-01-25 19:42:11 +00:00
yro
53164f40de Allow binder call between statsd and healthd. Also allow statsd to find
health hal service for battery metrics.

Test: cts test, manual test

Change-Id: I73a801f6970e25bee5921479f2f7078bcb1973a9
2018-01-24 19:51:17 +00:00
yro
cf38ca5ed0 Update sepolicy of statsd to be able to find incident_service
Test: manual testing
Change-Id: Ia97c956c08d2062af6b33622c6b61ca3810b0cb1
2018-01-24 18:25:04 +00:00
Yao Chen
b10ff337bf Allow dumpstate to call statsd. This is needed for bugreport.
Selinux violations while calling dump() on statsd by bugreport.

avc: denied { call } for scontext=u:r:dumpstate:s0 tcontext=u:r:statsd:s0 tclass=binder permissive=1
denied { use } for path="pipe:[411602]" dev="pipefs" ino=411602 scontext=u:r:statsd:s0 tcontext=u:r:dumpstate:s0 tclass=fd permissive=1
avc: denied { write } for path="pipe:[411602]" dev="pipefs" ino=411602 scontext=u:r:statsd:s0 tcontext=u:r:dumpstate:s0 tclass=fifo_file permissive=1
avc: denied { getattr } for path="pipe:[411602]" dev="pipefs" ino=411602 scontext=u:r:statsd:s0 tcontext=u:r:dumpstate:s0 tclass=fifo_file permissive=1

Test: manual
Change-Id: I46c5b119548378cc80c6e4498d00edad5959d188
2018-01-19 09:21:49 -08:00
yro
e27af27f8a Update statsd sepolicies to avoid selinux violations during cts tests
and pulling metrics

Bug: 63757906
Test: manual testing conducted
Change-Id: Ieba524ee676dfb4a457d39d025d203bf02a70831
2018-01-10 08:32:24 +00:00
Primiano Tucci
c80f9e037b Perfetto SELinux policies
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
2018-01-10 00:18:46 +00:00
yro
31b11d8ef8 Update priv_app selinux policy to allow gmscore to be able to
communicate with statsd

Test: manual testing conducted
Change-Id: Icd268e258f7cbdd9310baab53fe0c66f4f303d5e
2018-01-09 20:39:09 +00:00
Max Bires
4ea5569f53 Adding a traceur_app domain to remove it from shell
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
2018-01-02 15:29:03 -08:00
yro
2970845577 Setting up SELinux policy for statsd and stats service
Bug: 63757906
Test: manual testing conducted
Change-Id: Id03413ce82b5646d4bceddc59e16c7d5ee5bc193
2017-12-19 01:41:48 +00:00
Howard Ro
d496ea7a61 Revert "Setting up SELinux policy for statsd and stats service"
This reverts commit 5744cbdf8d.

Reason for revert: aosp_dragon-userdebug build broken

Change-Id: I5f8180273c32119ae9839f31610bbca37cd05c65
2017-12-16 02:22:23 +00:00
yro
5744cbdf8d Setting up SELinux policy for statsd and stats service
Test: manual testing conducted see if it interfere's with AOSP

Change-Id: If47a663557b2ebf825fc082edb838ae085ec66b3
2017-12-16 01:40:45 +00:00