1type runas, domain, mlstrustedsubject;
2type runas_exec, exec_type, file_type;
3
4allow runas adbd:fd use;
5allow runas adbd:process sigchld;
6allow runas adbd:unix_stream_socket { read write };
7allow runas shell:fd use;
8allow runas shell:fifo_file { read write };
9allow runas shell:unix_stream_socket { read write };
10allow runas devpts:chr_file { read write ioctl };
11allow runas shell_data_file:file { read write };
12
13# run-as reads package information.
14allow runas system_data_file:file r_file_perms;
15allow runas system_data_file:lnk_file getattr;
16
17# The app's data dir may be accessed through a symlink.
18allow runas system_data_file:lnk_file read;
19
20# run-as checks and changes to the app data dir.
21dontaudit runas self:global_capability_class_set dac_override;
22allow runas app_data_file:dir { getattr search };
23
24# run-as switches to the app UID/GID.
25allow runas self:global_capability_class_set { setuid setgid };
26
27# run-as switches to the app security context.
28selinux_check_context(runas) # validate context
29allow runas self:process setcurrent;
30allow runas non_system_app_set:process dyntransition; # setcon
31
32# runas/libselinux needs access to seapp_contexts_file to
33# determine which domain to transition to.
34allow runas seapp_contexts_file:file r_file_perms;
35
36###
37### neverallow rules
38###
39
40# run-as cannot have capabilities other than CAP_SETUID and CAP_SETGID
41neverallow runas self:global_capability_class_set ~{ setuid setgid };
42neverallow runas self:global_capability2_class_set *;
43