xref: /aosp_15_r20/system/sepolicy/private/simpleperf_app_runner.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Workertypeattribute simpleperf_app_runner coredomain;
2*e4a36f41SAndroid Build Coastguard Worker
3*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(shell, simpleperf_app_runner_exec, simpleperf_app_runner)
4*e4a36f41SAndroid Build Coastguard Worker
5*e4a36f41SAndroid Build Coastguard Worker# run simpleperf_app_runner in adb shell.
6*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner adbd:fd use;
7*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner shell:fd use;
8*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner devpts:chr_file { read write ioctl };
9*e4a36f41SAndroid Build Coastguard Worker
10*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner reads package information.
11*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner system_data_file:file r_file_perms;
12*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner system_data_file:lnk_file getattr;
13*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner packages_list_file:file r_file_perms;
14*e4a36f41SAndroid Build Coastguard Worker
15*e4a36f41SAndroid Build Coastguard Worker# The app's data dir may be accessed through a symlink.
16*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner system_data_file:lnk_file read;
17*e4a36f41SAndroid Build Coastguard Worker
18*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner switches to the app UID/GID.
19*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner self:global_capability_class_set { setuid setgid };
20*e4a36f41SAndroid Build Coastguard Worker
21*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner switches to the app security context.
22*e4a36f41SAndroid Build Coastguard Workerselinux_check_context(simpleperf_app_runner) # validate context
23*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner self:process setcurrent;
24*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner { ephemeral_app isolated_app platform_app priv_app untrusted_app_all }:process dyntransition; # setcon
25*e4a36f41SAndroid Build Coastguard Worker
26*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner/libselinux needs access to seapp_contexts_file to
27*e4a36f41SAndroid Build Coastguard Worker# determine which domain to transition to.
28*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner seapp_contexts_file:file r_file_perms;
29*e4a36f41SAndroid Build Coastguard Worker
30*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner passes pipe fds.
31*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner writes app type (debuggable or profileable) to pipe fds.
32*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner shell:fifo_file { read write };
33*e4a36f41SAndroid Build Coastguard Worker
34*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner checks shell data paths.
35*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner passes shell data fds.
36*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner shell_data_file:dir { getattr search };
37*e4a36f41SAndroid Build Coastguard Workerallow simpleperf_app_runner shell_data_file:file { getattr write };
38*e4a36f41SAndroid Build Coastguard Worker
39*e4a36f41SAndroid Build Coastguard Worker###
40*e4a36f41SAndroid Build Coastguard Worker### neverallow rules
41*e4a36f41SAndroid Build Coastguard Worker###
42*e4a36f41SAndroid Build Coastguard Worker
43*e4a36f41SAndroid Build Coastguard Worker# simpleperf_app_runner cannot have capabilities other than CAP_SETUID and CAP_SETGID
44*e4a36f41SAndroid Build Coastguard Workerneverallow simpleperf_app_runner self:global_capability_class_set ~{ setuid setgid };
45*e4a36f41SAndroid Build Coastguard Workerneverallow simpleperf_app_runner self:global_capability2_class_set *;
46