xref: /aosp_15_r20/system/sepolicy/private/su.te (revision e4a36f4174b17bbab9dc043f4a65dc8d87377290)
1*e4a36f41SAndroid Build Coastguard Workeruserdebug_or_eng(`
2*e4a36f41SAndroid Build Coastguard Worker  typeattribute su coredomain;
3*e4a36f41SAndroid Build Coastguard Worker
4*e4a36f41SAndroid Build Coastguard Worker  domain_auto_trans(shell, su_exec, su)
5*e4a36f41SAndroid Build Coastguard Worker  # Allow dumpstate to call su on userdebug / eng builds to collect
6*e4a36f41SAndroid Build Coastguard Worker  # additional information.
7*e4a36f41SAndroid Build Coastguard Worker  domain_auto_trans(dumpstate, su_exec, su)
8*e4a36f41SAndroid Build Coastguard Worker
9*e4a36f41SAndroid Build Coastguard Worker  # Make sure that dumpstate runs the same from the "su" domain as
10*e4a36f41SAndroid Build Coastguard Worker  # from the "init" domain.
11*e4a36f41SAndroid Build Coastguard Worker  domain_auto_trans(su, dumpstate_exec, dumpstate)
12*e4a36f41SAndroid Build Coastguard Worker
13*e4a36f41SAndroid Build Coastguard Worker  # Put the incident command into its domain so it is the same on user, userdebug and eng.
14*e4a36f41SAndroid Build Coastguard Worker  domain_auto_trans(su, incident_exec, incident)
15*e4a36f41SAndroid Build Coastguard Worker
16*e4a36f41SAndroid Build Coastguard Worker  # Put the odrefresh command into its domain.
17*e4a36f41SAndroid Build Coastguard Worker  domain_auto_trans(su, odrefresh_exec, odrefresh)
18*e4a36f41SAndroid Build Coastguard Worker
19*e4a36f41SAndroid Build Coastguard Worker  # Put the perfetto command into its domain so it is the same on user, userdebug and eng.
20*e4a36f41SAndroid Build Coastguard Worker  domain_auto_trans(su, perfetto_exec, perfetto)
21*e4a36f41SAndroid Build Coastguard Worker
22*e4a36f41SAndroid Build Coastguard Worker  # Allow accessing virtualization (e.g. via the vm command) - ensures virtmgr runs in its
23*e4a36f41SAndroid Build Coastguard Worker  # own domain.
24*e4a36f41SAndroid Build Coastguard Worker  virtualizationservice_use(su)
25*e4a36f41SAndroid Build Coastguard Worker
26*e4a36f41SAndroid Build Coastguard Worker  # su is also permissive to permit setenforce.
27*e4a36f41SAndroid Build Coastguard Worker  permissive su;
28*e4a36f41SAndroid Build Coastguard Worker
29*e4a36f41SAndroid Build Coastguard Worker  app_domain(su)
30*e4a36f41SAndroid Build Coastguard Worker
31*e4a36f41SAndroid Build Coastguard Worker  # Do not audit accesses to keystore2 namespace for the su domain.
32*e4a36f41SAndroid Build Coastguard Worker  dontaudit su keystore2_key_type:{ keystore2 keystore2_key } *;
33*e4a36f41SAndroid Build Coastguard Worker
34*e4a36f41SAndroid Build Coastguard Worker  typeattribute su mlstrustedsubject;
35*e4a36f41SAndroid Build Coastguard Worker
36*e4a36f41SAndroid Build Coastguard Worker  # Add su to various domains
37*e4a36f41SAndroid Build Coastguard Worker  net_domain(su)
38*e4a36f41SAndroid Build Coastguard Worker
39*e4a36f41SAndroid Build Coastguard Worker  # grant su access to vndbinder
40*e4a36f41SAndroid Build Coastguard Worker  vndbinder_use(su)
41*e4a36f41SAndroid Build Coastguard Worker
42*e4a36f41SAndroid Build Coastguard Worker  dontaudit su self:capability_class_set *;
43*e4a36f41SAndroid Build Coastguard Worker  dontaudit su self:capability2 *;
44*e4a36f41SAndroid Build Coastguard Worker  dontaudit su kernel:security *;
45*e4a36f41SAndroid Build Coastguard Worker  dontaudit su { kernel file_type }:system *;
46*e4a36f41SAndroid Build Coastguard Worker  dontaudit su self:memprotect *;
47*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:anon_inode *;
48*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:{ process process2 } *;
49*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:fd *;
50*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:dir *;
51*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:lnk_file *;
52*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:{ fifo_file file } *;
53*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:socket_class_set *;
54*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:ipc_class_set *;
55*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:key *;
56*e4a36f41SAndroid Build Coastguard Worker  dontaudit su {fs_type fusefs_type}:filesystem *;
57*e4a36f41SAndroid Build Coastguard Worker  dontaudit su {fs_type dev_type file_type}:dir_file_class_set *;
58*e4a36f41SAndroid Build Coastguard Worker  dontaudit su node_type:node *;
59*e4a36f41SAndroid Build Coastguard Worker  dontaudit su node_type:{ tcp_socket udp_socket rawip_socket } *;
60*e4a36f41SAndroid Build Coastguard Worker  dontaudit su netif_type:netif *;
61*e4a36f41SAndroid Build Coastguard Worker  dontaudit su port_type:socket_class_set *;
62*e4a36f41SAndroid Build Coastguard Worker  dontaudit su port_type:{ tcp_socket dccp_socket } *;
63*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:peer *;
64*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:binder *;
65*e4a36f41SAndroid Build Coastguard Worker  dontaudit su property_type:property_service *;
66*e4a36f41SAndroid Build Coastguard Worker  dontaudit su property_type:file *;
67*e4a36f41SAndroid Build Coastguard Worker  dontaudit su service_manager_type:service_manager *;
68*e4a36f41SAndroid Build Coastguard Worker  dontaudit su hwservice_manager_type:hwservice_manager *;
69*e4a36f41SAndroid Build Coastguard Worker  dontaudit su vndservice_manager_type:service_manager *;
70*e4a36f41SAndroid Build Coastguard Worker  dontaudit su servicemanager:service_manager list;
71*e4a36f41SAndroid Build Coastguard Worker  dontaudit su hwservicemanager:hwservice_manager list;
72*e4a36f41SAndroid Build Coastguard Worker  dontaudit su vndservicemanager:service_manager list;
73*e4a36f41SAndroid Build Coastguard Worker  dontaudit su keystore:keystore2 *;
74*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:drmservice *;
75*e4a36f41SAndroid Build Coastguard Worker  dontaudit su unlabeled:filesystem *;
76*e4a36f41SAndroid Build Coastguard Worker  dontaudit su postinstall_file:filesystem *;
77*e4a36f41SAndroid Build Coastguard Worker  dontaudit su domain:bpf *;
78*e4a36f41SAndroid Build Coastguard Worker  dontaudit su unlabeled:vsock_socket *;
79*e4a36f41SAndroid Build Coastguard Worker  dontaudit su self:perf_event *;
80*e4a36f41SAndroid Build Coastguard Worker
81*e4a36f41SAndroid Build Coastguard Worker  # VTS tests run in the permissive su domain on debug builds, but the HALs
82*e4a36f41SAndroid Build Coastguard Worker  # being tested run in enforcing mode. Because hal_foo_server is enforcing
83*e4a36f41SAndroid Build Coastguard Worker  # su needs to be declared as hal_foo_client to grant hal_foo_server
84*e4a36f41SAndroid Build Coastguard Worker  # permission to interact with it.
85*e4a36f41SAndroid Build Coastguard Worker  typeattribute su halclientdomain;
86*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_allocator_client;
87*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_atrace_client;
88*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_audio_client;
89*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_authsecret_client;
90*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_bluetooth_client;
91*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_bootctl_client;
92*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_camera_client;
93*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_configstore_client;
94*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_confirmationui_client;
95*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_contexthub_client;
96*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_drm_client;
97*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_cas_client;
98*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_dumpstate_client;
99*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_fingerprint_client;
100*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_gatekeeper_client;
101*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_gnss_client;
102*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_graphics_allocator_client;
103*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_graphics_composer_client;
104*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_health_client;
105*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_input_classifier_client;
106*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_ir_client;
107*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_keymaster_client;
108*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_light_client;
109*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_mediaquality_client;
110*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_memtrack_client;
111*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_neuralnetworks_client;
112*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_nfc_client;
113*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_oemlock_client;
114*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_power_client;
115*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_rebootescrow_client;
116*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_secretkeeper_client;
117*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_secure_element_client;
118*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_sensors_client;
119*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_telephony_client;
120*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_tetheroffload_client;
121*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_thermal_client;
122*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_tv_cec_client;
123*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_tv_hdmi_cec_client;
124*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_tv_hdmi_connection_client;
125*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_tv_hdmi_earc_client;
126*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_tv_input_client;
127*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_tv_tuner_client;
128*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_usb_client;
129*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_vibrator_client;
130*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_vr_client;
131*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_weaver_client;
132*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_wifi_client;
133*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_wifi_hostapd_client;
134*e4a36f41SAndroid Build Coastguard Worker  typeattribute su hal_wifi_supplicant_client;
135*e4a36f41SAndroid Build Coastguard Worker')
136