1#line 1 "system/sepolicy/flagging/flagging_macros"
2####################################
3# is_flag_enabled(flag, rules)
4# SELinux rules which apply only if given feature is turned on
5
6
7####################################
8# is_flag_disabled(flag, rules)
9# SELinux rules which apply only if given feature is turned off
10
11
12####################################
13# starting_at_board_api(api_level, rules_if_api_level)
14#
15# This macro conditionally exposes SELinux rules ensuring they are available
16# only when the board API level is at or above the specified 'api_level'.
17
18
19####################################
20# until_board_api(api_level, rules_if_lower_api_level)
21#
22# This macro conditionally exposes SELinux rules ensuring they are available
23# only when the board API level is below the specified 'api_level'.
24
25#line 1 "system/sepolicy/reqd_mask/security_classes"
26# FLASK
27
28#
29# Define the security object classes
30#
31
32# Classes marked as userspace are classes
33# for userspace object managers
34
35class security
36class process
37class system
38class capability
39
40# file-related classes
41class filesystem
42class file
43class anon_inode
44class dir
45class fd
46class lnk_file
47class chr_file
48class blk_file
49class sock_file
50class fifo_file
51
52# network-related classes
53class socket
54class tcp_socket
55class udp_socket
56class rawip_socket
57class node
58class netif
59class netlink_socket
60class packet_socket
61class key_socket
62class unix_stream_socket
63class unix_dgram_socket
64
65# sysv-ipc-related classes
66class sem
67class msg
68class msgq
69class shm
70class ipc
71
72# extended netlink sockets
73class netlink_route_socket
74class netlink_tcpdiag_socket
75class netlink_nflog_socket
76class netlink_xfrm_socket
77class netlink_selinux_socket
78class netlink_audit_socket
79class netlink_dnrt_socket
80
81# IPSec association
82class association
83
84# Updated Netlink class for KOBJECT_UEVENT family.
85class netlink_kobject_uevent_socket
86
87class appletalk_socket
88
89class packet
90
91# Kernel access key retention
92class key
93
94class dccp_socket
95
96class memprotect
97
98# network peer labels
99class peer
100
101# Capabilities >= 32
102class capability2
103
104# kernel services that need to override task security, e.g. cachefiles
105class kernel_service
106
107class tun_socket
108
109class binder
110
111# Updated netlink classes for more recent netlink protocols.
112class netlink_iscsi_socket
113class netlink_fib_lookup_socket
114class netlink_connector_socket
115class netlink_netfilter_socket
116class netlink_generic_socket
117class netlink_scsitransport_socket
118class netlink_rdma_socket
119class netlink_crypto_socket
120
121# Infiniband
122class infiniband_pkey
123class infiniband_endport
124
125# Capability checks when on a non-init user namespace
126class cap_userns
127class cap2_userns
128
129# New socket classes introduced by extended_socket_class policy capability.
130# These two were previously mapped to rawip_socket.
131class sctp_socket
132class icmp_socket
133# These were previously mapped to socket.
134class ax25_socket
135class ipx_socket
136class netrom_socket
137class atmpvc_socket
138class x25_socket
139class rose_socket
140class decnet_socket
141class atmsvc_socket
142class rds_socket
143class irda_socket
144class pppox_socket
145class llc_socket
146class can_socket
147class tipc_socket
148class bluetooth_socket
149class iucv_socket
150class rxrpc_socket
151class isdn_socket
152class phonet_socket
153class ieee802154_socket
154class caif_socket
155class alg_socket
156class nfc_socket
157class vsock_socket
158class kcm_socket
159class qipcrtr_socket
160class smc_socket
161class xdp_socket
162class mctp_socket
163
164class process2
165
166class bpf
167
168class perf_event
169
170class io_uring
171
172# Introduced in https://github.com/torvalds/linux/commit/59438b46471ae6cdfb761afc8c9beaf1e428a331
173class lockdown
174
175class user_namespace
176
177# Property service
178class property_service          # userspace
179
180# Service manager
181class service_manager           # userspace
182
183# hardware service manager      # userspace
184class hwservice_manager
185
186# Legacy Keystore key permissions
187class keystore_key              # userspace
188
189# Keystore 2.0 permissions
190class keystore2                 # userspace
191
192# Keystore 2.0 key permissions
193class keystore2_key             # userspace
194
195# Diced permissions
196class diced                     # userspace
197
198class drmservice                # userspace
199# FLASK
200
201# Permissions for VMs to access SMC services
202class tee_service            		# userspace
203#line 1 "system/sepolicy/reqd_mask/initial_sids"
204sid reqd_mask
205
206# FLASK
207#line 1 "system/sepolicy/reqd_mask/access_vectors"
208#
209# Define common prefixes for access vectors
210#
211# common common_name { permission_name ... }
212
213
214#
215# Define a common prefix for file access vectors.
216#
217
218common file
219{
220	ioctl
221	read
222	write
223	create
224	getattr
225	setattr
226	lock
227	relabelfrom
228	relabelto
229	append
230	map
231	unlink
232	link
233	rename
234	execute
235	quotaon
236	mounton
237	audit_access
238	open
239	execmod
240	watch
241	watch_mount
242	watch_sb
243	watch_with_perm
244	watch_reads
245}
246
247
248#
249# Define a common prefix for socket access vectors.
250#
251
252common socket
253{
254# inherited from file
255	ioctl
256	read
257	write
258	create
259	getattr
260	setattr
261	lock
262	relabelfrom
263	relabelto
264	append
265	map
266# socket-specific
267	bind
268	connect
269	listen
270	accept
271	getopt
272	setopt
273	shutdown
274	recvfrom
275	sendto
276	name_bind
277}
278
279#
280# Define a common prefix for ipc access vectors.
281#
282
283common ipc
284{
285	create
286	destroy
287	getattr
288	setattr
289	read
290	write
291	associate
292	unix_read
293	unix_write
294}
295
296#
297# Define a common for capability access vectors.
298#
299common cap
300{
301	# The capabilities are defined in include/linux/capability.h
302	# Capabilities >= 32 are defined in the cap2 common.
303	# Care should be taken to ensure that these are consistent with
304	# those definitions. (Order matters)
305
306	chown
307	dac_override
308	dac_read_search
309	fowner
310	fsetid
311	kill
312	setgid
313	setuid
314	setpcap
315	linux_immutable
316	net_bind_service
317	net_broadcast
318	net_admin
319	net_raw
320	ipc_lock
321	ipc_owner
322	sys_module
323	sys_rawio
324	sys_chroot
325	sys_ptrace
326	sys_pacct
327	sys_admin
328	sys_boot
329	sys_nice
330	sys_resource
331	sys_time
332	sys_tty_config
333	mknod
334	lease
335	audit_write
336	audit_control
337	setfcap
338}
339
340common cap2
341{
342	mac_override	# unused by SELinux
343	mac_admin
344	syslog
345	wake_alarm
346	block_suspend
347	audit_read
348	perfmon
349
350
351}
352
353#
354# Define the access vectors.
355#
356# class class_name [ inherits common_name ] { permission_name ... }
357
358
359#
360# Define the access vector interpretation for file-related objects.
361#
362
363class filesystem
364{
365	mount
366	remount
367	unmount
368	getattr
369	relabelfrom
370	relabelto
371	associate
372	quotamod
373	quotaget
374	watch
375}
376
377class dir
378inherits file
379{
380	add_name
381	remove_name
382	reparent
383	search
384	rmdir
385}
386
387class file
388inherits file
389{
390	execute_no_trans
391	entrypoint
392}
393
394class anon_inode
395inherits file
396
397class lnk_file
398inherits file
399
400class chr_file
401inherits file
402{
403	execute_no_trans
404	entrypoint
405}
406
407class blk_file
408inherits file
409
410class sock_file
411inherits file
412
413class fifo_file
414inherits file
415
416class fd
417{
418	use
419}
420
421
422#
423# Define the access vector interpretation for network-related objects.
424#
425
426class socket
427inherits socket
428
429class tcp_socket
430inherits socket
431{
432	node_bind
433	name_connect
434}
435
436class udp_socket
437inherits socket
438{
439	node_bind
440}
441
442class rawip_socket
443inherits socket
444{
445	node_bind
446}
447
448class node
449{
450	recvfrom
451	sendto
452}
453
454class netif
455{
456	ingress
457	egress
458}
459
460class netlink_socket
461inherits socket
462
463class packet_socket
464inherits socket
465
466class key_socket
467inherits socket
468
469class unix_stream_socket
470inherits socket
471{
472	connectto
473}
474
475class unix_dgram_socket
476inherits socket
477
478#
479# Define the access vector interpretation for process-related objects
480#
481
482class process
483{
484	fork
485	transition
486	sigchld # commonly granted from child to parent
487	sigkill # cannot be caught or ignored
488	sigstop # cannot be caught or ignored
489	signull # for kill(pid, 0)
490	signal  # all other signals
491	ptrace
492	getsched
493	setsched
494	getsession
495	getpgid
496	setpgid
497	getcap
498	setcap
499	share
500	getattr
501	setexec
502	setfscreate
503	noatsecure
504	siginh
505	setrlimit
506	rlimitinh
507	dyntransition
508	setcurrent
509	execmem
510	execstack
511	execheap
512	setkeycreate
513	setsockcreate
514	getrlimit
515}
516
517class process2
518{
519	nnp_transition
520	nosuid_transition
521}
522
523#
524# Define the access vector interpretation for ipc-related objects
525#
526
527class ipc
528inherits ipc
529
530class sem
531inherits ipc
532
533class msgq
534inherits ipc
535{
536	enqueue
537}
538
539class msg
540{
541	send
542	receive
543}
544
545class shm
546inherits ipc
547{
548	lock
549}
550
551
552#
553# Define the access vector interpretation for the security server.
554#
555
556class security
557{
558	compute_av
559	compute_create
560	compute_member
561	check_context
562	load_policy
563	compute_relabel
564	compute_user
565	setenforce     # was avc_toggle in system class
566	setbool
567	setsecparam
568	setcheckreqprot
569	read_policy
570	validate_trans
571}
572
573
574#
575# Define the access vector interpretation for system operations.
576#
577
578class system
579{
580	ipc_info
581	syslog_read
582	syslog_mod
583	syslog_console
584	module_request
585	module_load
586}
587
588#
589# Define the access vector interpretation for controlling capabilities
590#
591
592class capability
593inherits cap
594
595class capability2
596inherits cap2
597
598#
599# Extended Netlink classes
600#
601class netlink_route_socket
602inherits socket
603{
604	nlmsg_read
605	nlmsg_write
606	nlmsg_readpriv
607	nlmsg_getneigh
608}
609
610class netlink_tcpdiag_socket
611inherits socket
612{
613	nlmsg_read
614	nlmsg_write
615}
616
617class netlink_nflog_socket
618inherits socket
619
620class netlink_xfrm_socket
621inherits socket
622{
623	nlmsg_read
624	nlmsg_write
625}
626
627class netlink_selinux_socket
628inherits socket
629
630class netlink_audit_socket
631inherits socket
632{
633	nlmsg_read
634	nlmsg_write
635	nlmsg_relay
636	nlmsg_readpriv
637	nlmsg_tty_audit
638}
639
640class netlink_dnrt_socket
641inherits socket
642
643# Define the access vector interpretation for controlling
644# access to IPSec network data by association
645#
646class association
647{
648	sendto
649	recvfrom
650	setcontext
651	polmatch
652}
653
654# Updated Netlink class for KOBJECT_UEVENT family.
655class netlink_kobject_uevent_socket
656inherits socket
657
658class appletalk_socket
659inherits socket
660
661class packet
662{
663	send
664	recv
665	relabelto
666	forward_in
667	forward_out
668}
669
670class key
671{
672	view
673	read
674	write
675	search
676	link
677	setattr
678	create
679}
680
681class dccp_socket
682inherits socket
683{
684	node_bind
685	name_connect
686}
687
688class memprotect
689{
690	mmap_zero
691}
692
693# network peer labels
694class peer
695{
696	recv
697}
698
699class kernel_service
700{
701	use_as_override
702	create_files_as
703}
704
705class tun_socket
706inherits socket
707{
708	attach_queue
709}
710
711class binder
712{
713	impersonate
714	call
715	set_context_mgr
716	transfer
717}
718
719class netlink_iscsi_socket
720inherits socket
721
722class netlink_fib_lookup_socket
723inherits socket
724
725class netlink_connector_socket
726inherits socket
727
728class netlink_netfilter_socket
729inherits socket
730
731class netlink_generic_socket
732inherits socket
733
734class netlink_scsitransport_socket
735inherits socket
736
737class netlink_rdma_socket
738inherits socket
739
740class netlink_crypto_socket
741inherits socket
742
743class infiniband_pkey
744{
745	access
746}
747
748class infiniband_endport
749{
750	manage_subnet
751}
752
753#
754# Define the access vector interpretation for controlling capabilities
755# in user namespaces
756#
757
758class cap_userns
759inherits cap
760
761class cap2_userns
762inherits cap2
763
764
765#
766# Define the access vector interpretation for the new socket classes
767# enabled by the extended_socket_class policy capability.
768#
769
770#
771# The next two classes were previously mapped to rawip_socket and therefore
772# have the same definition as rawip_socket (until further permissions
773# are defined).
774#
775class sctp_socket
776inherits socket
777{
778	node_bind
779	name_connect
780	association
781}
782
783class icmp_socket
784inherits socket
785{
786	node_bind
787}
788
789#
790# The remaining network socket classes were previously
791# mapped to the socket class and therefore have the
792# same definition as socket.
793#
794
795class ax25_socket
796inherits socket
797
798class ipx_socket
799inherits socket
800
801class netrom_socket
802inherits socket
803
804class atmpvc_socket
805inherits socket
806
807class x25_socket
808inherits socket
809
810class rose_socket
811inherits socket
812
813class decnet_socket
814inherits socket
815
816class atmsvc_socket
817inherits socket
818
819class rds_socket
820inherits socket
821
822class irda_socket
823inherits socket
824
825class pppox_socket
826inherits socket
827
828class llc_socket
829inherits socket
830
831class can_socket
832inherits socket
833
834class tipc_socket
835inherits socket
836
837class bluetooth_socket
838inherits socket
839
840class iucv_socket
841inherits socket
842
843class rxrpc_socket
844inherits socket
845
846class isdn_socket
847inherits socket
848
849class phonet_socket
850inherits socket
851
852class ieee802154_socket
853inherits socket
854
855class caif_socket
856inherits socket
857
858class alg_socket
859inherits socket
860
861class nfc_socket
862inherits socket
863
864class vsock_socket
865inherits socket
866
867class kcm_socket
868inherits socket
869
870class qipcrtr_socket
871inherits socket
872
873class smc_socket
874inherits socket
875
876class xdp_socket
877inherits socket
878
879class mctp_socket
880inherits socket
881
882class bpf
883{
884	map_create
885	map_read
886	map_write
887	prog_load
888	prog_run
889}
890
891class property_service
892{
893	set
894}
895
896class service_manager
897{
898	add
899	find
900	list
901}
902
903class hwservice_manager
904{
905	add
906	find
907	list
908}
909
910class keystore_key # No longer used
911{
912	get_state
913	get
914	insert
915	delete
916	exist
917	list
918	reset
919	password
920	lock
921	unlock
922	is_empty
923	sign
924	verify
925	grant
926	duplicate
927	clear_uid
928	add_auth
929	user_changed
930	gen_unique_id
931}
932
933class keystore2
934{
935	add_auth
936	change_password
937	change_user
938	clear_ns
939	clear_uid
940	delete_all_keys
941	early_boot_ended
942	get_attestation_key
943	get_auth_token
944	get_last_auth_time
945	get_state # No longer used
946	list
947	lock
948	pull_metrics
949	report_off_body # No longer used
950	reset
951	unlock
952}
953
954class keystore2_key
955{
956	convert_storage_key_to_ephemeral
957	delete
958	gen_unique_id
959	get_info
960	grant
961	manage_blob
962	rebind
963	req_forced_op
964	update
965	use
966	use_dev_id
967}
968
969class diced
970{
971	demote
972	demote_self
973	derive
974	get_attestation_chain
975	use_seal
976	use_sign
977}
978
979class drmservice {
980	consumeRights
981	setPlaybackStatus
982	openDecryptSession
983	closeDecryptSession
984	initializeDecryptUnit
985	decrypt
986	finalizeDecryptUnit
987	pread
988}
989
990class perf_event
991{
992	open
993	cpu
994	kernel
995	tracepoint
996	read
997	write
998}
999
1000class lockdown
1001{
1002	integrity
1003	confidentiality
1004}
1005
1006class io_uring
1007{
1008	override_creds
1009	sqpoll
1010	cmd
1011}
1012
1013class user_namespace
1014{
1015	create
1016}
1017
1018class tee_service
1019{
1020	use
1021}
1022#line 1 "system/sepolicy/prebuilts/api/29.0/public/global_macros"
1023#####################################
1024# Common groupings of object classes.
1025#
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043#####################################
1044# Common groupings of permissions.
1045#
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066#####################################
1067# Common socket permission sets.
1068
1069
1070
1071
1072
1073
1074#line 1 "system/sepolicy/prebuilts/api/29.0/public/neverallow_macros"
1075#
1076# Common neverallow permissions
1077
1078
1079
1080
1081
1082#####################################
1083# neverallow_establish_socket_comms(src, dst)
1084# neverallow src domain establishing socket connections to dst domain.
1085#
1086#line 15
1087
1088#line 1 "system/sepolicy/reqd_mask/mls_macros"
1089########################################
1090#
1091# gen_cats(N)
1092#
1093# declares categores c0 to c(N-1)
1094#
1095#line 10
1096
1097
1098
1099
1100########################################
1101#
1102# gen_sens(N)
1103#
1104# declares sensitivites s0 to s(N-1) with dominance
1105# in increasing numeric order with s0 lowest, s(N-1) highest
1106#
1107#line 24
1108
1109
1110
1111
1112#line 34
1113
1114
1115########################################
1116#
1117# gen_levels(N,M)
1118#
1119# levels from s0 to (N-1) with categories c0 to (M-1)
1120#
1121#line 45
1122
1123
1124
1125
1126########################################
1127#
1128# Basic level names for system low and high
1129#
1130
1131
1132#line 1 "system/sepolicy/reqd_mask/mls_decl"
1133#########################################
1134# MLS declarations
1135#
1136
1137# Generate the desired number of sensitivities and categories.
1138
1139#line 6
1140# Each sensitivity has a name and zero or more aliases.
1141#line 6
1142sensitivity s0;
1143#line 6
1144
1145#line 6
1146
1147#line 6
1148# Define the ordering of the sensitivity levels (least to greatest)
1149#line 6
1150dominance { s0  }
1151#line 6
1152
1153category c0;
1154#line 7
1155category c1;
1156#line 7
1157category c2;
1158#line 7
1159category c3;
1160#line 7
1161category c4;
1162#line 7
1163category c5;
1164#line 7
1165category c6;
1166#line 7
1167category c7;
1168#line 7
1169category c8;
1170#line 7
1171category c9;
1172#line 7
1173category c10;
1174#line 7
1175category c11;
1176#line 7
1177category c12;
1178#line 7
1179category c13;
1180#line 7
1181category c14;
1182#line 7
1183category c15;
1184#line 7
1185category c16;
1186#line 7
1187category c17;
1188#line 7
1189category c18;
1190#line 7
1191category c19;
1192#line 7
1193category c20;
1194#line 7
1195category c21;
1196#line 7
1197category c22;
1198#line 7
1199category c23;
1200#line 7
1201category c24;
1202#line 7
1203category c25;
1204#line 7
1205category c26;
1206#line 7
1207category c27;
1208#line 7
1209category c28;
1210#line 7
1211category c29;
1212#line 7
1213category c30;
1214#line 7
1215category c31;
1216#line 7
1217category c32;
1218#line 7
1219category c33;
1220#line 7
1221category c34;
1222#line 7
1223category c35;
1224#line 7
1225category c36;
1226#line 7
1227category c37;
1228#line 7
1229category c38;
1230#line 7
1231category c39;
1232#line 7
1233category c40;
1234#line 7
1235category c41;
1236#line 7
1237category c42;
1238#line 7
1239category c43;
1240#line 7
1241category c44;
1242#line 7
1243category c45;
1244#line 7
1245category c46;
1246#line 7
1247category c47;
1248#line 7
1249category c48;
1250#line 7
1251category c49;
1252#line 7
1253category c50;
1254#line 7
1255category c51;
1256#line 7
1257category c52;
1258#line 7
1259category c53;
1260#line 7
1261category c54;
1262#line 7
1263category c55;
1264#line 7
1265category c56;
1266#line 7
1267category c57;
1268#line 7
1269category c58;
1270#line 7
1271category c59;
1272#line 7
1273category c60;
1274#line 7
1275category c61;
1276#line 7
1277category c62;
1278#line 7
1279category c63;
1280#line 7
1281category c64;
1282#line 7
1283category c65;
1284#line 7
1285category c66;
1286#line 7
1287category c67;
1288#line 7
1289category c68;
1290#line 7
1291category c69;
1292#line 7
1293category c70;
1294#line 7
1295category c71;
1296#line 7
1297category c72;
1298#line 7
1299category c73;
1300#line 7
1301category c74;
1302#line 7
1303category c75;
1304#line 7
1305category c76;
1306#line 7
1307category c77;
1308#line 7
1309category c78;
1310#line 7
1311category c79;
1312#line 7
1313category c80;
1314#line 7
1315category c81;
1316#line 7
1317category c82;
1318#line 7
1319category c83;
1320#line 7
1321category c84;
1322#line 7
1323category c85;
1324#line 7
1325category c86;
1326#line 7
1327category c87;
1328#line 7
1329category c88;
1330#line 7
1331category c89;
1332#line 7
1333category c90;
1334#line 7
1335category c91;
1336#line 7
1337category c92;
1338#line 7
1339category c93;
1340#line 7
1341category c94;
1342#line 7
1343category c95;
1344#line 7
1345category c96;
1346#line 7
1347category c97;
1348#line 7
1349category c98;
1350#line 7
1351category c99;
1352#line 7
1353category c100;
1354#line 7
1355category c101;
1356#line 7
1357category c102;
1358#line 7
1359category c103;
1360#line 7
1361category c104;
1362#line 7
1363category c105;
1364#line 7
1365category c106;
1366#line 7
1367category c107;
1368#line 7
1369category c108;
1370#line 7
1371category c109;
1372#line 7
1373category c110;
1374#line 7
1375category c111;
1376#line 7
1377category c112;
1378#line 7
1379category c113;
1380#line 7
1381category c114;
1382#line 7
1383category c115;
1384#line 7
1385category c116;
1386#line 7
1387category c117;
1388#line 7
1389category c118;
1390#line 7
1391category c119;
1392#line 7
1393category c120;
1394#line 7
1395category c121;
1396#line 7
1397category c122;
1398#line 7
1399category c123;
1400#line 7
1401category c124;
1402#line 7
1403category c125;
1404#line 7
1405category c126;
1406#line 7
1407category c127;
1408#line 7
1409category c128;
1410#line 7
1411category c129;
1412#line 7
1413category c130;
1414#line 7
1415category c131;
1416#line 7
1417category c132;
1418#line 7
1419category c133;
1420#line 7
1421category c134;
1422#line 7
1423category c135;
1424#line 7
1425category c136;
1426#line 7
1427category c137;
1428#line 7
1429category c138;
1430#line 7
1431category c139;
1432#line 7
1433category c140;
1434#line 7
1435category c141;
1436#line 7
1437category c142;
1438#line 7
1439category c143;
1440#line 7
1441category c144;
1442#line 7
1443category c145;
1444#line 7
1445category c146;
1446#line 7
1447category c147;
1448#line 7
1449category c148;
1450#line 7
1451category c149;
1452#line 7
1453category c150;
1454#line 7
1455category c151;
1456#line 7
1457category c152;
1458#line 7
1459category c153;
1460#line 7
1461category c154;
1462#line 7
1463category c155;
1464#line 7
1465category c156;
1466#line 7
1467category c157;
1468#line 7
1469category c158;
1470#line 7
1471category c159;
1472#line 7
1473category c160;
1474#line 7
1475category c161;
1476#line 7
1477category c162;
1478#line 7
1479category c163;
1480#line 7
1481category c164;
1482#line 7
1483category c165;
1484#line 7
1485category c166;
1486#line 7
1487category c167;
1488#line 7
1489category c168;
1490#line 7
1491category c169;
1492#line 7
1493category c170;
1494#line 7
1495category c171;
1496#line 7
1497category c172;
1498#line 7
1499category c173;
1500#line 7
1501category c174;
1502#line 7
1503category c175;
1504#line 7
1505category c176;
1506#line 7
1507category c177;
1508#line 7
1509category c178;
1510#line 7
1511category c179;
1512#line 7
1513category c180;
1514#line 7
1515category c181;
1516#line 7
1517category c182;
1518#line 7
1519category c183;
1520#line 7
1521category c184;
1522#line 7
1523category c185;
1524#line 7
1525category c186;
1526#line 7
1527category c187;
1528#line 7
1529category c188;
1530#line 7
1531category c189;
1532#line 7
1533category c190;
1534#line 7
1535category c191;
1536#line 7
1537category c192;
1538#line 7
1539category c193;
1540#line 7
1541category c194;
1542#line 7
1543category c195;
1544#line 7
1545category c196;
1546#line 7
1547category c197;
1548#line 7
1549category c198;
1550#line 7
1551category c199;
1552#line 7
1553category c200;
1554#line 7
1555category c201;
1556#line 7
1557category c202;
1558#line 7
1559category c203;
1560#line 7
1561category c204;
1562#line 7
1563category c205;
1564#line 7
1565category c206;
1566#line 7
1567category c207;
1568#line 7
1569category c208;
1570#line 7
1571category c209;
1572#line 7
1573category c210;
1574#line 7
1575category c211;
1576#line 7
1577category c212;
1578#line 7
1579category c213;
1580#line 7
1581category c214;
1582#line 7
1583category c215;
1584#line 7
1585category c216;
1586#line 7
1587category c217;
1588#line 7
1589category c218;
1590#line 7
1591category c219;
1592#line 7
1593category c220;
1594#line 7
1595category c221;
1596#line 7
1597category c222;
1598#line 7
1599category c223;
1600#line 7
1601category c224;
1602#line 7
1603category c225;
1604#line 7
1605category c226;
1606#line 7
1607category c227;
1608#line 7
1609category c228;
1610#line 7
1611category c229;
1612#line 7
1613category c230;
1614#line 7
1615category c231;
1616#line 7
1617category c232;
1618#line 7
1619category c233;
1620#line 7
1621category c234;
1622#line 7
1623category c235;
1624#line 7
1625category c236;
1626#line 7
1627category c237;
1628#line 7
1629category c238;
1630#line 7
1631category c239;
1632#line 7
1633category c240;
1634#line 7
1635category c241;
1636#line 7
1637category c242;
1638#line 7
1639category c243;
1640#line 7
1641category c244;
1642#line 7
1643category c245;
1644#line 7
1645category c246;
1646#line 7
1647category c247;
1648#line 7
1649category c248;
1650#line 7
1651category c249;
1652#line 7
1653category c250;
1654#line 7
1655category c251;
1656#line 7
1657category c252;
1658#line 7
1659category c253;
1660#line 7
1661category c254;
1662#line 7
1663category c255;
1664#line 7
1665category c256;
1666#line 7
1667category c257;
1668#line 7
1669category c258;
1670#line 7
1671category c259;
1672#line 7
1673category c260;
1674#line 7
1675category c261;
1676#line 7
1677category c262;
1678#line 7
1679category c263;
1680#line 7
1681category c264;
1682#line 7
1683category c265;
1684#line 7
1685category c266;
1686#line 7
1687category c267;
1688#line 7
1689category c268;
1690#line 7
1691category c269;
1692#line 7
1693category c270;
1694#line 7
1695category c271;
1696#line 7
1697category c272;
1698#line 7
1699category c273;
1700#line 7
1701category c274;
1702#line 7
1703category c275;
1704#line 7
1705category c276;
1706#line 7
1707category c277;
1708#line 7
1709category c278;
1710#line 7
1711category c279;
1712#line 7
1713category c280;
1714#line 7
1715category c281;
1716#line 7
1717category c282;
1718#line 7
1719category c283;
1720#line 7
1721category c284;
1722#line 7
1723category c285;
1724#line 7
1725category c286;
1726#line 7
1727category c287;
1728#line 7
1729category c288;
1730#line 7
1731category c289;
1732#line 7
1733category c290;
1734#line 7
1735category c291;
1736#line 7
1737category c292;
1738#line 7
1739category c293;
1740#line 7
1741category c294;
1742#line 7
1743category c295;
1744#line 7
1745category c296;
1746#line 7
1747category c297;
1748#line 7
1749category c298;
1750#line 7
1751category c299;
1752#line 7
1753category c300;
1754#line 7
1755category c301;
1756#line 7
1757category c302;
1758#line 7
1759category c303;
1760#line 7
1761category c304;
1762#line 7
1763category c305;
1764#line 7
1765category c306;
1766#line 7
1767category c307;
1768#line 7
1769category c308;
1770#line 7
1771category c309;
1772#line 7
1773category c310;
1774#line 7
1775category c311;
1776#line 7
1777category c312;
1778#line 7
1779category c313;
1780#line 7
1781category c314;
1782#line 7
1783category c315;
1784#line 7
1785category c316;
1786#line 7
1787category c317;
1788#line 7
1789category c318;
1790#line 7
1791category c319;
1792#line 7
1793category c320;
1794#line 7
1795category c321;
1796#line 7
1797category c322;
1798#line 7
1799category c323;
1800#line 7
1801category c324;
1802#line 7
1803category c325;
1804#line 7
1805category c326;
1806#line 7
1807category c327;
1808#line 7
1809category c328;
1810#line 7
1811category c329;
1812#line 7
1813category c330;
1814#line 7
1815category c331;
1816#line 7
1817category c332;
1818#line 7
1819category c333;
1820#line 7
1821category c334;
1822#line 7
1823category c335;
1824#line 7
1825category c336;
1826#line 7
1827category c337;
1828#line 7
1829category c338;
1830#line 7
1831category c339;
1832#line 7
1833category c340;
1834#line 7
1835category c341;
1836#line 7
1837category c342;
1838#line 7
1839category c343;
1840#line 7
1841category c344;
1842#line 7
1843category c345;
1844#line 7
1845category c346;
1846#line 7
1847category c347;
1848#line 7
1849category c348;
1850#line 7
1851category c349;
1852#line 7
1853category c350;
1854#line 7
1855category c351;
1856#line 7
1857category c352;
1858#line 7
1859category c353;
1860#line 7
1861category c354;
1862#line 7
1863category c355;
1864#line 7
1865category c356;
1866#line 7
1867category c357;
1868#line 7
1869category c358;
1870#line 7
1871category c359;
1872#line 7
1873category c360;
1874#line 7
1875category c361;
1876#line 7
1877category c362;
1878#line 7
1879category c363;
1880#line 7
1881category c364;
1882#line 7
1883category c365;
1884#line 7
1885category c366;
1886#line 7
1887category c367;
1888#line 7
1889category c368;
1890#line 7
1891category c369;
1892#line 7
1893category c370;
1894#line 7
1895category c371;
1896#line 7
1897category c372;
1898#line 7
1899category c373;
1900#line 7
1901category c374;
1902#line 7
1903category c375;
1904#line 7
1905category c376;
1906#line 7
1907category c377;
1908#line 7
1909category c378;
1910#line 7
1911category c379;
1912#line 7
1913category c380;
1914#line 7
1915category c381;
1916#line 7
1917category c382;
1918#line 7
1919category c383;
1920#line 7
1921category c384;
1922#line 7
1923category c385;
1924#line 7
1925category c386;
1926#line 7
1927category c387;
1928#line 7
1929category c388;
1930#line 7
1931category c389;
1932#line 7
1933category c390;
1934#line 7
1935category c391;
1936#line 7
1937category c392;
1938#line 7
1939category c393;
1940#line 7
1941category c394;
1942#line 7
1943category c395;
1944#line 7
1945category c396;
1946#line 7
1947category c397;
1948#line 7
1949category c398;
1950#line 7
1951category c399;
1952#line 7
1953category c400;
1954#line 7
1955category c401;
1956#line 7
1957category c402;
1958#line 7
1959category c403;
1960#line 7
1961category c404;
1962#line 7
1963category c405;
1964#line 7
1965category c406;
1966#line 7
1967category c407;
1968#line 7
1969category c408;
1970#line 7
1971category c409;
1972#line 7
1973category c410;
1974#line 7
1975category c411;
1976#line 7
1977category c412;
1978#line 7
1979category c413;
1980#line 7
1981category c414;
1982#line 7
1983category c415;
1984#line 7
1985category c416;
1986#line 7
1987category c417;
1988#line 7
1989category c418;
1990#line 7
1991category c419;
1992#line 7
1993category c420;
1994#line 7
1995category c421;
1996#line 7
1997category c422;
1998#line 7
1999category c423;
2000#line 7
2001category c424;
2002#line 7
2003category c425;
2004#line 7
2005category c426;
2006#line 7
2007category c427;
2008#line 7
2009category c428;
2010#line 7
2011category c429;
2012#line 7
2013category c430;
2014#line 7
2015category c431;
2016#line 7
2017category c432;
2018#line 7
2019category c433;
2020#line 7
2021category c434;
2022#line 7
2023category c435;
2024#line 7
2025category c436;
2026#line 7
2027category c437;
2028#line 7
2029category c438;
2030#line 7
2031category c439;
2032#line 7
2033category c440;
2034#line 7
2035category c441;
2036#line 7
2037category c442;
2038#line 7
2039category c443;
2040#line 7
2041category c444;
2042#line 7
2043category c445;
2044#line 7
2045category c446;
2046#line 7
2047category c447;
2048#line 7
2049category c448;
2050#line 7
2051category c449;
2052#line 7
2053category c450;
2054#line 7
2055category c451;
2056#line 7
2057category c452;
2058#line 7
2059category c453;
2060#line 7
2061category c454;
2062#line 7
2063category c455;
2064#line 7
2065category c456;
2066#line 7
2067category c457;
2068#line 7
2069category c458;
2070#line 7
2071category c459;
2072#line 7
2073category c460;
2074#line 7
2075category c461;
2076#line 7
2077category c462;
2078#line 7
2079category c463;
2080#line 7
2081category c464;
2082#line 7
2083category c465;
2084#line 7
2085category c466;
2086#line 7
2087category c467;
2088#line 7
2089category c468;
2090#line 7
2091category c469;
2092#line 7
2093category c470;
2094#line 7
2095category c471;
2096#line 7
2097category c472;
2098#line 7
2099category c473;
2100#line 7
2101category c474;
2102#line 7
2103category c475;
2104#line 7
2105category c476;
2106#line 7
2107category c477;
2108#line 7
2109category c478;
2110#line 7
2111category c479;
2112#line 7
2113category c480;
2114#line 7
2115category c481;
2116#line 7
2117category c482;
2118#line 7
2119category c483;
2120#line 7
2121category c484;
2122#line 7
2123category c485;
2124#line 7
2125category c486;
2126#line 7
2127category c487;
2128#line 7
2129category c488;
2130#line 7
2131category c489;
2132#line 7
2133category c490;
2134#line 7
2135category c491;
2136#line 7
2137category c492;
2138#line 7
2139category c493;
2140#line 7
2141category c494;
2142#line 7
2143category c495;
2144#line 7
2145category c496;
2146#line 7
2147category c497;
2148#line 7
2149category c498;
2150#line 7
2151category c499;
2152#line 7
2153category c500;
2154#line 7
2155category c501;
2156#line 7
2157category c502;
2158#line 7
2159category c503;
2160#line 7
2161category c504;
2162#line 7
2163category c505;
2164#line 7
2165category c506;
2166#line 7
2167category c507;
2168#line 7
2169category c508;
2170#line 7
2171category c509;
2172#line 7
2173category c510;
2174#line 7
2175category c511;
2176#line 7
2177category c512;
2178#line 7
2179category c513;
2180#line 7
2181category c514;
2182#line 7
2183category c515;
2184#line 7
2185category c516;
2186#line 7
2187category c517;
2188#line 7
2189category c518;
2190#line 7
2191category c519;
2192#line 7
2193category c520;
2194#line 7
2195category c521;
2196#line 7
2197category c522;
2198#line 7
2199category c523;
2200#line 7
2201category c524;
2202#line 7
2203category c525;
2204#line 7
2205category c526;
2206#line 7
2207category c527;
2208#line 7
2209category c528;
2210#line 7
2211category c529;
2212#line 7
2213category c530;
2214#line 7
2215category c531;
2216#line 7
2217category c532;
2218#line 7
2219category c533;
2220#line 7
2221category c534;
2222#line 7
2223category c535;
2224#line 7
2225category c536;
2226#line 7
2227category c537;
2228#line 7
2229category c538;
2230#line 7
2231category c539;
2232#line 7
2233category c540;
2234#line 7
2235category c541;
2236#line 7
2237category c542;
2238#line 7
2239category c543;
2240#line 7
2241category c544;
2242#line 7
2243category c545;
2244#line 7
2245category c546;
2246#line 7
2247category c547;
2248#line 7
2249category c548;
2250#line 7
2251category c549;
2252#line 7
2253category c550;
2254#line 7
2255category c551;
2256#line 7
2257category c552;
2258#line 7
2259category c553;
2260#line 7
2261category c554;
2262#line 7
2263category c555;
2264#line 7
2265category c556;
2266#line 7
2267category c557;
2268#line 7
2269category c558;
2270#line 7
2271category c559;
2272#line 7
2273category c560;
2274#line 7
2275category c561;
2276#line 7
2277category c562;
2278#line 7
2279category c563;
2280#line 7
2281category c564;
2282#line 7
2283category c565;
2284#line 7
2285category c566;
2286#line 7
2287category c567;
2288#line 7
2289category c568;
2290#line 7
2291category c569;
2292#line 7
2293category c570;
2294#line 7
2295category c571;
2296#line 7
2297category c572;
2298#line 7
2299category c573;
2300#line 7
2301category c574;
2302#line 7
2303category c575;
2304#line 7
2305category c576;
2306#line 7
2307category c577;
2308#line 7
2309category c578;
2310#line 7
2311category c579;
2312#line 7
2313category c580;
2314#line 7
2315category c581;
2316#line 7
2317category c582;
2318#line 7
2319category c583;
2320#line 7
2321category c584;
2322#line 7
2323category c585;
2324#line 7
2325category c586;
2326#line 7
2327category c587;
2328#line 7
2329category c588;
2330#line 7
2331category c589;
2332#line 7
2333category c590;
2334#line 7
2335category c591;
2336#line 7
2337category c592;
2338#line 7
2339category c593;
2340#line 7
2341category c594;
2342#line 7
2343category c595;
2344#line 7
2345category c596;
2346#line 7
2347category c597;
2348#line 7
2349category c598;
2350#line 7
2351category c599;
2352#line 7
2353category c600;
2354#line 7
2355category c601;
2356#line 7
2357category c602;
2358#line 7
2359category c603;
2360#line 7
2361category c604;
2362#line 7
2363category c605;
2364#line 7
2365category c606;
2366#line 7
2367category c607;
2368#line 7
2369category c608;
2370#line 7
2371category c609;
2372#line 7
2373category c610;
2374#line 7
2375category c611;
2376#line 7
2377category c612;
2378#line 7
2379category c613;
2380#line 7
2381category c614;
2382#line 7
2383category c615;
2384#line 7
2385category c616;
2386#line 7
2387category c617;
2388#line 7
2389category c618;
2390#line 7
2391category c619;
2392#line 7
2393category c620;
2394#line 7
2395category c621;
2396#line 7
2397category c622;
2398#line 7
2399category c623;
2400#line 7
2401category c624;
2402#line 7
2403category c625;
2404#line 7
2405category c626;
2406#line 7
2407category c627;
2408#line 7
2409category c628;
2410#line 7
2411category c629;
2412#line 7
2413category c630;
2414#line 7
2415category c631;
2416#line 7
2417category c632;
2418#line 7
2419category c633;
2420#line 7
2421category c634;
2422#line 7
2423category c635;
2424#line 7
2425category c636;
2426#line 7
2427category c637;
2428#line 7
2429category c638;
2430#line 7
2431category c639;
2432#line 7
2433category c640;
2434#line 7
2435category c641;
2436#line 7
2437category c642;
2438#line 7
2439category c643;
2440#line 7
2441category c644;
2442#line 7
2443category c645;
2444#line 7
2445category c646;
2446#line 7
2447category c647;
2448#line 7
2449category c648;
2450#line 7
2451category c649;
2452#line 7
2453category c650;
2454#line 7
2455category c651;
2456#line 7
2457category c652;
2458#line 7
2459category c653;
2460#line 7
2461category c654;
2462#line 7
2463category c655;
2464#line 7
2465category c656;
2466#line 7
2467category c657;
2468#line 7
2469category c658;
2470#line 7
2471category c659;
2472#line 7
2473category c660;
2474#line 7
2475category c661;
2476#line 7
2477category c662;
2478#line 7
2479category c663;
2480#line 7
2481category c664;
2482#line 7
2483category c665;
2484#line 7
2485category c666;
2486#line 7
2487category c667;
2488#line 7
2489category c668;
2490#line 7
2491category c669;
2492#line 7
2493category c670;
2494#line 7
2495category c671;
2496#line 7
2497category c672;
2498#line 7
2499category c673;
2500#line 7
2501category c674;
2502#line 7
2503category c675;
2504#line 7
2505category c676;
2506#line 7
2507category c677;
2508#line 7
2509category c678;
2510#line 7
2511category c679;
2512#line 7
2513category c680;
2514#line 7
2515category c681;
2516#line 7
2517category c682;
2518#line 7
2519category c683;
2520#line 7
2521category c684;
2522#line 7
2523category c685;
2524#line 7
2525category c686;
2526#line 7
2527category c687;
2528#line 7
2529category c688;
2530#line 7
2531category c689;
2532#line 7
2533category c690;
2534#line 7
2535category c691;
2536#line 7
2537category c692;
2538#line 7
2539category c693;
2540#line 7
2541category c694;
2542#line 7
2543category c695;
2544#line 7
2545category c696;
2546#line 7
2547category c697;
2548#line 7
2549category c698;
2550#line 7
2551category c699;
2552#line 7
2553category c700;
2554#line 7
2555category c701;
2556#line 7
2557category c702;
2558#line 7
2559category c703;
2560#line 7
2561category c704;
2562#line 7
2563category c705;
2564#line 7
2565category c706;
2566#line 7
2567category c707;
2568#line 7
2569category c708;
2570#line 7
2571category c709;
2572#line 7
2573category c710;
2574#line 7
2575category c711;
2576#line 7
2577category c712;
2578#line 7
2579category c713;
2580#line 7
2581category c714;
2582#line 7
2583category c715;
2584#line 7
2585category c716;
2586#line 7
2587category c717;
2588#line 7
2589category c718;
2590#line 7
2591category c719;
2592#line 7
2593category c720;
2594#line 7
2595category c721;
2596#line 7
2597category c722;
2598#line 7
2599category c723;
2600#line 7
2601category c724;
2602#line 7
2603category c725;
2604#line 7
2605category c726;
2606#line 7
2607category c727;
2608#line 7
2609category c728;
2610#line 7
2611category c729;
2612#line 7
2613category c730;
2614#line 7
2615category c731;
2616#line 7
2617category c732;
2618#line 7
2619category c733;
2620#line 7
2621category c734;
2622#line 7
2623category c735;
2624#line 7
2625category c736;
2626#line 7
2627category c737;
2628#line 7
2629category c738;
2630#line 7
2631category c739;
2632#line 7
2633category c740;
2634#line 7
2635category c741;
2636#line 7
2637category c742;
2638#line 7
2639category c743;
2640#line 7
2641category c744;
2642#line 7
2643category c745;
2644#line 7
2645category c746;
2646#line 7
2647category c747;
2648#line 7
2649category c748;
2650#line 7
2651category c749;
2652#line 7
2653category c750;
2654#line 7
2655category c751;
2656#line 7
2657category c752;
2658#line 7
2659category c753;
2660#line 7
2661category c754;
2662#line 7
2663category c755;
2664#line 7
2665category c756;
2666#line 7
2667category c757;
2668#line 7
2669category c758;
2670#line 7
2671category c759;
2672#line 7
2673category c760;
2674#line 7
2675category c761;
2676#line 7
2677category c762;
2678#line 7
2679category c763;
2680#line 7
2681category c764;
2682#line 7
2683category c765;
2684#line 7
2685category c766;
2686#line 7
2687category c767;
2688#line 7
2689category c768;
2690#line 7
2691category c769;
2692#line 7
2693category c770;
2694#line 7
2695category c771;
2696#line 7
2697category c772;
2698#line 7
2699category c773;
2700#line 7
2701category c774;
2702#line 7
2703category c775;
2704#line 7
2705category c776;
2706#line 7
2707category c777;
2708#line 7
2709category c778;
2710#line 7
2711category c779;
2712#line 7
2713category c780;
2714#line 7
2715category c781;
2716#line 7
2717category c782;
2718#line 7
2719category c783;
2720#line 7
2721category c784;
2722#line 7
2723category c785;
2724#line 7
2725category c786;
2726#line 7
2727category c787;
2728#line 7
2729category c788;
2730#line 7
2731category c789;
2732#line 7
2733category c790;
2734#line 7
2735category c791;
2736#line 7
2737category c792;
2738#line 7
2739category c793;
2740#line 7
2741category c794;
2742#line 7
2743category c795;
2744#line 7
2745category c796;
2746#line 7
2747category c797;
2748#line 7
2749category c798;
2750#line 7
2751category c799;
2752#line 7
2753category c800;
2754#line 7
2755category c801;
2756#line 7
2757category c802;
2758#line 7
2759category c803;
2760#line 7
2761category c804;
2762#line 7
2763category c805;
2764#line 7
2765category c806;
2766#line 7
2767category c807;
2768#line 7
2769category c808;
2770#line 7
2771category c809;
2772#line 7
2773category c810;
2774#line 7
2775category c811;
2776#line 7
2777category c812;
2778#line 7
2779category c813;
2780#line 7
2781category c814;
2782#line 7
2783category c815;
2784#line 7
2785category c816;
2786#line 7
2787category c817;
2788#line 7
2789category c818;
2790#line 7
2791category c819;
2792#line 7
2793category c820;
2794#line 7
2795category c821;
2796#line 7
2797category c822;
2798#line 7
2799category c823;
2800#line 7
2801category c824;
2802#line 7
2803category c825;
2804#line 7
2805category c826;
2806#line 7
2807category c827;
2808#line 7
2809category c828;
2810#line 7
2811category c829;
2812#line 7
2813category c830;
2814#line 7
2815category c831;
2816#line 7
2817category c832;
2818#line 7
2819category c833;
2820#line 7
2821category c834;
2822#line 7
2823category c835;
2824#line 7
2825category c836;
2826#line 7
2827category c837;
2828#line 7
2829category c838;
2830#line 7
2831category c839;
2832#line 7
2833category c840;
2834#line 7
2835category c841;
2836#line 7
2837category c842;
2838#line 7
2839category c843;
2840#line 7
2841category c844;
2842#line 7
2843category c845;
2844#line 7
2845category c846;
2846#line 7
2847category c847;
2848#line 7
2849category c848;
2850#line 7
2851category c849;
2852#line 7
2853category c850;
2854#line 7
2855category c851;
2856#line 7
2857category c852;
2858#line 7
2859category c853;
2860#line 7
2861category c854;
2862#line 7
2863category c855;
2864#line 7
2865category c856;
2866#line 7
2867category c857;
2868#line 7
2869category c858;
2870#line 7
2871category c859;
2872#line 7
2873category c860;
2874#line 7
2875category c861;
2876#line 7
2877category c862;
2878#line 7
2879category c863;
2880#line 7
2881category c864;
2882#line 7
2883category c865;
2884#line 7
2885category c866;
2886#line 7
2887category c867;
2888#line 7
2889category c868;
2890#line 7
2891category c869;
2892#line 7
2893category c870;
2894#line 7
2895category c871;
2896#line 7
2897category c872;
2898#line 7
2899category c873;
2900#line 7
2901category c874;
2902#line 7
2903category c875;
2904#line 7
2905category c876;
2906#line 7
2907category c877;
2908#line 7
2909category c878;
2910#line 7
2911category c879;
2912#line 7
2913category c880;
2914#line 7
2915category c881;
2916#line 7
2917category c882;
2918#line 7
2919category c883;
2920#line 7
2921category c884;
2922#line 7
2923category c885;
2924#line 7
2925category c886;
2926#line 7
2927category c887;
2928#line 7
2929category c888;
2930#line 7
2931category c889;
2932#line 7
2933category c890;
2934#line 7
2935category c891;
2936#line 7
2937category c892;
2938#line 7
2939category c893;
2940#line 7
2941category c894;
2942#line 7
2943category c895;
2944#line 7
2945category c896;
2946#line 7
2947category c897;
2948#line 7
2949category c898;
2950#line 7
2951category c899;
2952#line 7
2953category c900;
2954#line 7
2955category c901;
2956#line 7
2957category c902;
2958#line 7
2959category c903;
2960#line 7
2961category c904;
2962#line 7
2963category c905;
2964#line 7
2965category c906;
2966#line 7
2967category c907;
2968#line 7
2969category c908;
2970#line 7
2971category c909;
2972#line 7
2973category c910;
2974#line 7
2975category c911;
2976#line 7
2977category c912;
2978#line 7
2979category c913;
2980#line 7
2981category c914;
2982#line 7
2983category c915;
2984#line 7
2985category c916;
2986#line 7
2987category c917;
2988#line 7
2989category c918;
2990#line 7
2991category c919;
2992#line 7
2993category c920;
2994#line 7
2995category c921;
2996#line 7
2997category c922;
2998#line 7
2999category c923;
3000#line 7
3001category c924;
3002#line 7
3003category c925;
3004#line 7
3005category c926;
3006#line 7
3007category c927;
3008#line 7
3009category c928;
3010#line 7
3011category c929;
3012#line 7
3013category c930;
3014#line 7
3015category c931;
3016#line 7
3017category c932;
3018#line 7
3019category c933;
3020#line 7
3021category c934;
3022#line 7
3023category c935;
3024#line 7
3025category c936;
3026#line 7
3027category c937;
3028#line 7
3029category c938;
3030#line 7
3031category c939;
3032#line 7
3033category c940;
3034#line 7
3035category c941;
3036#line 7
3037category c942;
3038#line 7
3039category c943;
3040#line 7
3041category c944;
3042#line 7
3043category c945;
3044#line 7
3045category c946;
3046#line 7
3047category c947;
3048#line 7
3049category c948;
3050#line 7
3051category c949;
3052#line 7
3053category c950;
3054#line 7
3055category c951;
3056#line 7
3057category c952;
3058#line 7
3059category c953;
3060#line 7
3061category c954;
3062#line 7
3063category c955;
3064#line 7
3065category c956;
3066#line 7
3067category c957;
3068#line 7
3069category c958;
3070#line 7
3071category c959;
3072#line 7
3073category c960;
3074#line 7
3075category c961;
3076#line 7
3077category c962;
3078#line 7
3079category c963;
3080#line 7
3081category c964;
3082#line 7
3083category c965;
3084#line 7
3085category c966;
3086#line 7
3087category c967;
3088#line 7
3089category c968;
3090#line 7
3091category c969;
3092#line 7
3093category c970;
3094#line 7
3095category c971;
3096#line 7
3097category c972;
3098#line 7
3099category c973;
3100#line 7
3101category c974;
3102#line 7
3103category c975;
3104#line 7
3105category c976;
3106#line 7
3107category c977;
3108#line 7
3109category c978;
3110#line 7
3111category c979;
3112#line 7
3113category c980;
3114#line 7
3115category c981;
3116#line 7
3117category c982;
3118#line 7
3119category c983;
3120#line 7
3121category c984;
3122#line 7
3123category c985;
3124#line 7
3125category c986;
3126#line 7
3127category c987;
3128#line 7
3129category c988;
3130#line 7
3131category c989;
3132#line 7
3133category c990;
3134#line 7
3135category c991;
3136#line 7
3137category c992;
3138#line 7
3139category c993;
3140#line 7
3141category c994;
3142#line 7
3143category c995;
3144#line 7
3145category c996;
3146#line 7
3147category c997;
3148#line 7
3149category c998;
3150#line 7
3151category c999;
3152#line 7
3153category c1000;
3154#line 7
3155category c1001;
3156#line 7
3157category c1002;
3158#line 7
3159category c1003;
3160#line 7
3161category c1004;
3162#line 7
3163category c1005;
3164#line 7
3165category c1006;
3166#line 7
3167category c1007;
3168#line 7
3169category c1008;
3170#line 7
3171category c1009;
3172#line 7
3173category c1010;
3174#line 7
3175category c1011;
3176#line 7
3177category c1012;
3178#line 7
3179category c1013;
3180#line 7
3181category c1014;
3182#line 7
3183category c1015;
3184#line 7
3185category c1016;
3186#line 7
3187category c1017;
3188#line 7
3189category c1018;
3190#line 7
3191category c1019;
3192#line 7
3193category c1020;
3194#line 7
3195category c1021;
3196#line 7
3197category c1022;
3198#line 7
3199category c1023;
3200#line 7
3201
3202
3203# Generate level definitions for each sensitivity and category.
3204level s0:c0.c1023;
3205#line 10
3206
3207#line 1 "system/sepolicy/reqd_mask/mls"
3208mlsconstrain binder { set_context_mgr } (l1 eq l2);
3209#line 1 "system/sepolicy/prebuilts/api/29.0/public/te_macros"
3210#####################################
3211# domain_trans(olddomain, type, newdomain)
3212# Allow a transition from olddomain to newdomain
3213# upon executing a file labeled with type.
3214# This only allows the transition; it does not
3215# cause it to occur automatically - use domain_auto_trans
3216# if that is what you want.
3217#
3218#line 21
3219
3220
3221#####################################
3222# domain_auto_trans(olddomain, type, newdomain)
3223# Automatically transition from olddomain to newdomain
3224# upon executing a file labeled with type.
3225#
3226#line 33
3227
3228
3229#####################################
3230# file_type_trans(domain, dir_type, file_type)
3231# Allow domain to create a file labeled file_type in a
3232# directory labeled dir_type.
3233# This only allows the transition; it does not
3234# cause it to occur automatically - use file_type_auto_trans
3235# if that is what you want.
3236#
3237#line 49
3238
3239
3240#####################################
3241# file_type_auto_trans(domain, dir_type, file_type)
3242# Automatically label new files with file_type when
3243# they are created by domain in directories labeled dir_type.
3244#
3245#line 62
3246
3247
3248#####################################
3249# r_dir_file(domain, type)
3250# Allow the specified domain to read directories, files
3251# and symbolic links of the specified type.
3252#line 71
3253
3254
3255#####################################
3256# tmpfs_domain(domain)
3257# Allow access to a unique type for this domain when creating tmpfs / ashmem files.
3258#line 79
3259
3260
3261# pdx macros for IPC. pdx is a high-level name which contains transport-specific
3262# rules from underlying transport (e.g. UDS-based implementation).
3263
3264#####################################
3265# pdx_service_attributes(service)
3266# Defines type attribute used to identify various service-related types.
3267#line 92
3268
3269
3270#####################################
3271# pdx_service_socket_types(service, endpoint_dir_t)
3272# Define types for endpoint and channel sockets.
3273#line 105
3274
3275
3276#####################################
3277# pdx_server(server_domain, service)
3278#line 124
3279
3280
3281#####################################
3282# pdx_connect(client, service)
3283#line 134
3284
3285
3286#####################################
3287# pdx_use(client, service)
3288#line 149
3289
3290
3291#####################################
3292# pdx_client(client, service)
3293#line 156
3294
3295
3296#####################################
3297# init_daemon_domain(domain)
3298# Set up a transition from init to the daemon domain
3299# upon executing its binary.
3300#line 164
3301
3302
3303#####################################
3304# app_domain(domain)
3305# Allow a base set of permissions required for all apps.
3306#line 184
3307
3308
3309#####################################
3310# untrusted_app_domain(domain)
3311# Allow a base set of permissions required for all untrusted apps.
3312#line 191
3313
3314
3315#####################################
3316# net_domain(domain)
3317# Allow a base set of permissions required for network access.
3318#line 198
3319
3320
3321#####################################
3322# bluetooth_domain(domain)
3323# Allow a base set of permissions required for bluetooth access.
3324#line 205
3325
3326
3327#####################################
3328# hal_attribute(hal_name)
3329# Add an attribute for hal implementations along with necessary
3330# restrictions.
3331#line 227
3332
3333
3334#####################################
3335# hal_server_domain(domain, hal_type)
3336# Allow a base set of permissions required for a domain to offer a
3337# HAL implementation of the specified type over HwBinder.
3338#
3339# For example, default implementation of Foo HAL:
3340#   type hal_foo_default, domain;
3341#   hal_server_domain(hal_foo_default, hal_foo)
3342#
3343#line 242
3344
3345
3346#####################################
3347# hal_client_domain(domain, hal_type)
3348# Allow a base set of permissions required for a domain to be a
3349# client of a HAL of the specified type.
3350#
3351# For example, make some_domain a client of Foo HAL:
3352#   hal_client_domain(some_domain, hal_foo)
3353#
3354#line 266
3355
3356
3357#####################################
3358# passthrough_hal_client_domain(domain, hal_type)
3359# Allow a base set of permissions required for a domain to be a
3360# client of a passthrough HAL of the specified type.
3361#
3362# For example, make some_domain a client of passthrough Foo HAL:
3363#   passthrough_hal_client_domain(some_domain, hal_foo)
3364#
3365#line 284
3366
3367
3368#####################################
3369# unix_socket_connect(clientdomain, socket, serverdomain)
3370# Allow a local socket connection from clientdomain via
3371# socket to serverdomain.
3372#
3373# Note: If you see denial records that distill to the
3374# following allow rules:
3375# allow clientdomain property_socket:sock_file write;
3376# allow clientdomain init:unix_stream_socket connectto;
3377# allow clientdomain something_prop:property_service set;
3378#
3379# This sequence is indicative of attempting to set a property.
3380# use set_prop(sourcedomain, targetproperty)
3381#
3382#line 303
3383
3384
3385#####################################
3386# set_prop(sourcedomain, targetproperty)
3387# Allows source domain to set the
3388# targetproperty.
3389#
3390#line 314
3391
3392
3393#####################################
3394# get_prop(sourcedomain, targetproperty)
3395# Allows source domain to read the
3396# targetproperty.
3397#
3398#line 323
3399
3400
3401#####################################
3402# unix_socket_send(clientdomain, socket, serverdomain)
3403# Allow a local socket send from clientdomain via
3404# socket to serverdomain.
3405#line 332
3406
3407
3408#####################################
3409# binder_use(domain)
3410# Allow domain to use Binder IPC.
3411#line 346
3412
3413
3414#####################################
3415# hwbinder_use(domain)
3416# Allow domain to use HwBinder IPC.
3417#line 362
3418
3419
3420#####################################
3421# vndbinder_use(domain)
3422# Allow domain to use Binder IPC.
3423#line 376
3424
3425
3426#####################################
3427# binder_call(clientdomain, serverdomain)
3428# Allow clientdomain to perform binder IPC to serverdomain.
3429#line 388
3430
3431
3432#####################################
3433# binder_service(domain)
3434# Mark a domain as being a Binder service domain.
3435# Used to allow binder IPC to the various system services.
3436#line 396
3437
3438
3439#####################################
3440# wakelock_use(domain)
3441# Allow domain to manage wake locks
3442#line 415
3443
3444
3445#####################################
3446# selinux_check_access(domain)
3447# Allow domain to check SELinux permissions via selinuxfs.
3448#line 425
3449
3450
3451#####################################
3452# selinux_check_context(domain)
3453# Allow domain to check SELinux contexts via selinuxfs.
3454#line 434
3455
3456
3457#####################################
3458# create_pty(domain)
3459# Allow domain to create and use a pty, isolated from any other domain ptys.
3460#line 453
3461
3462
3463#####################################
3464# Non system_app application set
3465#
3466
3467
3468#####################################
3469# Recovery only
3470# SELinux rules which apply only to recovery mode
3471#
3472
3473
3474#####################################
3475# Full TREBLE only
3476# SELinux rules which apply only to full TREBLE devices
3477#
3478#line 475
3479
3480
3481#####################################
3482# Not full TREBLE
3483# SELinux rules which apply only to devices which are not full TREBLE devices
3484#
3485
3486
3487#####################################
3488# Compatible property only
3489# SELinux rules which apply only to devices with compatible property
3490#
3491#line 492
3492
3493
3494#####################################
3495# Not compatible property
3496# SELinux rules which apply only to devices without compatible property
3497#
3498
3499
3500#####################################
3501# Userdebug or eng builds
3502# SELinux rules which apply only to userdebug or eng builds
3503#
3504
3505
3506#####################################
3507# asan builds
3508# SELinux rules which apply only to asan builds
3509#
3510
3511
3512#####################################
3513# native coverage builds
3514# SELinux rules which apply only to builds with native coverage
3515#
3516
3517
3518#####################################
3519# Build-time-only test
3520# SELinux rules which are verified during build, but not as part of *TS testing.
3521#
3522
3523
3524####################################
3525# Fallback crash handling for processes that can't exec crash_dump (e.g. because of seccomp).
3526#
3527#line 542
3528
3529
3530#####################################
3531# WITH_DEXPREOPT builds
3532# SELinux rules which apply only when pre-opting.
3533#
3534
3535
3536#####################################
3537# write_logd(domain)
3538# Ability to write to android log
3539# daemon via sockets
3540#line 557
3541
3542
3543#####################################
3544# read_logd(domain)
3545# Ability to run logcat and read from android
3546# log daemon via sockets
3547#line 566
3548
3549
3550#####################################
3551# read_runtime_log_tags(domain)
3552# ability to directly map the runtime event log tags
3553#line 573
3554
3555
3556#####################################
3557# control_logd(domain)
3558# Ability to control
3559# android log daemon via sockets
3560#line 583
3561
3562
3563#####################################
3564# use_keystore(domain)
3565# Ability to use keystore.
3566# Keystore is requires the following permissions
3567# to call getpidcon.
3568#line 597
3569
3570
3571###########################################
3572# use_drmservice(domain)
3573# Ability to use DrmService which requires
3574# DrmService to call getpidcon.
3575#line 607
3576
3577
3578###########################################
3579# add_service(domain, service)
3580# Ability for domain to add a service to service_manager
3581# and find it. It also creates a neverallow preventing
3582# others from adding it.
3583#line 617
3584
3585
3586###########################################
3587# add_hwservice(domain, service)
3588# Ability for domain to add a service to hwservice_manager
3589# and find it. It also creates a neverallow preventing
3590# others from adding it.
3591#line 628
3592
3593
3594###########################################
3595# hal_attribute_hwservice(attribute, service)
3596# Ability for domain to get a service to hwservice_manager
3597# and find it. It also creates a neverallow preventing
3598# others from adding it.
3599#
3600# Used to pair hal_foo_client with hal_foo_hwservice
3601#line 644
3602
3603
3604###################################
3605# can_profile_heap(domain)
3606# Allow processes within the domain to have their heap profiled by heapprofd.
3607#
3608# Note that profiling is performed differently between debug and user builds.
3609# This macro covers both user and debug builds, but see
3610# can_profile_heap_userdebug_or_eng for a variant that can be used when
3611# allowing profiling for a domain only on debug builds, without granting
3612# the exec permission. The exec permission is necessary for user builds, but
3613# only a nice-to-have for development and testing purposes on debug builds.
3614#line 672
3615
3616
3617###################################
3618# can_profile_heap_userdebug_or_eng(domain)
3619# Allow processes within the domain to have their heap profiled by heapprofd on
3620# debug builds only.
3621#
3622# Only necessary when can_profile_heap cannot be applied, see its description
3623# for rationale.
3624#line 702
3625
3626
3627###################################
3628# never_profile_heap(domain)
3629# Opt out of heap profiling by heapprofd.
3630#line 710
3631
3632#line 1 "system/sepolicy/prebuilts/api/29.0/public/ioctl_defines"
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352#line 1 "system/sepolicy/prebuilts/api/29.0/public/ioctl_macros"
6353# socket ioctls allowed to unprivileged apps
6354#line 12
6355
6356
6357# socket ioctls never allowed to unprivileged apps
6358#line 42
6359
6360
6361# commonly used ioctls on unix sockets
6362#line 47
6363
6364
6365# commonly used TTY ioctls
6366# merge with unpriv_unix_sock_ioctls?
6367#line 54
6368
6369
6370# point to point ioctls
6371#line 68
6372
6373#line 1 "system/sepolicy/prebuilts/api/29.0/public/attributes"
6374######################################
6375# Attribute declarations
6376#
6377
6378# All types used for devices.
6379# On change, update CHECK_FC_ASSERT_ATTRS
6380# in tools/checkfc.c
6381attribute dev_type;
6382
6383# All types used for processes.
6384attribute domain;
6385
6386# All types used for filesystems.
6387# On change, update CHECK_FC_ASSERT_ATTRS
6388# definition in tools/checkfc.c.
6389attribute fs_type;
6390
6391# All types used for context= mounts.
6392attribute contextmount_type;
6393
6394# All types used for files that can exist on a labeled fs.
6395# Do not use for pseudo file types.
6396# On change, update CHECK_FC_ASSERT_ATTRS
6397# definition in tools/checkfc.c.
6398attribute file_type;
6399
6400# All types used for domain entry points.
6401attribute exec_type;
6402
6403# All types used for /data files.
6404attribute data_file_type;
6405expandattribute data_file_type false;
6406# All types in /data, not in /data/vendor
6407attribute core_data_file_type;
6408expandattribute core_data_file_type false;
6409
6410# All types in /system
6411attribute system_file_type;
6412
6413# All types in /vendor
6414attribute vendor_file_type;
6415
6416# All types used for procfs files.
6417attribute proc_type;
6418expandattribute proc_type false;
6419
6420# Types in /proc/net, excluding qtaguid types.
6421# TODO(b/9496886) Lock down access to /proc/net.
6422# This attribute is used to audit access to proc_net. it is temporary and will
6423# be removed.
6424attribute proc_net_type;
6425expandattribute proc_net_type true;
6426
6427# All types used for sysfs files.
6428attribute sysfs_type;
6429
6430# All types use for debugfs files.
6431attribute debugfs_type;
6432
6433# Attribute used for all sdcards
6434attribute sdcard_type;
6435
6436# All types used for nodes/hosts.
6437attribute node_type;
6438
6439# All types used for network interfaces.
6440attribute netif_type;
6441
6442# All types used for network ports.
6443attribute port_type;
6444
6445# All types used for property service
6446# On change, update CHECK_PC_ASSERT_ATTRS
6447# definition in tools/checkfc.c.
6448attribute property_type;
6449
6450# All properties defined in core SELinux policy. Should not be
6451# used by device specific properties
6452attribute core_property_type;
6453
6454# All properties used to configure log filtering.
6455attribute log_property_type;
6456
6457# All properties that are not specific to device but are added from
6458# outside of AOSP. (e.g. OEM-specific properties)
6459# These properties are not accessible from device-specific domains
6460attribute extended_core_property_type;
6461
6462# All service_manager types created by system_server
6463attribute system_server_service;
6464
6465# services which should be available to all but isolated apps
6466attribute app_api_service;
6467
6468# services which should be available to all ephemeral apps
6469attribute ephemeral_app_api_service;
6470
6471# services which export only system_api
6472attribute system_api_service;
6473
6474# All types used for services managed by servicemanager.
6475# On change, update CHECK_SC_ASSERT_ATTRS
6476# definition in tools/checkfc.c.
6477attribute service_manager_type;
6478
6479# All types used for services managed by hwservicemanager
6480attribute hwservice_manager_type;
6481
6482# All HwBinder services guaranteed to be passthrough. These services always run
6483# in the process of their clients, and thus operate with the same access as
6484# their clients.
6485attribute same_process_hwservice;
6486
6487# All HwBinder services guaranteed to be offered only by core domain components
6488attribute coredomain_hwservice;
6489
6490# All types used for services managed by vndservicemanager
6491attribute vndservice_manager_type;
6492
6493
6494# All domains that can override MLS restrictions.
6495# i.e. processes that can read up and write down.
6496attribute mlstrustedsubject;
6497
6498# All types that can override MLS restrictions.
6499# i.e. files that can be read by lower and written by higher
6500attribute mlstrustedobject;
6501
6502# All domains used for apps.
6503attribute appdomain;
6504
6505# All third party apps.
6506attribute untrusted_app_all;
6507
6508# All domains used for apps with network access.
6509attribute netdomain;
6510
6511# All domains used for apps with bluetooth access.
6512attribute bluetoothdomain;
6513
6514# All domains used for binder service domains.
6515attribute binderservicedomain;
6516
6517# update_engine related domains that need to apply an update and run
6518# postinstall. This includes the background daemon and the sideload tool from
6519# recovery for A/B devices.
6520attribute update_engine_common;
6521
6522# All core domains (as opposed to vendor/device-specific domains)
6523attribute coredomain;
6524
6525# All socket devices owned by core domain components
6526attribute coredomain_socket;
6527expandattribute coredomain_socket false;
6528
6529# All vendor domains which violate the requirement of not using Binder
6530# TODO(b/35870313): Remove this once there are no violations
6531attribute binder_in_vendor_violators;
6532expandattribute binder_in_vendor_violators false;
6533
6534# All vendor domains which violate the requirement of not using sockets for
6535# communicating with core components
6536# TODO(b/36577153): Remove this once there are no violations
6537attribute socket_between_core_and_vendor_violators;
6538expandattribute socket_between_core_and_vendor_violators false;
6539
6540# All vendor domains which violate the requirement of not executing
6541# system processes
6542# TODO(b/36463595)
6543attribute vendor_executes_system_violators;
6544expandattribute vendor_executes_system_violators false;
6545
6546# All domains which violate the requirement of not sharing files by path
6547# between between vendor and core domains.
6548# TODO(b/34980020)
6549attribute data_between_core_and_vendor_violators;
6550expandattribute data_between_core_and_vendor_violators false;
6551
6552# All system domains which violate the requirement of not executing vendor
6553# binaries/libraries.
6554# TODO(b/62041836)
6555attribute system_executes_vendor_violators;
6556expandattribute system_executes_vendor_violators false;
6557
6558# All system domains which violate the requirement of not writing vendor
6559# properties.
6560# TODO(b/78598545): Remove this once there are no violations
6561attribute system_writes_vendor_properties_violators;
6562expandattribute system_writes_vendor_properties_violators false;
6563
6564# All system domains which violate the requirement of not writing to
6565# /mnt/vendor/*. Must not be used on devices launched with P or later.
6566attribute system_writes_mnt_vendor_violators;
6567expandattribute system_writes_mnt_vendor_violators false;
6568
6569# hwservices that are accessible from untrusted applications
6570# WARNING: Use of this attribute should be avoided unless
6571# absolutely necessary.  It is a temporary allowance to aid the
6572# transition to treble and will be removed in a future platform
6573# version, requiring all hwservices that are labeled with this
6574# attribute to be submitted to AOSP in order to maintain their
6575# app-visibility.
6576attribute untrusted_app_visible_hwservice_violators;
6577expandattribute untrusted_app_visible_hwservice_violators false;
6578
6579# halserver domains that are accessible to untrusted applications.  These
6580# domains are typically those hosting  hwservices attributed by the
6581# untrusted_app_visible_hwservice_violators.
6582# WARNING: Use of this attribute should be avoided unless absolutely necessary.
6583# It is a temporary allowance to aid the transition to treble and will be
6584# removed in the future platform version, requiring all halserver domains that
6585# are labeled with this attribute to be submitted to AOSP in order to maintain
6586# their app-visibility.
6587attribute untrusted_app_visible_halserver_violators;
6588expandattribute untrusted_app_visible_halserver_violators false;
6589
6590# PDX services
6591attribute pdx_endpoint_dir_type;
6592attribute pdx_endpoint_socket_type;
6593expandattribute pdx_endpoint_socket_type false;
6594attribute pdx_channel_socket_type;
6595expandattribute pdx_channel_socket_type false;
6596
6597
6598#line 224
6599attribute pdx_display_client_endpoint_dir_type;
6600#line 224
6601attribute pdx_display_client_endpoint_socket_type;
6602#line 224
6603attribute pdx_display_client_channel_socket_type;
6604#line 224
6605attribute pdx_display_client_server_type;
6606#line 224
6607
6608
6609#line 225
6610attribute pdx_display_manager_endpoint_dir_type;
6611#line 225
6612attribute pdx_display_manager_endpoint_socket_type;
6613#line 225
6614attribute pdx_display_manager_channel_socket_type;
6615#line 225
6616attribute pdx_display_manager_server_type;
6617#line 225
6618
6619
6620#line 226
6621attribute pdx_display_screenshot_endpoint_dir_type;
6622#line 226
6623attribute pdx_display_screenshot_endpoint_socket_type;
6624#line 226
6625attribute pdx_display_screenshot_channel_socket_type;
6626#line 226
6627attribute pdx_display_screenshot_server_type;
6628#line 226
6629
6630
6631#line 227
6632attribute pdx_display_vsync_endpoint_dir_type;
6633#line 227
6634attribute pdx_display_vsync_endpoint_socket_type;
6635#line 227
6636attribute pdx_display_vsync_channel_socket_type;
6637#line 227
6638attribute pdx_display_vsync_server_type;
6639#line 227
6640
6641
6642#line 228
6643attribute pdx_performance_client_endpoint_dir_type;
6644#line 228
6645attribute pdx_performance_client_endpoint_socket_type;
6646#line 228
6647attribute pdx_performance_client_channel_socket_type;
6648#line 228
6649attribute pdx_performance_client_server_type;
6650#line 228
6651
6652
6653#line 229
6654attribute pdx_bufferhub_client_endpoint_dir_type;
6655#line 229
6656attribute pdx_bufferhub_client_endpoint_socket_type;
6657#line 229
6658attribute pdx_bufferhub_client_channel_socket_type;
6659#line 229
6660attribute pdx_bufferhub_client_server_type;
6661#line 229
6662
6663
6664# All HAL servers
6665attribute halserverdomain;
6666# All HAL clients
6667attribute halclientdomain;
6668expandattribute halclientdomain true;
6669
6670# Exempt for halserverdomain to access sockets. Only builds for automotive
6671# device types are allowed to use this attribute (enforced by CTS).
6672# Unlike phone, in a car many modules are external from Android perspective and
6673# HALs should be able to communicate with those devices through sockets.
6674attribute hal_automotive_socket_exemption;
6675
6676# HALs
6677
6678#line 244
6679attribute hal_allocator;
6680#line 244
6681expandattribute hal_allocator true;
6682#line 244
6683attribute hal_allocator_client;
6684#line 244
6685expandattribute hal_allocator_client true;
6686#line 244
6687attribute hal_allocator_server;
6688#line 244
6689expandattribute hal_allocator_server false;
6690#line 244
6691
6692#line 244
6693neverallow { hal_allocator_server -halserverdomain } domain:process fork;
6694#line 244
6695# hal_*_client and halclientdomain attributes are always expanded for
6696#line 244
6697# performance reasons. Neverallow rules targeting expanded attributes can not be
6698#line 244
6699# verified by CTS since these attributes are already expanded by that time.
6700#line 244
6701
6702#line 244
6703neverallow { hal_allocator_server -hal_allocator } domain:process fork;
6704#line 244
6705neverallow { hal_allocator_client -halclientdomain } domain:process fork;
6706#line 244
6707
6708#line 244
6709;
6710
6711#line 245
6712attribute hal_atrace;
6713#line 245
6714expandattribute hal_atrace true;
6715#line 245
6716attribute hal_atrace_client;
6717#line 245
6718expandattribute hal_atrace_client true;
6719#line 245
6720attribute hal_atrace_server;
6721#line 245
6722expandattribute hal_atrace_server false;
6723#line 245
6724
6725#line 245
6726neverallow { hal_atrace_server -halserverdomain } domain:process fork;
6727#line 245
6728# hal_*_client and halclientdomain attributes are always expanded for
6729#line 245
6730# performance reasons. Neverallow rules targeting expanded attributes can not be
6731#line 245
6732# verified by CTS since these attributes are already expanded by that time.
6733#line 245
6734
6735#line 245
6736neverallow { hal_atrace_server -hal_atrace } domain:process fork;
6737#line 245
6738neverallow { hal_atrace_client -halclientdomain } domain:process fork;
6739#line 245
6740
6741#line 245
6742;
6743
6744#line 246
6745attribute hal_audio;
6746#line 246
6747expandattribute hal_audio true;
6748#line 246
6749attribute hal_audio_client;
6750#line 246
6751expandattribute hal_audio_client true;
6752#line 246
6753attribute hal_audio_server;
6754#line 246
6755expandattribute hal_audio_server false;
6756#line 246
6757
6758#line 246
6759neverallow { hal_audio_server -halserverdomain } domain:process fork;
6760#line 246
6761# hal_*_client and halclientdomain attributes are always expanded for
6762#line 246
6763# performance reasons. Neverallow rules targeting expanded attributes can not be
6764#line 246
6765# verified by CTS since these attributes are already expanded by that time.
6766#line 246
6767
6768#line 246
6769neverallow { hal_audio_server -hal_audio } domain:process fork;
6770#line 246
6771neverallow { hal_audio_client -halclientdomain } domain:process fork;
6772#line 246
6773
6774#line 246
6775;
6776
6777#line 247
6778attribute hal_audiocontrol;
6779#line 247
6780expandattribute hal_audiocontrol true;
6781#line 247
6782attribute hal_audiocontrol_client;
6783#line 247
6784expandattribute hal_audiocontrol_client true;
6785#line 247
6786attribute hal_audiocontrol_server;
6787#line 247
6788expandattribute hal_audiocontrol_server false;
6789#line 247
6790
6791#line 247
6792neverallow { hal_audiocontrol_server -halserverdomain } domain:process fork;
6793#line 247
6794# hal_*_client and halclientdomain attributes are always expanded for
6795#line 247
6796# performance reasons. Neverallow rules targeting expanded attributes can not be
6797#line 247
6798# verified by CTS since these attributes are already expanded by that time.
6799#line 247
6800
6801#line 247
6802neverallow { hal_audiocontrol_server -hal_audiocontrol } domain:process fork;
6803#line 247
6804neverallow { hal_audiocontrol_client -halclientdomain } domain:process fork;
6805#line 247
6806
6807#line 247
6808;
6809
6810#line 248
6811attribute hal_authsecret;
6812#line 248
6813expandattribute hal_authsecret true;
6814#line 248
6815attribute hal_authsecret_client;
6816#line 248
6817expandattribute hal_authsecret_client true;
6818#line 248
6819attribute hal_authsecret_server;
6820#line 248
6821expandattribute hal_authsecret_server false;
6822#line 248
6823
6824#line 248
6825neverallow { hal_authsecret_server -halserverdomain } domain:process fork;
6826#line 248
6827# hal_*_client and halclientdomain attributes are always expanded for
6828#line 248
6829# performance reasons. Neverallow rules targeting expanded attributes can not be
6830#line 248
6831# verified by CTS since these attributes are already expanded by that time.
6832#line 248
6833
6834#line 248
6835neverallow { hal_authsecret_server -hal_authsecret } domain:process fork;
6836#line 248
6837neverallow { hal_authsecret_client -halclientdomain } domain:process fork;
6838#line 248
6839
6840#line 248
6841;
6842
6843#line 249
6844attribute hal_bluetooth;
6845#line 249
6846expandattribute hal_bluetooth true;
6847#line 249
6848attribute hal_bluetooth_client;
6849#line 249
6850expandattribute hal_bluetooth_client true;
6851#line 249
6852attribute hal_bluetooth_server;
6853#line 249
6854expandattribute hal_bluetooth_server false;
6855#line 249
6856
6857#line 249
6858neverallow { hal_bluetooth_server -halserverdomain } domain:process fork;
6859#line 249
6860# hal_*_client and halclientdomain attributes are always expanded for
6861#line 249
6862# performance reasons. Neverallow rules targeting expanded attributes can not be
6863#line 249
6864# verified by CTS since these attributes are already expanded by that time.
6865#line 249
6866
6867#line 249
6868neverallow { hal_bluetooth_server -hal_bluetooth } domain:process fork;
6869#line 249
6870neverallow { hal_bluetooth_client -halclientdomain } domain:process fork;
6871#line 249
6872
6873#line 249
6874;
6875
6876#line 250
6877attribute hal_bootctl;
6878#line 250
6879expandattribute hal_bootctl true;
6880#line 250
6881attribute hal_bootctl_client;
6882#line 250
6883expandattribute hal_bootctl_client true;
6884#line 250
6885attribute hal_bootctl_server;
6886#line 250
6887expandattribute hal_bootctl_server false;
6888#line 250
6889
6890#line 250
6891neverallow { hal_bootctl_server -halserverdomain } domain:process fork;
6892#line 250
6893# hal_*_client and halclientdomain attributes are always expanded for
6894#line 250
6895# performance reasons. Neverallow rules targeting expanded attributes can not be
6896#line 250
6897# verified by CTS since these attributes are already expanded by that time.
6898#line 250
6899
6900#line 250
6901neverallow { hal_bootctl_server -hal_bootctl } domain:process fork;
6902#line 250
6903neverallow { hal_bootctl_client -halclientdomain } domain:process fork;
6904#line 250
6905
6906#line 250
6907;
6908
6909#line 251
6910attribute hal_bufferhub;
6911#line 251
6912expandattribute hal_bufferhub true;
6913#line 251
6914attribute hal_bufferhub_client;
6915#line 251
6916expandattribute hal_bufferhub_client true;
6917#line 251
6918attribute hal_bufferhub_server;
6919#line 251
6920expandattribute hal_bufferhub_server false;
6921#line 251
6922
6923#line 251
6924neverallow { hal_bufferhub_server -halserverdomain } domain:process fork;
6925#line 251
6926# hal_*_client and halclientdomain attributes are always expanded for
6927#line 251
6928# performance reasons. Neverallow rules targeting expanded attributes can not be
6929#line 251
6930# verified by CTS since these attributes are already expanded by that time.
6931#line 251
6932
6933#line 251
6934neverallow { hal_bufferhub_server -hal_bufferhub } domain:process fork;
6935#line 251
6936neverallow { hal_bufferhub_client -halclientdomain } domain:process fork;
6937#line 251
6938
6939#line 251
6940;
6941
6942#line 252
6943attribute hal_broadcastradio;
6944#line 252
6945expandattribute hal_broadcastradio true;
6946#line 252
6947attribute hal_broadcastradio_client;
6948#line 252
6949expandattribute hal_broadcastradio_client true;
6950#line 252
6951attribute hal_broadcastradio_server;
6952#line 252
6953expandattribute hal_broadcastradio_server false;
6954#line 252
6955
6956#line 252
6957neverallow { hal_broadcastradio_server -halserverdomain } domain:process fork;
6958#line 252
6959# hal_*_client and halclientdomain attributes are always expanded for
6960#line 252
6961# performance reasons. Neverallow rules targeting expanded attributes can not be
6962#line 252
6963# verified by CTS since these attributes are already expanded by that time.
6964#line 252
6965
6966#line 252
6967neverallow { hal_broadcastradio_server -hal_broadcastradio } domain:process fork;
6968#line 252
6969neverallow { hal_broadcastradio_client -halclientdomain } domain:process fork;
6970#line 252
6971
6972#line 252
6973;
6974
6975#line 253
6976attribute hal_camera;
6977#line 253
6978expandattribute hal_camera true;
6979#line 253
6980attribute hal_camera_client;
6981#line 253
6982expandattribute hal_camera_client true;
6983#line 253
6984attribute hal_camera_server;
6985#line 253
6986expandattribute hal_camera_server false;
6987#line 253
6988
6989#line 253
6990neverallow { hal_camera_server -halserverdomain } domain:process fork;
6991#line 253
6992# hal_*_client and halclientdomain attributes are always expanded for
6993#line 253
6994# performance reasons. Neverallow rules targeting expanded attributes can not be
6995#line 253
6996# verified by CTS since these attributes are already expanded by that time.
6997#line 253
6998
6999#line 253
7000neverallow { hal_camera_server -hal_camera } domain:process fork;
7001#line 253
7002neverallow { hal_camera_client -halclientdomain } domain:process fork;
7003#line 253
7004
7005#line 253
7006;
7007
7008#line 254
7009attribute hal_cas;
7010#line 254
7011expandattribute hal_cas true;
7012#line 254
7013attribute hal_cas_client;
7014#line 254
7015expandattribute hal_cas_client true;
7016#line 254
7017attribute hal_cas_server;
7018#line 254
7019expandattribute hal_cas_server false;
7020#line 254
7021
7022#line 254
7023neverallow { hal_cas_server -halserverdomain } domain:process fork;
7024#line 254
7025# hal_*_client and halclientdomain attributes are always expanded for
7026#line 254
7027# performance reasons. Neverallow rules targeting expanded attributes can not be
7028#line 254
7029# verified by CTS since these attributes are already expanded by that time.
7030#line 254
7031
7032#line 254
7033neverallow { hal_cas_server -hal_cas } domain:process fork;
7034#line 254
7035neverallow { hal_cas_client -halclientdomain } domain:process fork;
7036#line 254
7037
7038#line 254
7039;
7040
7041#line 255
7042attribute hal_codec2;
7043#line 255
7044expandattribute hal_codec2 true;
7045#line 255
7046attribute hal_codec2_client;
7047#line 255
7048expandattribute hal_codec2_client true;
7049#line 255
7050attribute hal_codec2_server;
7051#line 255
7052expandattribute hal_codec2_server false;
7053#line 255
7054
7055#line 255
7056neverallow { hal_codec2_server -halserverdomain } domain:process fork;
7057#line 255
7058# hal_*_client and halclientdomain attributes are always expanded for
7059#line 255
7060# performance reasons. Neverallow rules targeting expanded attributes can not be
7061#line 255
7062# verified by CTS since these attributes are already expanded by that time.
7063#line 255
7064
7065#line 255
7066neverallow { hal_codec2_server -hal_codec2 } domain:process fork;
7067#line 255
7068neverallow { hal_codec2_client -halclientdomain } domain:process fork;
7069#line 255
7070
7071#line 255
7072;
7073
7074#line 256
7075attribute hal_configstore;
7076#line 256
7077expandattribute hal_configstore true;
7078#line 256
7079attribute hal_configstore_client;
7080#line 256
7081expandattribute hal_configstore_client true;
7082#line 256
7083attribute hal_configstore_server;
7084#line 256
7085expandattribute hal_configstore_server false;
7086#line 256
7087
7088#line 256
7089neverallow { hal_configstore_server -halserverdomain } domain:process fork;
7090#line 256
7091# hal_*_client and halclientdomain attributes are always expanded for
7092#line 256
7093# performance reasons. Neverallow rules targeting expanded attributes can not be
7094#line 256
7095# verified by CTS since these attributes are already expanded by that time.
7096#line 256
7097
7098#line 256
7099neverallow { hal_configstore_server -hal_configstore } domain:process fork;
7100#line 256
7101neverallow { hal_configstore_client -halclientdomain } domain:process fork;
7102#line 256
7103
7104#line 256
7105;
7106
7107#line 257
7108attribute hal_confirmationui;
7109#line 257
7110expandattribute hal_confirmationui true;
7111#line 257
7112attribute hal_confirmationui_client;
7113#line 257
7114expandattribute hal_confirmationui_client true;
7115#line 257
7116attribute hal_confirmationui_server;
7117#line 257
7118expandattribute hal_confirmationui_server false;
7119#line 257
7120
7121#line 257
7122neverallow { hal_confirmationui_server -halserverdomain } domain:process fork;
7123#line 257
7124# hal_*_client and halclientdomain attributes are always expanded for
7125#line 257
7126# performance reasons. Neverallow rules targeting expanded attributes can not be
7127#line 257
7128# verified by CTS since these attributes are already expanded by that time.
7129#line 257
7130
7131#line 257
7132neverallow { hal_confirmationui_server -hal_confirmationui } domain:process fork;
7133#line 257
7134neverallow { hal_confirmationui_client -halclientdomain } domain:process fork;
7135#line 257
7136
7137#line 257
7138;
7139
7140#line 258
7141attribute hal_contexthub;
7142#line 258
7143expandattribute hal_contexthub true;
7144#line 258
7145attribute hal_contexthub_client;
7146#line 258
7147expandattribute hal_contexthub_client true;
7148#line 258
7149attribute hal_contexthub_server;
7150#line 258
7151expandattribute hal_contexthub_server false;
7152#line 258
7153
7154#line 258
7155neverallow { hal_contexthub_server -halserverdomain } domain:process fork;
7156#line 258
7157# hal_*_client and halclientdomain attributes are always expanded for
7158#line 258
7159# performance reasons. Neverallow rules targeting expanded attributes can not be
7160#line 258
7161# verified by CTS since these attributes are already expanded by that time.
7162#line 258
7163
7164#line 258
7165neverallow { hal_contexthub_server -hal_contexthub } domain:process fork;
7166#line 258
7167neverallow { hal_contexthub_client -halclientdomain } domain:process fork;
7168#line 258
7169
7170#line 258
7171;
7172
7173#line 259
7174attribute hal_drm;
7175#line 259
7176expandattribute hal_drm true;
7177#line 259
7178attribute hal_drm_client;
7179#line 259
7180expandattribute hal_drm_client true;
7181#line 259
7182attribute hal_drm_server;
7183#line 259
7184expandattribute hal_drm_server false;
7185#line 259
7186
7187#line 259
7188neverallow { hal_drm_server -halserverdomain } domain:process fork;
7189#line 259
7190# hal_*_client and halclientdomain attributes are always expanded for
7191#line 259
7192# performance reasons. Neverallow rules targeting expanded attributes can not be
7193#line 259
7194# verified by CTS since these attributes are already expanded by that time.
7195#line 259
7196
7197#line 259
7198neverallow { hal_drm_server -hal_drm } domain:process fork;
7199#line 259
7200neverallow { hal_drm_client -halclientdomain } domain:process fork;
7201#line 259
7202
7203#line 259
7204;
7205
7206#line 260
7207attribute hal_dumpstate;
7208#line 260
7209expandattribute hal_dumpstate true;
7210#line 260
7211attribute hal_dumpstate_client;
7212#line 260
7213expandattribute hal_dumpstate_client true;
7214#line 260
7215attribute hal_dumpstate_server;
7216#line 260
7217expandattribute hal_dumpstate_server false;
7218#line 260
7219
7220#line 260
7221neverallow { hal_dumpstate_server -halserverdomain } domain:process fork;
7222#line 260
7223# hal_*_client and halclientdomain attributes are always expanded for
7224#line 260
7225# performance reasons. Neverallow rules targeting expanded attributes can not be
7226#line 260
7227# verified by CTS since these attributes are already expanded by that time.
7228#line 260
7229
7230#line 260
7231neverallow { hal_dumpstate_server -hal_dumpstate } domain:process fork;
7232#line 260
7233neverallow { hal_dumpstate_client -halclientdomain } domain:process fork;
7234#line 260
7235
7236#line 260
7237;
7238
7239#line 261
7240attribute hal_evs;
7241#line 261
7242expandattribute hal_evs true;
7243#line 261
7244attribute hal_evs_client;
7245#line 261
7246expandattribute hal_evs_client true;
7247#line 261
7248attribute hal_evs_server;
7249#line 261
7250expandattribute hal_evs_server false;
7251#line 261
7252
7253#line 261
7254neverallow { hal_evs_server -halserverdomain } domain:process fork;
7255#line 261
7256# hal_*_client and halclientdomain attributes are always expanded for
7257#line 261
7258# performance reasons. Neverallow rules targeting expanded attributes can not be
7259#line 261
7260# verified by CTS since these attributes are already expanded by that time.
7261#line 261
7262
7263#line 261
7264neverallow { hal_evs_server -hal_evs } domain:process fork;
7265#line 261
7266neverallow { hal_evs_client -halclientdomain } domain:process fork;
7267#line 261
7268
7269#line 261
7270;
7271
7272#line 262
7273attribute hal_face;
7274#line 262
7275expandattribute hal_face true;
7276#line 262
7277attribute hal_face_client;
7278#line 262
7279expandattribute hal_face_client true;
7280#line 262
7281attribute hal_face_server;
7282#line 262
7283expandattribute hal_face_server false;
7284#line 262
7285
7286#line 262
7287neverallow { hal_face_server -halserverdomain } domain:process fork;
7288#line 262
7289# hal_*_client and halclientdomain attributes are always expanded for
7290#line 262
7291# performance reasons. Neverallow rules targeting expanded attributes can not be
7292#line 262
7293# verified by CTS since these attributes are already expanded by that time.
7294#line 262
7295
7296#line 262
7297neverallow { hal_face_server -hal_face } domain:process fork;
7298#line 262
7299neverallow { hal_face_client -halclientdomain } domain:process fork;
7300#line 262
7301
7302#line 262
7303;
7304
7305#line 263
7306attribute hal_fingerprint;
7307#line 263
7308expandattribute hal_fingerprint true;
7309#line 263
7310attribute hal_fingerprint_client;
7311#line 263
7312expandattribute hal_fingerprint_client true;
7313#line 263
7314attribute hal_fingerprint_server;
7315#line 263
7316expandattribute hal_fingerprint_server false;
7317#line 263
7318
7319#line 263
7320neverallow { hal_fingerprint_server -halserverdomain } domain:process fork;
7321#line 263
7322# hal_*_client and halclientdomain attributes are always expanded for
7323#line 263
7324# performance reasons. Neverallow rules targeting expanded attributes can not be
7325#line 263
7326# verified by CTS since these attributes are already expanded by that time.
7327#line 263
7328
7329#line 263
7330neverallow { hal_fingerprint_server -hal_fingerprint } domain:process fork;
7331#line 263
7332neverallow { hal_fingerprint_client -halclientdomain } domain:process fork;
7333#line 263
7334
7335#line 263
7336;
7337
7338#line 264
7339attribute hal_gatekeeper;
7340#line 264
7341expandattribute hal_gatekeeper true;
7342#line 264
7343attribute hal_gatekeeper_client;
7344#line 264
7345expandattribute hal_gatekeeper_client true;
7346#line 264
7347attribute hal_gatekeeper_server;
7348#line 264
7349expandattribute hal_gatekeeper_server false;
7350#line 264
7351
7352#line 264
7353neverallow { hal_gatekeeper_server -halserverdomain } domain:process fork;
7354#line 264
7355# hal_*_client and halclientdomain attributes are always expanded for
7356#line 264
7357# performance reasons. Neverallow rules targeting expanded attributes can not be
7358#line 264
7359# verified by CTS since these attributes are already expanded by that time.
7360#line 264
7361
7362#line 264
7363neverallow { hal_gatekeeper_server -hal_gatekeeper } domain:process fork;
7364#line 264
7365neverallow { hal_gatekeeper_client -halclientdomain } domain:process fork;
7366#line 264
7367
7368#line 264
7369;
7370
7371#line 265
7372attribute hal_gnss;
7373#line 265
7374expandattribute hal_gnss true;
7375#line 265
7376attribute hal_gnss_client;
7377#line 265
7378expandattribute hal_gnss_client true;
7379#line 265
7380attribute hal_gnss_server;
7381#line 265
7382expandattribute hal_gnss_server false;
7383#line 265
7384
7385#line 265
7386neverallow { hal_gnss_server -halserverdomain } domain:process fork;
7387#line 265
7388# hal_*_client and halclientdomain attributes are always expanded for
7389#line 265
7390# performance reasons. Neverallow rules targeting expanded attributes can not be
7391#line 265
7392# verified by CTS since these attributes are already expanded by that time.
7393#line 265
7394
7395#line 265
7396neverallow { hal_gnss_server -hal_gnss } domain:process fork;
7397#line 265
7398neverallow { hal_gnss_client -halclientdomain } domain:process fork;
7399#line 265
7400
7401#line 265
7402;
7403
7404#line 266
7405attribute hal_graphics_allocator;
7406#line 266
7407expandattribute hal_graphics_allocator true;
7408#line 266
7409attribute hal_graphics_allocator_client;
7410#line 266
7411expandattribute hal_graphics_allocator_client true;
7412#line 266
7413attribute hal_graphics_allocator_server;
7414#line 266
7415expandattribute hal_graphics_allocator_server false;
7416#line 266
7417
7418#line 266
7419neverallow { hal_graphics_allocator_server -halserverdomain } domain:process fork;
7420#line 266
7421# hal_*_client and halclientdomain attributes are always expanded for
7422#line 266
7423# performance reasons. Neverallow rules targeting expanded attributes can not be
7424#line 266
7425# verified by CTS since these attributes are already expanded by that time.
7426#line 266
7427
7428#line 266
7429neverallow { hal_graphics_allocator_server -hal_graphics_allocator } domain:process fork;
7430#line 266
7431neverallow { hal_graphics_allocator_client -halclientdomain } domain:process fork;
7432#line 266
7433
7434#line 266
7435;
7436
7437#line 267
7438attribute hal_graphics_composer;
7439#line 267
7440expandattribute hal_graphics_composer true;
7441#line 267
7442attribute hal_graphics_composer_client;
7443#line 267
7444expandattribute hal_graphics_composer_client true;
7445#line 267
7446attribute hal_graphics_composer_server;
7447#line 267
7448expandattribute hal_graphics_composer_server false;
7449#line 267
7450
7451#line 267
7452neverallow { hal_graphics_composer_server -halserverdomain } domain:process fork;
7453#line 267
7454# hal_*_client and halclientdomain attributes are always expanded for
7455#line 267
7456# performance reasons. Neverallow rules targeting expanded attributes can not be
7457#line 267
7458# verified by CTS since these attributes are already expanded by that time.
7459#line 267
7460
7461#line 267
7462neverallow { hal_graphics_composer_server -hal_graphics_composer } domain:process fork;
7463#line 267
7464neverallow { hal_graphics_composer_client -halclientdomain } domain:process fork;
7465#line 267
7466
7467#line 267
7468;
7469
7470#line 268
7471attribute hal_health;
7472#line 268
7473expandattribute hal_health true;
7474#line 268
7475attribute hal_health_client;
7476#line 268
7477expandattribute hal_health_client true;
7478#line 268
7479attribute hal_health_server;
7480#line 268
7481expandattribute hal_health_server false;
7482#line 268
7483
7484#line 268
7485neverallow { hal_health_server -halserverdomain } domain:process fork;
7486#line 268
7487# hal_*_client and halclientdomain attributes are always expanded for
7488#line 268
7489# performance reasons. Neverallow rules targeting expanded attributes can not be
7490#line 268
7491# verified by CTS since these attributes are already expanded by that time.
7492#line 268
7493
7494#line 268
7495neverallow { hal_health_server -hal_health } domain:process fork;
7496#line 268
7497neverallow { hal_health_client -halclientdomain } domain:process fork;
7498#line 268
7499
7500#line 268
7501;
7502
7503#line 269
7504attribute hal_health_storage;
7505#line 269
7506expandattribute hal_health_storage true;
7507#line 269
7508attribute hal_health_storage_client;
7509#line 269
7510expandattribute hal_health_storage_client true;
7511#line 269
7512attribute hal_health_storage_server;
7513#line 269
7514expandattribute hal_health_storage_server false;
7515#line 269
7516
7517#line 269
7518neverallow { hal_health_storage_server -halserverdomain } domain:process fork;
7519#line 269
7520# hal_*_client and halclientdomain attributes are always expanded for
7521#line 269
7522# performance reasons. Neverallow rules targeting expanded attributes can not be
7523#line 269
7524# verified by CTS since these attributes are already expanded by that time.
7525#line 269
7526
7527#line 269
7528neverallow { hal_health_storage_server -hal_health_storage } domain:process fork;
7529#line 269
7530neverallow { hal_health_storage_client -halclientdomain } domain:process fork;
7531#line 269
7532
7533#line 269
7534;
7535
7536#line 270
7537attribute hal_input_classifier;
7538#line 270
7539expandattribute hal_input_classifier true;
7540#line 270
7541attribute hal_input_classifier_client;
7542#line 270
7543expandattribute hal_input_classifier_client true;
7544#line 270
7545attribute hal_input_classifier_server;
7546#line 270
7547expandattribute hal_input_classifier_server false;
7548#line 270
7549
7550#line 270
7551neverallow { hal_input_classifier_server -halserverdomain } domain:process fork;
7552#line 270
7553# hal_*_client and halclientdomain attributes are always expanded for
7554#line 270
7555# performance reasons. Neverallow rules targeting expanded attributes can not be
7556#line 270
7557# verified by CTS since these attributes are already expanded by that time.
7558#line 270
7559
7560#line 270
7561neverallow { hal_input_classifier_server -hal_input_classifier } domain:process fork;
7562#line 270
7563neverallow { hal_input_classifier_client -halclientdomain } domain:process fork;
7564#line 270
7565
7566#line 270
7567;
7568
7569#line 271
7570attribute hal_ir;
7571#line 271
7572expandattribute hal_ir true;
7573#line 271
7574attribute hal_ir_client;
7575#line 271
7576expandattribute hal_ir_client true;
7577#line 271
7578attribute hal_ir_server;
7579#line 271
7580expandattribute hal_ir_server false;
7581#line 271
7582
7583#line 271
7584neverallow { hal_ir_server -halserverdomain } domain:process fork;
7585#line 271
7586# hal_*_client and halclientdomain attributes are always expanded for
7587#line 271
7588# performance reasons. Neverallow rules targeting expanded attributes can not be
7589#line 271
7590# verified by CTS since these attributes are already expanded by that time.
7591#line 271
7592
7593#line 271
7594neverallow { hal_ir_server -hal_ir } domain:process fork;
7595#line 271
7596neverallow { hal_ir_client -halclientdomain } domain:process fork;
7597#line 271
7598
7599#line 271
7600;
7601
7602#line 272
7603attribute hal_keymaster;
7604#line 272
7605expandattribute hal_keymaster true;
7606#line 272
7607attribute hal_keymaster_client;
7608#line 272
7609expandattribute hal_keymaster_client true;
7610#line 272
7611attribute hal_keymaster_server;
7612#line 272
7613expandattribute hal_keymaster_server false;
7614#line 272
7615
7616#line 272
7617neverallow { hal_keymaster_server -halserverdomain } domain:process fork;
7618#line 272
7619# hal_*_client and halclientdomain attributes are always expanded for
7620#line 272
7621# performance reasons. Neverallow rules targeting expanded attributes can not be
7622#line 272
7623# verified by CTS since these attributes are already expanded by that time.
7624#line 272
7625
7626#line 272
7627neverallow { hal_keymaster_server -hal_keymaster } domain:process fork;
7628#line 272
7629neverallow { hal_keymaster_client -halclientdomain } domain:process fork;
7630#line 272
7631
7632#line 272
7633;
7634
7635#line 273
7636attribute hal_light;
7637#line 273
7638expandattribute hal_light true;
7639#line 273
7640attribute hal_light_client;
7641#line 273
7642expandattribute hal_light_client true;
7643#line 273
7644attribute hal_light_server;
7645#line 273
7646expandattribute hal_light_server false;
7647#line 273
7648
7649#line 273
7650neverallow { hal_light_server -halserverdomain } domain:process fork;
7651#line 273
7652# hal_*_client and halclientdomain attributes are always expanded for
7653#line 273
7654# performance reasons. Neverallow rules targeting expanded attributes can not be
7655#line 273
7656# verified by CTS since these attributes are already expanded by that time.
7657#line 273
7658
7659#line 273
7660neverallow { hal_light_server -hal_light } domain:process fork;
7661#line 273
7662neverallow { hal_light_client -halclientdomain } domain:process fork;
7663#line 273
7664
7665#line 273
7666;
7667
7668#line 274
7669attribute hal_lowpan;
7670#line 274
7671expandattribute hal_lowpan true;
7672#line 274
7673attribute hal_lowpan_client;
7674#line 274
7675expandattribute hal_lowpan_client true;
7676#line 274
7677attribute hal_lowpan_server;
7678#line 274
7679expandattribute hal_lowpan_server false;
7680#line 274
7681
7682#line 274
7683neverallow { hal_lowpan_server -halserverdomain } domain:process fork;
7684#line 274
7685# hal_*_client and halclientdomain attributes are always expanded for
7686#line 274
7687# performance reasons. Neverallow rules targeting expanded attributes can not be
7688#line 274
7689# verified by CTS since these attributes are already expanded by that time.
7690#line 274
7691
7692#line 274
7693neverallow { hal_lowpan_server -hal_lowpan } domain:process fork;
7694#line 274
7695neverallow { hal_lowpan_client -halclientdomain } domain:process fork;
7696#line 274
7697
7698#line 274
7699;
7700
7701#line 275
7702attribute hal_memtrack;
7703#line 275
7704expandattribute hal_memtrack true;
7705#line 275
7706attribute hal_memtrack_client;
7707#line 275
7708expandattribute hal_memtrack_client true;
7709#line 275
7710attribute hal_memtrack_server;
7711#line 275
7712expandattribute hal_memtrack_server false;
7713#line 275
7714
7715#line 275
7716neverallow { hal_memtrack_server -halserverdomain } domain:process fork;
7717#line 275
7718# hal_*_client and halclientdomain attributes are always expanded for
7719#line 275
7720# performance reasons. Neverallow rules targeting expanded attributes can not be
7721#line 275
7722# verified by CTS since these attributes are already expanded by that time.
7723#line 275
7724
7725#line 275
7726neverallow { hal_memtrack_server -hal_memtrack } domain:process fork;
7727#line 275
7728neverallow { hal_memtrack_client -halclientdomain } domain:process fork;
7729#line 275
7730
7731#line 275
7732;
7733
7734#line 276
7735attribute hal_neuralnetworks;
7736#line 276
7737expandattribute hal_neuralnetworks true;
7738#line 276
7739attribute hal_neuralnetworks_client;
7740#line 276
7741expandattribute hal_neuralnetworks_client true;
7742#line 276
7743attribute hal_neuralnetworks_server;
7744#line 276
7745expandattribute hal_neuralnetworks_server false;
7746#line 276
7747
7748#line 276
7749neverallow { hal_neuralnetworks_server -halserverdomain } domain:process fork;
7750#line 276
7751# hal_*_client and halclientdomain attributes are always expanded for
7752#line 276
7753# performance reasons. Neverallow rules targeting expanded attributes can not be
7754#line 276
7755# verified by CTS since these attributes are already expanded by that time.
7756#line 276
7757
7758#line 276
7759neverallow { hal_neuralnetworks_server -hal_neuralnetworks } domain:process fork;
7760#line 276
7761neverallow { hal_neuralnetworks_client -halclientdomain } domain:process fork;
7762#line 276
7763
7764#line 276
7765;
7766
7767#line 277
7768attribute hal_nfc;
7769#line 277
7770expandattribute hal_nfc true;
7771#line 277
7772attribute hal_nfc_client;
7773#line 277
7774expandattribute hal_nfc_client true;
7775#line 277
7776attribute hal_nfc_server;
7777#line 277
7778expandattribute hal_nfc_server false;
7779#line 277
7780
7781#line 277
7782neverallow { hal_nfc_server -halserverdomain } domain:process fork;
7783#line 277
7784# hal_*_client and halclientdomain attributes are always expanded for
7785#line 277
7786# performance reasons. Neverallow rules targeting expanded attributes can not be
7787#line 277
7788# verified by CTS since these attributes are already expanded by that time.
7789#line 277
7790
7791#line 277
7792neverallow { hal_nfc_server -hal_nfc } domain:process fork;
7793#line 277
7794neverallow { hal_nfc_client -halclientdomain } domain:process fork;
7795#line 277
7796
7797#line 277
7798;
7799
7800#line 278
7801attribute hal_oemlock;
7802#line 278
7803expandattribute hal_oemlock true;
7804#line 278
7805attribute hal_oemlock_client;
7806#line 278
7807expandattribute hal_oemlock_client true;
7808#line 278
7809attribute hal_oemlock_server;
7810#line 278
7811expandattribute hal_oemlock_server false;
7812#line 278
7813
7814#line 278
7815neverallow { hal_oemlock_server -halserverdomain } domain:process fork;
7816#line 278
7817# hal_*_client and halclientdomain attributes are always expanded for
7818#line 278
7819# performance reasons. Neverallow rules targeting expanded attributes can not be
7820#line 278
7821# verified by CTS since these attributes are already expanded by that time.
7822#line 278
7823
7824#line 278
7825neverallow { hal_oemlock_server -hal_oemlock } domain:process fork;
7826#line 278
7827neverallow { hal_oemlock_client -halclientdomain } domain:process fork;
7828#line 278
7829
7830#line 278
7831;
7832
7833#line 279
7834attribute hal_omx;
7835#line 279
7836expandattribute hal_omx true;
7837#line 279
7838attribute hal_omx_client;
7839#line 279
7840expandattribute hal_omx_client true;
7841#line 279
7842attribute hal_omx_server;
7843#line 279
7844expandattribute hal_omx_server false;
7845#line 279
7846
7847#line 279
7848neverallow { hal_omx_server -halserverdomain } domain:process fork;
7849#line 279
7850# hal_*_client and halclientdomain attributes are always expanded for
7851#line 279
7852# performance reasons. Neverallow rules targeting expanded attributes can not be
7853#line 279
7854# verified by CTS since these attributes are already expanded by that time.
7855#line 279
7856
7857#line 279
7858neverallow { hal_omx_server -hal_omx } domain:process fork;
7859#line 279
7860neverallow { hal_omx_client -halclientdomain } domain:process fork;
7861#line 279
7862
7863#line 279
7864;
7865
7866#line 280
7867attribute hal_power;
7868#line 280
7869expandattribute hal_power true;
7870#line 280
7871attribute hal_power_client;
7872#line 280
7873expandattribute hal_power_client true;
7874#line 280
7875attribute hal_power_server;
7876#line 280
7877expandattribute hal_power_server false;
7878#line 280
7879
7880#line 280
7881neverallow { hal_power_server -halserverdomain } domain:process fork;
7882#line 280
7883# hal_*_client and halclientdomain attributes are always expanded for
7884#line 280
7885# performance reasons. Neverallow rules targeting expanded attributes can not be
7886#line 280
7887# verified by CTS since these attributes are already expanded by that time.
7888#line 280
7889
7890#line 280
7891neverallow { hal_power_server -hal_power } domain:process fork;
7892#line 280
7893neverallow { hal_power_client -halclientdomain } domain:process fork;
7894#line 280
7895
7896#line 280
7897;
7898
7899#line 281
7900attribute hal_power_stats;
7901#line 281
7902expandattribute hal_power_stats true;
7903#line 281
7904attribute hal_power_stats_client;
7905#line 281
7906expandattribute hal_power_stats_client true;
7907#line 281
7908attribute hal_power_stats_server;
7909#line 281
7910expandattribute hal_power_stats_server false;
7911#line 281
7912
7913#line 281
7914neverallow { hal_power_stats_server -halserverdomain } domain:process fork;
7915#line 281
7916# hal_*_client and halclientdomain attributes are always expanded for
7917#line 281
7918# performance reasons. Neverallow rules targeting expanded attributes can not be
7919#line 281
7920# verified by CTS since these attributes are already expanded by that time.
7921#line 281
7922
7923#line 281
7924neverallow { hal_power_stats_server -hal_power_stats } domain:process fork;
7925#line 281
7926neverallow { hal_power_stats_client -halclientdomain } domain:process fork;
7927#line 281
7928
7929#line 281
7930;
7931
7932#line 282
7933attribute hal_secure_element;
7934#line 282
7935expandattribute hal_secure_element true;
7936#line 282
7937attribute hal_secure_element_client;
7938#line 282
7939expandattribute hal_secure_element_client true;
7940#line 282
7941attribute hal_secure_element_server;
7942#line 282
7943expandattribute hal_secure_element_server false;
7944#line 282
7945
7946#line 282
7947neverallow { hal_secure_element_server -halserverdomain } domain:process fork;
7948#line 282
7949# hal_*_client and halclientdomain attributes are always expanded for
7950#line 282
7951# performance reasons. Neverallow rules targeting expanded attributes can not be
7952#line 282
7953# verified by CTS since these attributes are already expanded by that time.
7954#line 282
7955
7956#line 282
7957neverallow { hal_secure_element_server -hal_secure_element } domain:process fork;
7958#line 282
7959neverallow { hal_secure_element_client -halclientdomain } domain:process fork;
7960#line 282
7961
7962#line 282
7963;
7964
7965#line 283
7966attribute hal_sensors;
7967#line 283
7968expandattribute hal_sensors true;
7969#line 283
7970attribute hal_sensors_client;
7971#line 283
7972expandattribute hal_sensors_client true;
7973#line 283
7974attribute hal_sensors_server;
7975#line 283
7976expandattribute hal_sensors_server false;
7977#line 283
7978
7979#line 283
7980neverallow { hal_sensors_server -halserverdomain } domain:process fork;
7981#line 283
7982# hal_*_client and halclientdomain attributes are always expanded for
7983#line 283
7984# performance reasons. Neverallow rules targeting expanded attributes can not be
7985#line 283
7986# verified by CTS since these attributes are already expanded by that time.
7987#line 283
7988
7989#line 283
7990neverallow { hal_sensors_server -hal_sensors } domain:process fork;
7991#line 283
7992neverallow { hal_sensors_client -halclientdomain } domain:process fork;
7993#line 283
7994
7995#line 283
7996;
7997
7998#line 284
7999attribute hal_telephony;
8000#line 284
8001expandattribute hal_telephony true;
8002#line 284
8003attribute hal_telephony_client;
8004#line 284
8005expandattribute hal_telephony_client true;
8006#line 284
8007attribute hal_telephony_server;
8008#line 284
8009expandattribute hal_telephony_server false;
8010#line 284
8011
8012#line 284
8013neverallow { hal_telephony_server -halserverdomain } domain:process fork;
8014#line 284
8015# hal_*_client and halclientdomain attributes are always expanded for
8016#line 284
8017# performance reasons. Neverallow rules targeting expanded attributes can not be
8018#line 284
8019# verified by CTS since these attributes are already expanded by that time.
8020#line 284
8021
8022#line 284
8023neverallow { hal_telephony_server -hal_telephony } domain:process fork;
8024#line 284
8025neverallow { hal_telephony_client -halclientdomain } domain:process fork;
8026#line 284
8027
8028#line 284
8029;
8030
8031#line 285
8032attribute hal_tetheroffload;
8033#line 285
8034expandattribute hal_tetheroffload true;
8035#line 285
8036attribute hal_tetheroffload_client;
8037#line 285
8038expandattribute hal_tetheroffload_client true;
8039#line 285
8040attribute hal_tetheroffload_server;
8041#line 285
8042expandattribute hal_tetheroffload_server false;
8043#line 285
8044
8045#line 285
8046neverallow { hal_tetheroffload_server -halserverdomain } domain:process fork;
8047#line 285
8048# hal_*_client and halclientdomain attributes are always expanded for
8049#line 285
8050# performance reasons. Neverallow rules targeting expanded attributes can not be
8051#line 285
8052# verified by CTS since these attributes are already expanded by that time.
8053#line 285
8054
8055#line 285
8056neverallow { hal_tetheroffload_server -hal_tetheroffload } domain:process fork;
8057#line 285
8058neverallow { hal_tetheroffload_client -halclientdomain } domain:process fork;
8059#line 285
8060
8061#line 285
8062;
8063
8064#line 286
8065attribute hal_thermal;
8066#line 286
8067expandattribute hal_thermal true;
8068#line 286
8069attribute hal_thermal_client;
8070#line 286
8071expandattribute hal_thermal_client true;
8072#line 286
8073attribute hal_thermal_server;
8074#line 286
8075expandattribute hal_thermal_server false;
8076#line 286
8077
8078#line 286
8079neverallow { hal_thermal_server -halserverdomain } domain:process fork;
8080#line 286
8081# hal_*_client and halclientdomain attributes are always expanded for
8082#line 286
8083# performance reasons. Neverallow rules targeting expanded attributes can not be
8084#line 286
8085# verified by CTS since these attributes are already expanded by that time.
8086#line 286
8087
8088#line 286
8089neverallow { hal_thermal_server -hal_thermal } domain:process fork;
8090#line 286
8091neverallow { hal_thermal_client -halclientdomain } domain:process fork;
8092#line 286
8093
8094#line 286
8095;
8096
8097#line 287
8098attribute hal_tv_cec;
8099#line 287
8100expandattribute hal_tv_cec true;
8101#line 287
8102attribute hal_tv_cec_client;
8103#line 287
8104expandattribute hal_tv_cec_client true;
8105#line 287
8106attribute hal_tv_cec_server;
8107#line 287
8108expandattribute hal_tv_cec_server false;
8109#line 287
8110
8111#line 287
8112neverallow { hal_tv_cec_server -halserverdomain } domain:process fork;
8113#line 287
8114# hal_*_client and halclientdomain attributes are always expanded for
8115#line 287
8116# performance reasons. Neverallow rules targeting expanded attributes can not be
8117#line 287
8118# verified by CTS since these attributes are already expanded by that time.
8119#line 287
8120
8121#line 287
8122neverallow { hal_tv_cec_server -hal_tv_cec } domain:process fork;
8123#line 287
8124neverallow { hal_tv_cec_client -halclientdomain } domain:process fork;
8125#line 287
8126
8127#line 287
8128;
8129
8130#line 288
8131attribute hal_tv_input;
8132#line 288
8133expandattribute hal_tv_input true;
8134#line 288
8135attribute hal_tv_input_client;
8136#line 288
8137expandattribute hal_tv_input_client true;
8138#line 288
8139attribute hal_tv_input_server;
8140#line 288
8141expandattribute hal_tv_input_server false;
8142#line 288
8143
8144#line 288
8145neverallow { hal_tv_input_server -halserverdomain } domain:process fork;
8146#line 288
8147# hal_*_client and halclientdomain attributes are always expanded for
8148#line 288
8149# performance reasons. Neverallow rules targeting expanded attributes can not be
8150#line 288
8151# verified by CTS since these attributes are already expanded by that time.
8152#line 288
8153
8154#line 288
8155neverallow { hal_tv_input_server -hal_tv_input } domain:process fork;
8156#line 288
8157neverallow { hal_tv_input_client -halclientdomain } domain:process fork;
8158#line 288
8159
8160#line 288
8161;
8162
8163#line 289
8164attribute hal_usb;
8165#line 289
8166expandattribute hal_usb true;
8167#line 289
8168attribute hal_usb_client;
8169#line 289
8170expandattribute hal_usb_client true;
8171#line 289
8172attribute hal_usb_server;
8173#line 289
8174expandattribute hal_usb_server false;
8175#line 289
8176
8177#line 289
8178neverallow { hal_usb_server -halserverdomain } domain:process fork;
8179#line 289
8180# hal_*_client and halclientdomain attributes are always expanded for
8181#line 289
8182# performance reasons. Neverallow rules targeting expanded attributes can not be
8183#line 289
8184# verified by CTS since these attributes are already expanded by that time.
8185#line 289
8186
8187#line 289
8188neverallow { hal_usb_server -hal_usb } domain:process fork;
8189#line 289
8190neverallow { hal_usb_client -halclientdomain } domain:process fork;
8191#line 289
8192
8193#line 289
8194;
8195
8196#line 290
8197attribute hal_usb_gadget;
8198#line 290
8199expandattribute hal_usb_gadget true;
8200#line 290
8201attribute hal_usb_gadget_client;
8202#line 290
8203expandattribute hal_usb_gadget_client true;
8204#line 290
8205attribute hal_usb_gadget_server;
8206#line 290
8207expandattribute hal_usb_gadget_server false;
8208#line 290
8209
8210#line 290
8211neverallow { hal_usb_gadget_server -halserverdomain } domain:process fork;
8212#line 290
8213# hal_*_client and halclientdomain attributes are always expanded for
8214#line 290
8215# performance reasons. Neverallow rules targeting expanded attributes can not be
8216#line 290
8217# verified by CTS since these attributes are already expanded by that time.
8218#line 290
8219
8220#line 290
8221neverallow { hal_usb_gadget_server -hal_usb_gadget } domain:process fork;
8222#line 290
8223neverallow { hal_usb_gadget_client -halclientdomain } domain:process fork;
8224#line 290
8225
8226#line 290
8227;
8228
8229#line 291
8230attribute hal_vehicle;
8231#line 291
8232expandattribute hal_vehicle true;
8233#line 291
8234attribute hal_vehicle_client;
8235#line 291
8236expandattribute hal_vehicle_client true;
8237#line 291
8238attribute hal_vehicle_server;
8239#line 291
8240expandattribute hal_vehicle_server false;
8241#line 291
8242
8243#line 291
8244neverallow { hal_vehicle_server -halserverdomain } domain:process fork;
8245#line 291
8246# hal_*_client and halclientdomain attributes are always expanded for
8247#line 291
8248# performance reasons. Neverallow rules targeting expanded attributes can not be
8249#line 291
8250# verified by CTS since these attributes are already expanded by that time.
8251#line 291
8252
8253#line 291
8254neverallow { hal_vehicle_server -hal_vehicle } domain:process fork;
8255#line 291
8256neverallow { hal_vehicle_client -halclientdomain } domain:process fork;
8257#line 291
8258
8259#line 291
8260;
8261
8262#line 292
8263attribute hal_vibrator;
8264#line 292
8265expandattribute hal_vibrator true;
8266#line 292
8267attribute hal_vibrator_client;
8268#line 292
8269expandattribute hal_vibrator_client true;
8270#line 292
8271attribute hal_vibrator_server;
8272#line 292
8273expandattribute hal_vibrator_server false;
8274#line 292
8275
8276#line 292
8277neverallow { hal_vibrator_server -halserverdomain } domain:process fork;
8278#line 292
8279# hal_*_client and halclientdomain attributes are always expanded for
8280#line 292
8281# performance reasons. Neverallow rules targeting expanded attributes can not be
8282#line 292
8283# verified by CTS since these attributes are already expanded by that time.
8284#line 292
8285
8286#line 292
8287neverallow { hal_vibrator_server -hal_vibrator } domain:process fork;
8288#line 292
8289neverallow { hal_vibrator_client -halclientdomain } domain:process fork;
8290#line 292
8291
8292#line 292
8293;
8294
8295#line 293
8296attribute hal_vr;
8297#line 293
8298expandattribute hal_vr true;
8299#line 293
8300attribute hal_vr_client;
8301#line 293
8302expandattribute hal_vr_client true;
8303#line 293
8304attribute hal_vr_server;
8305#line 293
8306expandattribute hal_vr_server false;
8307#line 293
8308
8309#line 293
8310neverallow { hal_vr_server -halserverdomain } domain:process fork;
8311#line 293
8312# hal_*_client and halclientdomain attributes are always expanded for
8313#line 293
8314# performance reasons. Neverallow rules targeting expanded attributes can not be
8315#line 293
8316# verified by CTS since these attributes are already expanded by that time.
8317#line 293
8318
8319#line 293
8320neverallow { hal_vr_server -hal_vr } domain:process fork;
8321#line 293
8322neverallow { hal_vr_client -halclientdomain } domain:process fork;
8323#line 293
8324
8325#line 293
8326;
8327
8328#line 294
8329attribute hal_weaver;
8330#line 294
8331expandattribute hal_weaver true;
8332#line 294
8333attribute hal_weaver_client;
8334#line 294
8335expandattribute hal_weaver_client true;
8336#line 294
8337attribute hal_weaver_server;
8338#line 294
8339expandattribute hal_weaver_server false;
8340#line 294
8341
8342#line 294
8343neverallow { hal_weaver_server -halserverdomain } domain:process fork;
8344#line 294
8345# hal_*_client and halclientdomain attributes are always expanded for
8346#line 294
8347# performance reasons. Neverallow rules targeting expanded attributes can not be
8348#line 294
8349# verified by CTS since these attributes are already expanded by that time.
8350#line 294
8351
8352#line 294
8353neverallow { hal_weaver_server -hal_weaver } domain:process fork;
8354#line 294
8355neverallow { hal_weaver_client -halclientdomain } domain:process fork;
8356#line 294
8357
8358#line 294
8359;
8360
8361#line 295
8362attribute hal_wifi;
8363#line 295
8364expandattribute hal_wifi true;
8365#line 295
8366attribute hal_wifi_client;
8367#line 295
8368expandattribute hal_wifi_client true;
8369#line 295
8370attribute hal_wifi_server;
8371#line 295
8372expandattribute hal_wifi_server false;
8373#line 295
8374
8375#line 295
8376neverallow { hal_wifi_server -halserverdomain } domain:process fork;
8377#line 295
8378# hal_*_client and halclientdomain attributes are always expanded for
8379#line 295
8380# performance reasons. Neverallow rules targeting expanded attributes can not be
8381#line 295
8382# verified by CTS since these attributes are already expanded by that time.
8383#line 295
8384
8385#line 295
8386neverallow { hal_wifi_server -hal_wifi } domain:process fork;
8387#line 295
8388neverallow { hal_wifi_client -halclientdomain } domain:process fork;
8389#line 295
8390
8391#line 295
8392;
8393
8394#line 296
8395attribute hal_wifi_hostapd;
8396#line 296
8397expandattribute hal_wifi_hostapd true;
8398#line 296
8399attribute hal_wifi_hostapd_client;
8400#line 296
8401expandattribute hal_wifi_hostapd_client true;
8402#line 296
8403attribute hal_wifi_hostapd_server;
8404#line 296
8405expandattribute hal_wifi_hostapd_server false;
8406#line 296
8407
8408#line 296
8409neverallow { hal_wifi_hostapd_server -halserverdomain } domain:process fork;
8410#line 296
8411# hal_*_client and halclientdomain attributes are always expanded for
8412#line 296
8413# performance reasons. Neverallow rules targeting expanded attributes can not be
8414#line 296
8415# verified by CTS since these attributes are already expanded by that time.
8416#line 296
8417
8418#line 296
8419neverallow { hal_wifi_hostapd_server -hal_wifi_hostapd } domain:process fork;
8420#line 296
8421neverallow { hal_wifi_hostapd_client -halclientdomain } domain:process fork;
8422#line 296
8423
8424#line 296
8425;
8426
8427#line 297
8428attribute hal_wifi_offload;
8429#line 297
8430expandattribute hal_wifi_offload true;
8431#line 297
8432attribute hal_wifi_offload_client;
8433#line 297
8434expandattribute hal_wifi_offload_client true;
8435#line 297
8436attribute hal_wifi_offload_server;
8437#line 297
8438expandattribute hal_wifi_offload_server false;
8439#line 297
8440
8441#line 297
8442neverallow { hal_wifi_offload_server -halserverdomain } domain:process fork;
8443#line 297
8444# hal_*_client and halclientdomain attributes are always expanded for
8445#line 297
8446# performance reasons. Neverallow rules targeting expanded attributes can not be
8447#line 297
8448# verified by CTS since these attributes are already expanded by that time.
8449#line 297
8450
8451#line 297
8452neverallow { hal_wifi_offload_server -hal_wifi_offload } domain:process fork;
8453#line 297
8454neverallow { hal_wifi_offload_client -halclientdomain } domain:process fork;
8455#line 297
8456
8457#line 297
8458;
8459
8460#line 298
8461attribute hal_wifi_supplicant;
8462#line 298
8463expandattribute hal_wifi_supplicant true;
8464#line 298
8465attribute hal_wifi_supplicant_client;
8466#line 298
8467expandattribute hal_wifi_supplicant_client true;
8468#line 298
8469attribute hal_wifi_supplicant_server;
8470#line 298
8471expandattribute hal_wifi_supplicant_server false;
8472#line 298
8473
8474#line 298
8475neverallow { hal_wifi_supplicant_server -halserverdomain } domain:process fork;
8476#line 298
8477# hal_*_client and halclientdomain attributes are always expanded for
8478#line 298
8479# performance reasons. Neverallow rules targeting expanded attributes can not be
8480#line 298
8481# verified by CTS since these attributes are already expanded by that time.
8482#line 298
8483
8484#line 298
8485neverallow { hal_wifi_supplicant_server -hal_wifi_supplicant } domain:process fork;
8486#line 298
8487neverallow { hal_wifi_supplicant_client -halclientdomain } domain:process fork;
8488#line 298
8489
8490#line 298
8491;
8492
8493# HwBinder services offered across the core-vendor boundary
8494#
8495# We annotate server domains with x_server  to loosen the coupling between
8496# system and vendor images. For example, it should be possible to move a service
8497# from one core domain to another, without having to update the vendor image
8498# which contains clients of this service.
8499
8500attribute camera_service_server;
8501attribute display_service_server;
8502attribute scheduler_service_server;
8503attribute sensor_service_server;
8504attribute stats_service_server;
8505attribute system_suspend_server;
8506attribute wifi_keystore_service_server;
8507
8508# All types used for super partition block devices.
8509attribute super_block_device_type;
8510#line 1 "system/sepolicy/prebuilts/api/29.0/public/adbd.te"
8511# adbd seclabel is specified in init.rc since
8512# it lives in the rootfs and has no unique file type.
8513type adbd, domain;
8514type adbd_exec, exec_type, file_type, system_file_type;
8515
8516# Only init is allowed to enter the adbd domain via exec()
8517neverallow { domain -init } adbd:process transition;
8518neverallow * adbd:process dyntransition;
8519
8520# Allow adbd start/stop mdnsd via ctl.start
8521
8522#line 11
8523
8524#line 11
8525allow adbd property_socket:sock_file write;
8526#line 11
8527allow adbd init:unix_stream_socket connectto;
8528#line 11
8529
8530#line 11
8531allow adbd ctl_mdnsd_prop:property_service set;
8532#line 11
8533
8534#line 11
8535allow adbd ctl_mdnsd_prop:file { getattr open read map };
8536#line 11
8537
8538#line 11
8539
8540#line 1 "system/sepolicy/prebuilts/api/29.0/public/apexd.te"
8541# apexd -- manager for APEX packages
8542type apexd, domain;
8543type apexd_exec, exec_type, file_type, system_file_type;
8544
8545
8546#line 5
8547# Call the servicemanager and transfer references to it.
8548#line 5
8549allow apexd servicemanager:binder { call transfer };
8550#line 5
8551# servicemanager performs getpidcon on clients.
8552#line 5
8553allow servicemanager apexd:dir search;
8554#line 5
8555allow servicemanager apexd:file { read open };
8556#line 5
8557allow servicemanager apexd:process getattr;
8558#line 5
8559# rw access to /dev/binder and /dev/ashmem is presently granted to
8560#line 5
8561# all domains in domain.te.
8562#line 5
8563
8564
8565#line 6
8566  allow apexd apex_service:service_manager { add find };
8567#line 6
8568  neverallow { domain -apexd } apex_service:service_manager add;
8569#line 6
8570
8571
8572#line 7
8573
8574#line 7
8575allow apexd property_socket:sock_file write;
8576#line 7
8577allow apexd init:unix_stream_socket connectto;
8578#line 7
8579
8580#line 7
8581allow apexd apexd_prop:property_service set;
8582#line 7
8583
8584#line 7
8585allow apexd apexd_prop:file { getattr open read map };
8586#line 7
8587
8588#line 7
8589
8590
8591neverallow { domain -init -apexd -system_server } apex_service:service_manager find;
8592neverallow { domain -init -apexd -system_server } apexd:binder call;
8593
8594neverallow { domain  } apexd:process ptrace;
8595
8596# only apexd can set apexd sysprop
8597neverallow { domain -apexd -init } apexd_prop:property_service set;
8598#line 1 "system/sepolicy/prebuilts/api/29.0/public/app.te"
8599###
8600### Domain for all zygote spawned apps
8601###
8602### This file is the base policy for all zygote spawned apps.
8603### Other policy files, such as isolated_app.te, untrusted_app.te, etc
8604### extend from this policy. Only policies which should apply to ALL
8605### zygote spawned apps should be added here.
8606###
8607type appdomain_tmpfs, file_type;
8608
8609# WebView and other application-specific JIT compilers
8610allow appdomain self:process execmem;
8611
8612allow appdomain ashmem_device:chr_file execute;
8613
8614# Receive and use open file descriptors inherited from zygote.
8615allow appdomain zygote:fd use;
8616
8617# gdbserver for ndk-gdb reads the zygote.
8618# valgrind needs mmap exec for zygote
8619allow appdomain zygote_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
8620
8621# Notify zygote of death;
8622allow appdomain zygote:process sigchld;
8623
8624# Read /data/dalvik-cache.
8625allow appdomain dalvikcache_data_file:dir { search getattr };
8626allow appdomain dalvikcache_data_file:file { getattr open read ioctl lock map };
8627
8628# Read the /sdcard and /mnt/sdcard symlinks
8629allow { appdomain -isolated_app } rootfs:lnk_file { getattr open read ioctl lock map };
8630allow { appdomain -isolated_app } tmpfs:lnk_file { getattr open read ioctl lock map };
8631
8632# Search /storage/emulated tmpfs mount.
8633allow appdomain tmpfs:dir { open getattr read search ioctl lock };
8634
8635# Notify zygote of the wrapped process PID when using --invoke-with.
8636allow appdomain zygote:fifo_file write;
8637
8638#line 44
8639
8640
8641# Notify shell and adbd of death when spawned via runas for ndk-gdb.
8642allow appdomain shell:process sigchld;
8643allow appdomain adbd:process sigchld;
8644
8645# child shell or gdbserver pty access for runas.
8646allow appdomain devpts:chr_file { getattr read write ioctl };
8647
8648# Use pipes and sockets provided by system_server via binder or local socket.
8649allow appdomain system_server:fd use;
8650allow appdomain system_server:fifo_file { { getattr open read ioctl lock map } { open append write lock map } };
8651allow appdomain system_server:unix_stream_socket { read write setopt getattr getopt shutdown };
8652allow appdomain system_server:tcp_socket { read write getattr getopt shutdown };
8653
8654# For AppFuse.
8655allow appdomain vold:fd use;
8656
8657# Communication with other apps via fifos
8658allow appdomain appdomain:fifo_file { { getattr open read ioctl lock map } { open append write lock map } };
8659
8660# Communicate with surfaceflinger.
8661allow appdomain surfaceflinger:unix_stream_socket { read write setopt getattr getopt shutdown };
8662
8663# App sandbox file accesses.
8664allow { appdomain -isolated_app } { app_data_file privapp_data_file }:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
8665allow { appdomain -isolated_app } { app_data_file privapp_data_file }:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
8666
8667# Traverse into expanded storage
8668allow appdomain mnt_expand_file:dir { open getattr read search ioctl lock };
8669
8670# Keychain and user-trusted credentials
8671
8672#line 76
8673allow appdomain keychain_data_file:dir { open getattr read search ioctl lock };
8674#line 76
8675allow appdomain keychain_data_file:{ file lnk_file } { getattr open read ioctl lock map };
8676#line 76
8677
8678allow appdomain misc_user_data_file:dir { open getattr read search ioctl lock };
8679allow appdomain misc_user_data_file:file { getattr open read ioctl lock map };
8680
8681# TextClassifier
8682
8683#line 81
8684allow { appdomain -isolated_app } textclassifier_data_file:dir { open getattr read search ioctl lock };
8685#line 81
8686allow { appdomain -isolated_app } textclassifier_data_file:{ file lnk_file } { getattr open read ioctl lock map };
8687#line 81
8688
8689
8690# Access to OEM provided data and apps
8691allow appdomain oemfs:dir { open getattr read search ioctl lock };
8692allow appdomain oemfs:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
8693
8694# Execute the shell or other system executables.
8695allow { appdomain -ephemeral_app } shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
8696allow { appdomain -ephemeral_app } toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
8697allow appdomain system_file:file { getattr execute execute_no_trans map };
8698
8699
8700# Renderscript needs the ability to read directories on /system
8701allow appdomain system_file:dir { open getattr read search ioctl lock };
8702allow appdomain system_file:lnk_file { getattr open read };
8703# Renderscript specific permissions to open /system/vendor/lib64.
8704#line 100
8705
8706
8707
8708#line 102
8709    # For looking up Renderscript vendor drivers
8710#line 102
8711    allow { appdomain -isolated_app } vendor_file:dir { open read };
8712#line 105
8713
8714
8715# Allow apps access to /vendor/app except for privileged
8716# apps which cannot be in /vendor.
8717
8718#line 109
8719allow { appdomain -ephemeral_app } vendor_app_file:dir { open getattr read search ioctl lock };
8720#line 109
8721allow { appdomain -ephemeral_app } vendor_app_file:{ file lnk_file } { getattr open read ioctl lock map };
8722#line 109
8723
8724allow { appdomain -ephemeral_app } vendor_app_file:file execute;
8725
8726# Allow apps access to /vendor/overlay
8727
8728#line 113
8729allow appdomain vendor_overlay_file:dir { open getattr read search ioctl lock };
8730#line 113
8731allow appdomain vendor_overlay_file:{ file lnk_file } { getattr open read ioctl lock map };
8732#line 113
8733
8734
8735# Allow apps access to /vendor/framework
8736# for vendor provided libraries.
8737
8738#line 117
8739allow appdomain vendor_framework_file:dir { open getattr read search ioctl lock };
8740#line 117
8741allow appdomain vendor_framework_file:{ file lnk_file } { getattr open read ioctl lock map };
8742#line 117
8743
8744
8745# Allow apps read / execute access to vendor public libraries.
8746allow appdomain vendor_public_lib_file:dir { open getattr read search ioctl lock };
8747allow appdomain vendor_public_lib_file:file { execute read open getattr map };
8748
8749# Read/write wallpaper file (opened by system).
8750allow appdomain wallpaper_file:file { getattr read write map };
8751
8752# Read/write cached ringtones (opened by system).
8753allow appdomain ringtone_file:file { getattr read write map };
8754
8755# Read ShortcutManager icon files (opened by system).
8756allow appdomain shortcut_manager_icons:file { getattr read map };
8757
8758# Read icon file (opened by system).
8759allow appdomain icon_file:file { getattr read map };
8760
8761# Old stack dumping scheme : append to a global trace file (/data/anr/traces.txt).
8762#
8763# TODO: All of these permissions except for anr_data_file:file append can be
8764# withdrawn once we've switched to the new stack dumping mechanism, see b/32064548
8765# and the rules below.
8766allow appdomain anr_data_file:dir search;
8767allow appdomain anr_data_file:file { open append };
8768
8769# New stack dumping scheme : request an output FD from tombstoned via a unix
8770# domain socket.
8771#
8772# Allow apps to connect and write to the tombstoned java trace socket in
8773# order to dump their traces. Also allow them to append traces to pipes
8774# created by dumptrace. (Also see the rules below where they are given
8775# additional permissions to dumpstate pipes for other aspects of bug report
8776# creation).
8777
8778#line 151
8779allow appdomain tombstoned_java_trace_socket:sock_file write;
8780#line 151
8781allow appdomain tombstoned:unix_stream_socket connectto;
8782#line 151
8783
8784allow appdomain tombstoned:fd use;
8785allow appdomain dumpstate:fifo_file append;
8786allow appdomain incidentd:fifo_file append;
8787
8788# Allow apps to send dump information to dumpstate
8789allow appdomain dumpstate:fd use;
8790allow appdomain dumpstate:unix_stream_socket { read write getopt getattr shutdown };
8791allow appdomain dumpstate:fifo_file { write getattr };
8792allow appdomain shell_data_file:file { write getattr };
8793
8794# Allow apps to send dump information to incidentd
8795allow appdomain incidentd:fd use;
8796allow appdomain incidentd:fifo_file { write getattr };
8797
8798# Allow apps to send information to statsd socket.
8799
8800#line 167
8801allow appdomain statsdw_socket:sock_file write;
8802#line 167
8803allow appdomain statsd:unix_dgram_socket sendto;
8804#line 167
8805
8806
8807# Write profiles /data/misc/profiles
8808allow appdomain user_profile_data_file:dir { search write add_name };
8809allow appdomain user_profile_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
8810
8811# Send heap dumps to system_server via an already open file descriptor
8812# % adb shell am set-watch-heap com.android.systemui 1048576
8813# % adb shell dumpsys procstats --start-testing
8814# debuggable builds only.
8815#line 179
8816
8817
8818# /proc/net access.
8819# TODO(b/9496886) Audit access for removal.
8820# proc_net access for the negated domains below is granted (or not) in their
8821# individual .te files.
8822
8823#line 185
8824allow {
8825#line 185
8826  appdomain
8827#line 185
8828  -ephemeral_app
8829#line 185
8830  -isolated_app
8831#line 185
8832  -platform_app
8833#line 185
8834  -priv_app
8835#line 185
8836  -shell
8837#line 185
8838  -system_app
8839#line 185
8840  -untrusted_app_all
8841#line 185
8842} proc_net_type:dir { open getattr read search ioctl lock };
8843#line 185
8844allow {
8845#line 185
8846  appdomain
8847#line 185
8848  -ephemeral_app
8849#line 185
8850  -isolated_app
8851#line 185
8852  -platform_app
8853#line 185
8854  -priv_app
8855#line 185
8856  -shell
8857#line 185
8858  -system_app
8859#line 185
8860  -untrusted_app_all
8861#line 185
8862} proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
8863#line 194
8864
8865# audit access for all these non-core app domains.
8866#line 208
8867
8868
8869# Grant GPU access to all processes started by Zygote.
8870# They need that to render the standard UI.
8871allow { appdomain -isolated_app } gpu_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
8872
8873# Use the Binder.
8874
8875#line 215
8876# Call the servicemanager and transfer references to it.
8877#line 215
8878allow appdomain servicemanager:binder { call transfer };
8879#line 215
8880# servicemanager performs getpidcon on clients.
8881#line 215
8882allow servicemanager appdomain:dir search;
8883#line 215
8884allow servicemanager appdomain:file { read open };
8885#line 215
8886allow servicemanager appdomain:process getattr;
8887#line 215
8888# rw access to /dev/binder and /dev/ashmem is presently granted to
8889#line 215
8890# all domains in domain.te.
8891#line 215
8892
8893# Perform binder IPC to binder services.
8894
8895#line 217
8896# Call the server domain and optionally transfer references to it.
8897#line 217
8898allow appdomain binderservicedomain:binder { call transfer };
8899#line 217
8900# Allow the serverdomain to transfer references to the client on the reply.
8901#line 217
8902allow binderservicedomain appdomain:binder transfer;
8903#line 217
8904# Receive and use open files from the server.
8905#line 217
8906allow appdomain binderservicedomain:fd use;
8907#line 217
8908
8909# Perform binder IPC to other apps.
8910
8911#line 219
8912# Call the server domain and optionally transfer references to it.
8913#line 219
8914allow appdomain appdomain:binder { call transfer };
8915#line 219
8916# Allow the serverdomain to transfer references to the client on the reply.
8917#line 219
8918allow appdomain appdomain:binder transfer;
8919#line 219
8920# Receive and use open files from the server.
8921#line 219
8922allow appdomain appdomain:fd use;
8923#line 219
8924
8925# Perform binder IPC to ephemeral apps.
8926
8927#line 221
8928# Call the server domain and optionally transfer references to it.
8929#line 221
8930allow appdomain ephemeral_app:binder { call transfer };
8931#line 221
8932# Allow the serverdomain to transfer references to the client on the reply.
8933#line 221
8934allow ephemeral_app appdomain:binder transfer;
8935#line 221
8936# Receive and use open files from the server.
8937#line 221
8938allow appdomain ephemeral_app:fd use;
8939#line 221
8940
8941
8942# Talk with graphics composer fences
8943allow appdomain hal_graphics_composer:fd use;
8944
8945# Already connected, unnamed sockets being passed over some other IPC
8946# hence no sock_file or connectto permission. This appears to be how
8947# Chrome works, may need to be updated as more apps using isolated services
8948# are examined.
8949allow appdomain appdomain:unix_stream_socket { getopt getattr read write shutdown };
8950
8951# Backup ability for every app. BMS opens and passes the fd
8952# to any app that has backup ability. Hence, no open permissions here.
8953allow appdomain backup_data_file:file { read write getattr map };
8954allow appdomain cache_backup_file:file { read write getattr map };
8955allow appdomain cache_backup_file:dir getattr;
8956# Backup ability using 'adb backup'
8957allow appdomain system_data_file:lnk_file { getattr open read ioctl lock map };
8958allow appdomain system_data_file:file { getattr read map };
8959
8960# Allow read/stat of /data/media files passed by Binder or local socket IPC.
8961allow { appdomain -isolated_app } media_rw_data_file:file { read getattr };
8962
8963# Read and write /data/data/com.android.providers.telephony files passed over Binder.
8964allow { appdomain -isolated_app } radio_data_file:file { read write getattr };
8965
8966# Allow access to external storage; we have several visible mount points under /storage
8967# and symlinks to primary storage at places like /storage/sdcard0 and /mnt/user/0/primary
8968allow { appdomain -isolated_app -ephemeral_app } storage_file:dir { open getattr read search ioctl lock };
8969allow { appdomain -isolated_app -ephemeral_app } storage_file:lnk_file { getattr open read ioctl lock map };
8970allow { appdomain -isolated_app -ephemeral_app } mnt_user_file:dir { open getattr read search ioctl lock };
8971allow { appdomain -isolated_app -ephemeral_app } mnt_user_file:lnk_file { getattr open read ioctl lock map };
8972
8973# Read/write visible storage
8974allow { appdomain -isolated_app -ephemeral_app } sdcard_type:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
8975allow { appdomain -isolated_app -ephemeral_app } sdcard_type:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
8976# This should be removed if sdcardfs is modified to alter the secontext for its
8977# accesses to the underlying FS.
8978allow { appdomain -isolated_app -ephemeral_app } media_rw_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
8979allow { appdomain -isolated_app -ephemeral_app } media_rw_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
8980
8981# Allow apps to use the USB Accessory interface.
8982# http://developer.android.com/guide/topics/connectivity/usb/accessory.html
8983#
8984# USB devices are first opened by the system server (USBDeviceManagerService)
8985# and the file descriptor is passed to the right Activity via binder.
8986allow { appdomain -isolated_app -ephemeral_app } usb_device:chr_file { read write getattr ioctl };
8987allow { appdomain -isolated_app -ephemeral_app } usbaccessory_device:chr_file { read write getattr };
8988
8989# For art.
8990allow appdomain dalvikcache_data_file:file execute;
8991allow appdomain dalvikcache_data_file:lnk_file { getattr open read ioctl lock map };
8992
8993# Allow any app to read shared RELRO files.
8994allow appdomain shared_relro_file:dir search;
8995allow appdomain shared_relro_file:file { getattr open read ioctl lock map };
8996
8997# Allow apps to read/execute installed binaries
8998allow appdomain apk_data_file:dir { open getattr read search ioctl lock };
8999allow appdomain apk_data_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
9000
9001# /data/resource-cache
9002allow appdomain resourcecache_data_file:file { getattr open read ioctl lock map };
9003allow appdomain resourcecache_data_file:dir { open getattr read search ioctl lock };
9004
9005# logd access
9006
9007#line 287
9008allow appdomain logcat_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
9009#line 287
9010
9011#line 287
9012allow appdomain logdr_socket:sock_file write;
9013#line 287
9014allow appdomain logd:unix_stream_socket connectto;
9015#line 287
9016
9017#line 287
9018
9019
9020#line 288
9021# Group AID_LOG checked by filesystem & logd
9022#line 288
9023# to permit control commands
9024#line 288
9025
9026#line 288
9027allow { appdomain -ephemeral_app } logd_socket:sock_file write;
9028#line 288
9029allow { appdomain -ephemeral_app } logd:unix_stream_socket connectto;
9030#line 288
9031
9032#line 288
9033
9034# application inherit logd write socket (urge is to deprecate this long term)
9035allow appdomain zygote:unix_dgram_socket write;
9036
9037allow { appdomain -isolated_app -ephemeral_app } keystore:keystore_key { get_state get insert delete exist list sign verify };
9038
9039
9040#line 294
9041  allow keystore { appdomain -isolated_app -ephemeral_app }:dir search;
9042#line 294
9043  allow keystore { appdomain -isolated_app -ephemeral_app }:file { read open };
9044#line 294
9045  allow keystore { appdomain -isolated_app -ephemeral_app }:process getattr;
9046#line 294
9047  allow { appdomain -isolated_app -ephemeral_app } keystore_service:service_manager find;
9048#line 294
9049
9050#line 294
9051# Call the server domain and optionally transfer references to it.
9052#line 294
9053allow { appdomain -isolated_app -ephemeral_app } keystore:binder { call transfer };
9054#line 294
9055# Allow the serverdomain to transfer references to the client on the reply.
9056#line 294
9057allow keystore { appdomain -isolated_app -ephemeral_app }:binder transfer;
9058#line 294
9059# Receive and use open files from the server.
9060#line 294
9061allow { appdomain -isolated_app -ephemeral_app } keystore:fd use;
9062#line 294
9063
9064#line 294
9065
9066#line 294
9067# Call the server domain and optionally transfer references to it.
9068#line 294
9069allow keystore { appdomain -isolated_app -ephemeral_app }:binder { call transfer };
9070#line 294
9071# Allow the serverdomain to transfer references to the client on the reply.
9072#line 294
9073allow { appdomain -isolated_app -ephemeral_app } keystore:binder transfer;
9074#line 294
9075# Receive and use open files from the server.
9076#line 294
9077allow keystore { appdomain -isolated_app -ephemeral_app }:fd use;
9078#line 294
9079
9080#line 294
9081
9082
9083allow appdomain console_device:chr_file { read write };
9084
9085# only allow unprivileged socket ioctl commands
9086allowxperm { appdomain -bluetooth } self:{ rawip_socket tcp_socket udp_socket }
9087  ioctl {
9088#line 300
9089{
9090#line 300
9091# Socket ioctls for gathering information about the interface
9092#line 300
90930x00008906 0x00008907
9094#line 300
90950x00008910 0x00008912 0x00008913 0x00008915 0x00008917 0x00008919
9096#line 300
90970x0000891b 0x00008921 0x00008933 0x00008938 0x00008942
9098#line 300
9099# Wireless extension ioctls. Primarily get functions.
9100#line 300
91010x00008b01 0x00008b05 0x00008b07 0x00008b09 0x00008b0b 0x00008b0d
9102#line 300
91030x00008b0f 0x00008b11 0x00008b12 0x00008b13 0x00008b21 0x00008b23
9104#line 300
91050x00008b25 0x00008b27 0x00008b29 0x00008b2d
9106#line 300
9107} {
9108#line 300
9109  0x00005411 0x00005451 0x00005450 0x00005401 0x00005402 0x00005413 0x00005414 0x0000540e
9110#line 300
9111  0x00005403 0x0000540b 0x00005410 0x0000540f
9112#line 300
9113} };
9114
9115allow { appdomain -isolated_app } ion_device:chr_file { getattr open read ioctl lock map };
9116
9117# Allow AAudio apps to use shared memory file descriptors from the HAL
9118allow { appdomain -isolated_app } hal_audio:fd use;
9119
9120# Allow app to access shared memory created by camera HAL1
9121allow { appdomain -isolated_app } hal_camera:fd use;
9122
9123# RenderScript always-passthrough HAL
9124allow { appdomain -isolated_app } hal_renderscript_hwservice:hwservice_manager find;
9125allow appdomain same_process_hal_file:file { execute read open getattr map };
9126
9127# TODO: switch to meminfo service
9128allow appdomain proc_meminfo:file { getattr open read ioctl lock map };
9129
9130# For app fuse.
9131allow appdomain app_fuse_file:file { getattr read append write };
9132
9133
9134#line 320
9135
9136#line 320
9137# Allow client to open the service endpoint file.
9138#line 320
9139allow { appdomain -isolated_app -ephemeral_app } pdx_display_client_endpoint_dir_type:dir { open getattr read search ioctl lock };
9140#line 320
9141allow { appdomain -isolated_app -ephemeral_app } pdx_display_client_endpoint_socket_type:sock_file { { getattr open read ioctl lock map } { open append write lock map } };
9142#line 320
9143# Allow the client to connect to endpoint socket.
9144#line 320
9145allow { appdomain -isolated_app -ephemeral_app } pdx_display_client_endpoint_socket_type:unix_stream_socket { connectto read write shutdown };
9146#line 320
9147
9148#line 320
9149
9150#line 320
9151# Allow the client to use the PDX channel socket.
9152#line 320
9153# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
9154#line 320
9155# than we need (e.g. we don"t need "bind" or "connect").
9156#line 320
9157allow { appdomain -isolated_app -ephemeral_app } pdx_display_client_channel_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown };
9158#line 320
9159# Client needs to use an channel event fd from the server.
9160#line 320
9161allow { appdomain -isolated_app -ephemeral_app } pdx_display_client_server_type:fd use;
9162#line 320
9163# Servers may receive sync fences, gralloc buffers, etc, from clients.
9164#line 320
9165# This could be tightened on a per-server basis, but keeping track of service
9166#line 320
9167# clients is error prone.
9168#line 320
9169allow pdx_display_client_server_type { appdomain -isolated_app -ephemeral_app }:fd use;
9170#line 320
9171
9172#line 320
9173
9174
9175#line 321
9176
9177#line 321
9178# Allow client to open the service endpoint file.
9179#line 321
9180allow { appdomain -isolated_app -ephemeral_app } pdx_display_manager_endpoint_dir_type:dir { open getattr read search ioctl lock };
9181#line 321
9182allow { appdomain -isolated_app -ephemeral_app } pdx_display_manager_endpoint_socket_type:sock_file { { getattr open read ioctl lock map } { open append write lock map } };
9183#line 321
9184# Allow the client to connect to endpoint socket.
9185#line 321
9186allow { appdomain -isolated_app -ephemeral_app } pdx_display_manager_endpoint_socket_type:unix_stream_socket { connectto read write shutdown };
9187#line 321
9188
9189#line 321
9190
9191#line 321
9192# Allow the client to use the PDX channel socket.
9193#line 321
9194# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
9195#line 321
9196# than we need (e.g. we don"t need "bind" or "connect").
9197#line 321
9198allow { appdomain -isolated_app -ephemeral_app } pdx_display_manager_channel_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown };
9199#line 321
9200# Client needs to use an channel event fd from the server.
9201#line 321
9202allow { appdomain -isolated_app -ephemeral_app } pdx_display_manager_server_type:fd use;
9203#line 321
9204# Servers may receive sync fences, gralloc buffers, etc, from clients.
9205#line 321
9206# This could be tightened on a per-server basis, but keeping track of service
9207#line 321
9208# clients is error prone.
9209#line 321
9210allow pdx_display_manager_server_type { appdomain -isolated_app -ephemeral_app }:fd use;
9211#line 321
9212
9213#line 321
9214
9215
9216#line 322
9217
9218#line 322
9219# Allow client to open the service endpoint file.
9220#line 322
9221allow { appdomain -isolated_app -ephemeral_app } pdx_display_vsync_endpoint_dir_type:dir { open getattr read search ioctl lock };
9222#line 322
9223allow { appdomain -isolated_app -ephemeral_app } pdx_display_vsync_endpoint_socket_type:sock_file { { getattr open read ioctl lock map } { open append write lock map } };
9224#line 322
9225# Allow the client to connect to endpoint socket.
9226#line 322
9227allow { appdomain -isolated_app -ephemeral_app } pdx_display_vsync_endpoint_socket_type:unix_stream_socket { connectto read write shutdown };
9228#line 322
9229
9230#line 322
9231
9232#line 322
9233# Allow the client to use the PDX channel socket.
9234#line 322
9235# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
9236#line 322
9237# than we need (e.g. we don"t need "bind" or "connect").
9238#line 322
9239allow { appdomain -isolated_app -ephemeral_app } pdx_display_vsync_channel_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown };
9240#line 322
9241# Client needs to use an channel event fd from the server.
9242#line 322
9243allow { appdomain -isolated_app -ephemeral_app } pdx_display_vsync_server_type:fd use;
9244#line 322
9245# Servers may receive sync fences, gralloc buffers, etc, from clients.
9246#line 322
9247# This could be tightened on a per-server basis, but keeping track of service
9248#line 322
9249# clients is error prone.
9250#line 322
9251allow pdx_display_vsync_server_type { appdomain -isolated_app -ephemeral_app }:fd use;
9252#line 322
9253
9254#line 322
9255
9256
9257#line 323
9258
9259#line 323
9260# Allow client to open the service endpoint file.
9261#line 323
9262allow { appdomain -isolated_app -ephemeral_app } pdx_performance_client_endpoint_dir_type:dir { open getattr read search ioctl lock };
9263#line 323
9264allow { appdomain -isolated_app -ephemeral_app } pdx_performance_client_endpoint_socket_type:sock_file { { getattr open read ioctl lock map } { open append write lock map } };
9265#line 323
9266# Allow the client to connect to endpoint socket.
9267#line 323
9268allow { appdomain -isolated_app -ephemeral_app } pdx_performance_client_endpoint_socket_type:unix_stream_socket { connectto read write shutdown };
9269#line 323
9270
9271#line 323
9272
9273#line 323
9274# Allow the client to use the PDX channel socket.
9275#line 323
9276# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
9277#line 323
9278# than we need (e.g. we don"t need "bind" or "connect").
9279#line 323
9280allow { appdomain -isolated_app -ephemeral_app } pdx_performance_client_channel_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown };
9281#line 323
9282# Client needs to use an channel event fd from the server.
9283#line 323
9284allow { appdomain -isolated_app -ephemeral_app } pdx_performance_client_server_type:fd use;
9285#line 323
9286# Servers may receive sync fences, gralloc buffers, etc, from clients.
9287#line 323
9288# This could be tightened on a per-server basis, but keeping track of service
9289#line 323
9290# clients is error prone.
9291#line 323
9292allow pdx_performance_client_server_type { appdomain -isolated_app -ephemeral_app }:fd use;
9293#line 323
9294
9295#line 323
9296
9297# Apps do not directly open the IPC socket for bufferhubd.
9298
9299#line 325
9300# Allow the client to use the PDX channel socket.
9301#line 325
9302# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
9303#line 325
9304# than we need (e.g. we don"t need "bind" or "connect").
9305#line 325
9306allow { appdomain -isolated_app -ephemeral_app } pdx_bufferhub_client_channel_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown };
9307#line 325
9308# Client needs to use an channel event fd from the server.
9309#line 325
9310allow { appdomain -isolated_app -ephemeral_app } pdx_bufferhub_client_server_type:fd use;
9311#line 325
9312# Servers may receive sync fences, gralloc buffers, etc, from clients.
9313#line 325
9314# This could be tightened on a per-server basis, but keeping track of service
9315#line 325
9316# clients is error prone.
9317#line 325
9318allow pdx_bufferhub_client_server_type { appdomain -isolated_app -ephemeral_app }:fd use;
9319#line 325
9320
9321
9322###
9323### CTS-specific rules
9324###
9325
9326# For cts/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java.
9327# testRunAsHasCorrectCapabilities
9328allow appdomain runas_exec:file getattr;
9329# Others are either allowed elsewhere or not desired.
9330
9331# Apps receive an open tun fd from the framework for
9332# device traffic. Do not allow untrusted app to directly open tun_device
9333allow { appdomain -isolated_app -ephemeral_app } tun_device:chr_file { read write getattr append ioctl };
9334allowxperm { appdomain -isolated_app -ephemeral_app } tun_device:chr_file ioctl 0x800454d2;
9335
9336# Connect to adbd and use a socket transferred from it.
9337# This is used for e.g. adb backup/restore.
9338allow appdomain adbd:unix_stream_socket connectto;
9339allow appdomain adbd:fd use;
9340allow appdomain adbd:unix_stream_socket { getattr getopt ioctl read write shutdown };
9341
9342allow appdomain cache_file:dir getattr;
9343
9344# Allow apps to run with asanwrapper.
9345
9346
9347# Read access to FDs from the DropboxManagerService.
9348allow appdomain dropbox_data_file:file { getattr read };
9349
9350# Read tmpfs types from these processes.
9351allow appdomain audioserver_tmpfs:file { getattr map read write };
9352allow appdomain system_server_tmpfs:file { getattr map read write };
9353allow appdomain zygote_tmpfs:file { map read };
9354
9355# Allow vendor apps access to ashmemd to request /dev/ashmem fds.
9356
9357#line 361
9358# Call the server domain and optionally transfer references to it.
9359#line 361
9360allow { appdomain -coredomain } ashmemd:binder { call transfer };
9361#line 361
9362# Allow the serverdomain to transfer references to the client on the reply.
9363#line 361
9364allow ashmemd { appdomain -coredomain }:binder transfer;
9365#line 361
9366# Receive and use open files from the server.
9367#line 361
9368allow { appdomain -coredomain } ashmemd:fd use;
9369#line 361
9370
9371
9372###
9373### Neverallow rules
9374###
9375### These are things that Android apps should NEVER be able to do
9376###
9377
9378# Superuser capabilities.
9379# bluetooth requires net_admin and wake_alarm. network stack app requires net_admin.
9380neverallow { appdomain -bluetooth -network_stack } self:{ capability capability2 cap_userns cap2_userns } *;
9381
9382# Block device access.
9383neverallow appdomain dev_type:blk_file { read write };
9384
9385# Access to any of the following character devices.
9386neverallow appdomain {
9387    audio_device
9388    camera_device
9389    dm_device
9390    radio_device
9391    rpmsg_device
9392    video_device
9393}:chr_file { read write };
9394
9395# Note: Try expanding list of app domains in the future.
9396neverallow { untrusted_app isolated_app shell } graphics_device:chr_file { read write };
9397
9398neverallow { appdomain -nfc } nfc_device:chr_file
9399    { read write };
9400neverallow { appdomain -bluetooth } hci_attach_dev:chr_file
9401    { read write };
9402neverallow appdomain tee_device:chr_file { read write };
9403
9404# Privileged netlink socket interfaces.
9405neverallow appdomain
9406    domain:{
9407        netlink_tcpdiag_socket
9408        netlink_nflog_socket
9409        netlink_xfrm_socket
9410        netlink_audit_socket
9411        netlink_dnrt_socket
9412    } *;
9413
9414# These messages are broadcast messages from the kernel to userspace.
9415# Do not allow the writing of netlink messages, which has been a source
9416# of rooting vulns in the past.
9417neverallow appdomain domain:netlink_kobject_uevent_socket { write append };
9418
9419# Sockets under /dev/socket that are not specifically typed.
9420neverallow appdomain socket_device:sock_file write;
9421
9422# Unix domain sockets.
9423neverallow appdomain adbd_socket:sock_file write;
9424neverallow { appdomain -radio } rild_socket:sock_file write;
9425
9426# ptrace access to non-app domains.
9427neverallow appdomain { domain -appdomain }:process ptrace;
9428
9429# The Android security model guarantees the confidentiality and integrity
9430# of application data and execution state. Ptrace bypasses those
9431# confidentiality guarantees. Disallow ptrace access from system components
9432# to apps. Crash_dump is excluded, as it needs ptrace access to
9433# produce stack traces.  llkd is excluded, as it needs ptrace access to
9434# inspect stack traces for live lock conditions.
9435
9436neverallow {
9437  domain
9438  -appdomain
9439  -crash_dump
9440
9441} appdomain:process ptrace;
9442
9443# Read or write access to /proc/pid entries for any non-app domain.
9444# A different form of hidepid=2 like protections
9445neverallow appdomain { domain -appdomain }:file { append create link unlink relabelfrom rename setattr write };
9446neverallow { appdomain -shell } { domain -appdomain }:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
9447
9448# signal access to non-app domains.
9449# sigchld allowed for parent death notification.
9450# signull allowed for kill(pid, 0) existence test.
9451# All others prohibited.
9452# -perfetto is to allow shell (which is an appdomain) to kill perfetto
9453# (see private/shell.te).
9454neverallow appdomain { domain -appdomain -perfetto }:process
9455    { sigkill sigstop signal };
9456
9457# Write to rootfs.
9458neverallow appdomain rootfs:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9459    { create write setattr relabelfrom relabelto append unlink link rename };
9460
9461# Write to /system.
9462neverallow appdomain system_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9463    { create write setattr relabelfrom relabelto append unlink link rename };
9464
9465# Write to entrypoint executables.
9466neverallow appdomain exec_type:file
9467    { create write setattr relabelfrom relabelto append unlink link rename };
9468
9469# Write to system-owned parts of /data.
9470# This is the default type for anything under /data not otherwise
9471# specified in file_contexts.  Define a different type for portions
9472# that should be writable by apps.
9473neverallow appdomain system_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9474    { create write setattr relabelfrom relabelto append unlink link rename };
9475
9476# Write to various other parts of /data.
9477neverallow appdomain drm_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9478    { create write setattr relabelfrom relabelto append unlink link rename };
9479neverallow { appdomain -platform_app }
9480    apk_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9481    { create write setattr relabelfrom relabelto append unlink link rename };
9482neverallow { appdomain -platform_app }
9483    apk_tmp_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9484    { create write setattr relabelfrom relabelto append unlink link rename };
9485neverallow { appdomain -platform_app }
9486    apk_private_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9487    { create write setattr relabelfrom relabelto append unlink link rename };
9488neverallow { appdomain -platform_app }
9489    apk_private_tmp_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9490    { create write setattr relabelfrom relabelto append unlink link rename };
9491neverallow { appdomain -shell }
9492    shell_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9493    { create setattr relabelfrom relabelto append unlink link rename };
9494neverallow { appdomain -bluetooth }
9495    bluetooth_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9496    { create write setattr relabelfrom relabelto append unlink link rename };
9497neverallow appdomain
9498    keystore_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9499    { create write setattr relabelfrom relabelto append unlink link rename };
9500neverallow appdomain
9501    systemkeys_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9502    { create write setattr relabelfrom relabelto append unlink link rename };
9503neverallow appdomain
9504    wifi_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9505    { create write setattr relabelfrom relabelto append unlink link rename };
9506neverallow appdomain
9507    dhcp_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
9508    { create write setattr relabelfrom relabelto append unlink link rename };
9509
9510# access tmp apk files
9511neverallow { appdomain -untrusted_app_all -platform_app -priv_app }
9512    { apk_tmp_file apk_private_tmp_file }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } *;
9513
9514neverallow untrusted_app_all { apk_tmp_file apk_private_tmp_file }:{ { chr_file blk_file } dir fifo_file lnk_file sock_file } *;
9515neverallow untrusted_app_all { apk_tmp_file apk_private_tmp_file }:file ~{ getattr read };
9516
9517# Access to factory files.
9518neverallow appdomain efs_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
9519neverallow { appdomain -shell } efs_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } read;
9520
9521# Write to various pseudo file systems.
9522neverallow { appdomain -bluetooth -nfc }
9523    sysfs:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
9524neverallow appdomain
9525    proc:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
9526
9527# Access to syslog(2) or /proc/kmsg.
9528neverallow appdomain kernel:system { syslog_read syslog_mod syslog_console };
9529
9530# SELinux is not an API for apps to use
9531neverallow { appdomain -shell } *:security { compute_av check_context };
9532neverallow { appdomain -shell } *:netlink_selinux_socket *;
9533
9534# Ability to perform any filesystem operation other than statfs(2).
9535# i.e. no mount(2), unmount(2), etc.
9536neverallow appdomain fs_type:filesystem ~getattr;
9537
9538# prevent creation/manipulation of globally readable symlinks
9539neverallow appdomain {
9540  apk_data_file
9541  cache_file
9542  cache_recovery_file
9543  dev_type
9544  rootfs
9545  system_file
9546  tmpfs
9547}:lnk_file { append create link unlink relabelfrom rename setattr write };
9548
9549# Denylist app domains not allowed to execute from /data
9550neverallow {
9551  bluetooth
9552  isolated_app
9553  nfc
9554  radio
9555  shared_relro
9556  system_app
9557} {
9558  data_file_type
9559  -dalvikcache_data_file
9560  -system_data_file # shared libs in apks
9561  -apk_data_file
9562}:file { execute execute_no_trans };
9563
9564# Applications should use the activity model for receiving events
9565neverallow {
9566  appdomain
9567  -shell # bugreport
9568} input_device:chr_file ~getattr;
9569
9570# Do not allow access to Bluetooth-related system properties except for a few allowlisted domains.
9571# neverallow rules for access to Bluetooth-related data files are above.
9572neverallow {
9573  appdomain
9574  -bluetooth
9575  -system_app
9576} { bluetooth_audio_hal_prop bluetooth_a2dp_offload_prop bluetooth_prop exported_bluetooth_prop }:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
9577
9578# Apps cannot access proc_uid_time_in_state
9579neverallow appdomain proc_uid_time_in_state:file *;
9580
9581# Apps cannot access proc_uid_concurrent_active_time
9582neverallow appdomain proc_uid_concurrent_active_time:file *;
9583
9584# Apps cannot access proc_uid_concurrent_policy_time
9585neverallow appdomain proc_uid_concurrent_policy_time:file *;
9586
9587# Apps cannot access proc_uid_cpupower
9588neverallow appdomain proc_uid_cpupower:file *;
9589
9590# Apps may not read /proc/net/{tcp,tcp6,udp,udp6}. These files leak information across the
9591# application boundary. VPN apps may use the ConnectivityManager.getConnectionOwnerUid() API to
9592# perform UID lookups.
9593neverallow { appdomain -shell } proc_net_tcp_udp:file *;
9594
9595# Apps cannot access bootstrap files. The bootstrap files are only for
9596# extremely early processes (like init, etc.) which are started before
9597# the runtime APEX is activated and Bionic libs are provided from there.
9598# If app process accesses (or even load/execute) the bootstrap files,
9599# it might cause problems such as ODR violation, etc.
9600neverallow appdomain system_bootstrap_lib_file:file
9601    { open read write append execute execute_no_trans map };
9602neverallow appdomain system_bootstrap_lib_file:dir
9603    { open read getattr search };
9604#line 1 "system/sepolicy/prebuilts/api/29.0/public/app_zygote.te"
9605# app_zygote is an auxiliary zygote process that is used to spawn
9606# isolated service processes for individual applications. It is
9607# spawned from the regular zygote process as a "child zygote".
9608
9609type app_zygote, domain;
9610type app_zygote_tmpfs, file_type;
9611#line 1 "system/sepolicy/prebuilts/api/29.0/public/asan_extract.te"
9612# asan_extract
9613#
9614# This command set moves the artifact corresponding to the current slot
9615# from /data/ota to /data/dalvik-cache.
9616
9617#line 36
9618
9619#line 1 "system/sepolicy/prebuilts/api/29.0/public/ashmemd.te"
9620type ashmemd, domain;
9621#line 1 "system/sepolicy/prebuilts/api/29.0/public/audioserver.te"
9622# audioserver - audio services daemon
9623type audioserver, domain;
9624type audioserver_tmpfs, file_type;
9625#line 1 "system/sepolicy/prebuilts/api/29.0/public/blkid.te"
9626# blkid called from vold
9627type blkid, domain;
9628#line 1 "system/sepolicy/prebuilts/api/29.0/public/blkid_untrusted.te"
9629# blkid for untrusted block devices
9630type blkid_untrusted, domain;
9631#line 1 "system/sepolicy/prebuilts/api/29.0/public/bluetooth.te"
9632# bluetooth subsystem
9633type bluetooth, domain;
9634#line 1 "system/sepolicy/prebuilts/api/29.0/public/bootanim.te"
9635# bootanimation oneshot service
9636type bootanim, domain;
9637type bootanim_exec, system_file_type, exec_type, file_type;
9638
9639
9640#line 5
9641typeattribute bootanim halclientdomain;
9642#line 5
9643typeattribute bootanim hal_configstore_client;
9644#line 5
9645
9646#line 5
9647# TODO(b/34170079): Make the inclusion of the rules below conditional also on
9648#line 5
9649# non-Treble devices. For now, on non-Treble device, always grant clients of a
9650#line 5
9651# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
9652#line 5
9653
9654#line 5
9655
9656
9657#line 6
9658typeattribute bootanim halclientdomain;
9659#line 6
9660typeattribute bootanim hal_graphics_allocator_client;
9661#line 6
9662
9663#line 6
9664# TODO(b/34170079): Make the inclusion of the rules below conditional also on
9665#line 6
9666# non-Treble devices. For now, on non-Treble device, always grant clients of a
9667#line 6
9668# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
9669#line 6
9670
9671#line 6
9672
9673
9674#line 7
9675typeattribute bootanim halclientdomain;
9676#line 7
9677typeattribute bootanim hal_graphics_composer_client;
9678#line 7
9679
9680#line 7
9681# TODO(b/34170079): Make the inclusion of the rules below conditional also on
9682#line 7
9683# non-Treble devices. For now, on non-Treble device, always grant clients of a
9684#line 7
9685# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
9686#line 7
9687
9688#line 7
9689
9690
9691
9692#line 9
9693# Call the servicemanager and transfer references to it.
9694#line 9
9695allow bootanim servicemanager:binder { call transfer };
9696#line 9
9697# servicemanager performs getpidcon on clients.
9698#line 9
9699allow servicemanager bootanim:dir search;
9700#line 9
9701allow servicemanager bootanim:file { read open };
9702#line 9
9703allow servicemanager bootanim:process getattr;
9704#line 9
9705# rw access to /dev/binder and /dev/ashmem is presently granted to
9706#line 9
9707# all domains in domain.te.
9708#line 9
9709
9710
9711#line 10
9712# Call the server domain and optionally transfer references to it.
9713#line 10
9714allow bootanim surfaceflinger:binder { call transfer };
9715#line 10
9716# Allow the serverdomain to transfer references to the client on the reply.
9717#line 10
9718allow surfaceflinger bootanim:binder transfer;
9719#line 10
9720# Receive and use open files from the server.
9721#line 10
9722allow bootanim surfaceflinger:fd use;
9723#line 10
9724
9725
9726#line 11
9727# Call the server domain and optionally transfer references to it.
9728#line 11
9729allow bootanim audioserver:binder { call transfer };
9730#line 11
9731# Allow the serverdomain to transfer references to the client on the reply.
9732#line 11
9733allow audioserver bootanim:binder transfer;
9734#line 11
9735# Receive and use open files from the server.
9736#line 11
9737allow bootanim audioserver:fd use;
9738#line 11
9739
9740
9741
9742#line 13
9743# Call the hwservicemanager and transfer references to it.
9744#line 13
9745allow bootanim hwservicemanager:binder { call transfer };
9746#line 13
9747# Allow hwservicemanager to send out callbacks
9748#line 13
9749allow hwservicemanager bootanim:binder { call transfer };
9750#line 13
9751# hwservicemanager performs getpidcon on clients.
9752#line 13
9753allow hwservicemanager bootanim:dir search;
9754#line 13
9755allow hwservicemanager bootanim:file { read open map };
9756#line 13
9757allow hwservicemanager bootanim:process getattr;
9758#line 13
9759# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
9760#line 13
9761# all domains in domain.te.
9762#line 13
9763
9764
9765allow bootanim gpu_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
9766
9767# /oem access
9768allow bootanim oemfs:dir search;
9769allow bootanim oemfs:file { getattr open read ioctl lock map };
9770
9771allow bootanim audio_device:dir { open getattr read search ioctl lock };
9772allow bootanim audio_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
9773
9774allow bootanim audioserver_service:service_manager find;
9775allow bootanim surfaceflinger_service:service_manager find;
9776
9777# Allow access to ion memory allocation device
9778allow bootanim ion_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
9779allow bootanim hal_graphics_allocator:fd use;
9780
9781# Fences
9782allow bootanim hal_graphics_composer:fd use;
9783
9784# Read access to pseudo filesystems.
9785allow bootanim proc_meminfo:file { getattr open read ioctl lock map };
9786
9787# System file accesses.
9788allow bootanim system_file:dir { open getattr read search ioctl lock };
9789
9790# Read ro.boot.bootreason b/30654343
9791
9792#line 41
9793allow bootanim bootloader_boot_reason_prop:file { getattr open read map };
9794#line 41
9795
9796
9797#line 1 "system/sepolicy/prebuilts/api/29.0/public/bootstat.te"
9798# bootstat command
9799type bootstat, domain;
9800type bootstat_exec, system_file_type, exec_type, file_type;
9801
9802
9803#line 5
9804allow bootstat runtime_event_log_tags_file:file { getattr open read ioctl lock map };
9805#line 5
9806
9807
9808# Allow persistent storage in /data/misc/bootstat.
9809allow bootstat bootstat_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
9810allow bootstat bootstat_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
9811
9812# Collect metrics on boot time created by init
9813
9814#line 12
9815allow bootstat boottime_prop:file { getattr open read map };
9816#line 12
9817
9818
9819# Read/Write [persist.]sys.boot.reason and ro.boot.bootreason (write if empty)
9820
9821#line 15
9822
9823#line 15
9824allow bootstat property_socket:sock_file write;
9825#line 15
9826allow bootstat init:unix_stream_socket connectto;
9827#line 15
9828
9829#line 15
9830allow bootstat bootloader_boot_reason_prop:property_service set;
9831#line 15
9832
9833#line 15
9834allow bootstat bootloader_boot_reason_prop:file { getattr open read map };
9835#line 15
9836
9837#line 15
9838
9839
9840#line 16
9841
9842#line 16
9843allow bootstat property_socket:sock_file write;
9844#line 16
9845allow bootstat init:unix_stream_socket connectto;
9846#line 16
9847
9848#line 16
9849allow bootstat system_boot_reason_prop:property_service set;
9850#line 16
9851
9852#line 16
9853allow bootstat system_boot_reason_prop:file { getattr open read map };
9854#line 16
9855
9856#line 16
9857
9858
9859#line 17
9860
9861#line 17
9862allow bootstat property_socket:sock_file write;
9863#line 17
9864allow bootstat init:unix_stream_socket connectto;
9865#line 17
9866
9867#line 17
9868allow bootstat last_boot_reason_prop:property_service set;
9869#line 17
9870
9871#line 17
9872allow bootstat last_boot_reason_prop:file { getattr open read map };
9873#line 17
9874
9875#line 17
9876
9877
9878# ToDo: TBI move access for the following to a system health HAL
9879
9880# Allow access to /sys/fs/pstore/ and syslog
9881allow bootstat pstorefs:dir search;
9882allow bootstat pstorefs:file { getattr open read ioctl lock map };
9883allow bootstat kernel:system syslog_read;
9884
9885# Allow access to reading the logs to read aspects of system health
9886
9887#line 27
9888allow bootstat logcat_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
9889#line 27
9890
9891#line 27
9892allow bootstat logdr_socket:sock_file write;
9893#line 27
9894allow bootstat logd:unix_stream_socket connectto;
9895#line 27
9896
9897#line 27
9898
9899
9900# Allow bootstat write to statsd.
9901
9902#line 30
9903allow bootstat statsdw_socket:sock_file write;
9904#line 30
9905allow bootstat statsd:unix_dgram_socket sendto;
9906#line 30
9907
9908
9909# ToDo: end
9910
9911neverallow {
9912  domain
9913  -bootanim
9914  -bootstat
9915  -dumpstate
9916  -init
9917  -recovery
9918  -shell
9919  -system_server
9920} { bootloader_boot_reason_prop last_boot_reason_prop }:file { getattr open read ioctl lock map };
9921# ... and refine, as these components should not set the last boot reason
9922neverallow { bootanim recovery } last_boot_reason_prop:file { getattr open read ioctl lock map };
9923
9924neverallow {
9925  domain
9926  -bootstat
9927  -init
9928  -system_server
9929} { bootloader_boot_reason_prop last_boot_reason_prop }:property_service set;
9930# ... and refine ... for a ro propertly no less ... keep this _tight_
9931neverallow system_server bootloader_boot_reason_prop:property_service set;
9932
9933neverallow {
9934  domain
9935  -bootstat
9936  -init
9937} system_boot_reason_prop:property_service set;
9938#line 1 "system/sepolicy/prebuilts/api/29.0/public/bufferhubd.te"
9939# bufferhubd
9940type bufferhubd, domain, mlstrustedsubject;
9941type bufferhubd_exec, system_file_type, exec_type, file_type;
9942
9943
9944#line 5
9945typeattribute bufferhubd halclientdomain;
9946#line 5
9947typeattribute bufferhubd hal_graphics_allocator_client;
9948#line 5
9949
9950#line 5
9951# TODO(b/34170079): Make the inclusion of the rules below conditional also on
9952#line 5
9953# non-Treble devices. For now, on non-Treble device, always grant clients of a
9954#line 5
9955# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
9956#line 5
9957
9958#line 5
9959
9960
9961# TODO(b/112338294): remove these after migrate to Binder
9962
9963#line 8
9964# Mark the server domain as a PDX server.
9965#line 8
9966typeattribute bufferhubd pdx_bufferhub_client_server_type;
9967#line 8
9968# Allow the init process to create the initial endpoint socket.
9969#line 8
9970allow init pdx_bufferhub_client_endpoint_socket_type:unix_stream_socket { create bind };
9971#line 8
9972# Allow the server domain to use the endpoint socket and accept connections on it.
9973#line 8
9974# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
9975#line 8
9976# than we need (e.g. we don"t need "bind" or "connect").
9977#line 8
9978allow bufferhubd pdx_bufferhub_client_endpoint_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown listen accept };
9979#line 8
9980# Allow the server domain to apply security context label to the channel socket pair (allow process to use setsockcreatecon_raw()).
9981#line 8
9982allow bufferhubd self:process setsockcreate;
9983#line 8
9984# Allow the server domain to create a client channel socket.
9985#line 8
9986allow bufferhubd pdx_bufferhub_client_channel_socket_type:unix_stream_socket { create { { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } listen accept } };
9987#line 8
9988# Prevent other processes from claiming to be a server for the same service.
9989#line 8
9990neverallow {domain -bufferhubd} pdx_bufferhub_client_endpoint_socket_type:unix_stream_socket { listen accept };
9991#line 8
9992
9993
9994#line 9
9995
9996#line 9
9997# Allow client to open the service endpoint file.
9998#line 9
9999allow bufferhubd pdx_performance_client_endpoint_dir_type:dir { open getattr read search ioctl lock };
10000#line 9
10001allow bufferhubd pdx_performance_client_endpoint_socket_type:sock_file { { getattr open read ioctl lock map } { open append write lock map } };
10002#line 9
10003# Allow the client to connect to endpoint socket.
10004#line 9
10005allow bufferhubd pdx_performance_client_endpoint_socket_type:unix_stream_socket { connectto read write shutdown };
10006#line 9
10007
10008#line 9
10009
10010#line 9
10011# Allow the client to use the PDX channel socket.
10012#line 9
10013# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
10014#line 9
10015# than we need (e.g. we don"t need "bind" or "connect").
10016#line 9
10017allow bufferhubd pdx_performance_client_channel_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown };
10018#line 9
10019# Client needs to use an channel event fd from the server.
10020#line 9
10021allow bufferhubd pdx_performance_client_server_type:fd use;
10022#line 9
10023# Servers may receive sync fences, gralloc buffers, etc, from clients.
10024#line 9
10025# This could be tightened on a per-server basis, but keeping track of service
10026#line 9
10027# clients is error prone.
10028#line 9
10029allow pdx_performance_client_server_type bufferhubd:fd use;
10030#line 9
10031
10032#line 9
10033
10034
10035# Access the GPU.
10036allow bufferhubd gpu_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10037
10038# Access /dev/ion
10039allow bufferhubd ion_device:chr_file { getattr open read ioctl lock map };
10040
10041# Receive sync fence FDs from hal_omx_server. Note that hal_omx_server never directly
10042# connects to bufferhubd via PDX. Instead, a VR app acts as a bridge between
10043# those two: it talks to hal_omx_server via Binder and talks to bufferhubd via PDX.
10044# Thus, there is no need to use pdx_client macro.
10045allow bufferhubd hal_omx_server:fd use;
10046
10047# Codec2 is similar to OMX
10048allow bufferhubd hal_codec2_server:fd use;
10049
10050#line 1 "system/sepolicy/prebuilts/api/29.0/public/camera_service_server.te"
10051
10052#line 1
10053  allow camera_service_server fwk_camera_hwservice:hwservice_manager { add find };
10054#line 1
10055  allow camera_service_server hidl_base_hwservice:hwservice_manager add;
10056#line 1
10057  neverallow { domain -camera_service_server } fwk_camera_hwservice:hwservice_manager add;
10058#line 1
10059
10060#line 1 "system/sepolicy/prebuilts/api/29.0/public/cameraserver.te"
10061# cameraserver - camera daemon
10062type cameraserver, domain;
10063type cameraserver_exec, system_file_type, exec_type, file_type;
10064type cameraserver_tmpfs, file_type;
10065
10066
10067#line 6
10068# Call the servicemanager and transfer references to it.
10069#line 6
10070allow cameraserver servicemanager:binder { call transfer };
10071#line 6
10072# servicemanager performs getpidcon on clients.
10073#line 6
10074allow servicemanager cameraserver:dir search;
10075#line 6
10076allow servicemanager cameraserver:file { read open };
10077#line 6
10078allow servicemanager cameraserver:process getattr;
10079#line 6
10080# rw access to /dev/binder and /dev/ashmem is presently granted to
10081#line 6
10082# all domains in domain.te.
10083#line 6
10084
10085
10086#line 7
10087# Call the server domain and optionally transfer references to it.
10088#line 7
10089allow cameraserver binderservicedomain:binder { call transfer };
10090#line 7
10091# Allow the serverdomain to transfer references to the client on the reply.
10092#line 7
10093allow binderservicedomain cameraserver:binder transfer;
10094#line 7
10095# Receive and use open files from the server.
10096#line 7
10097allow cameraserver binderservicedomain:fd use;
10098#line 7
10099
10100
10101#line 8
10102# Call the server domain and optionally transfer references to it.
10103#line 8
10104allow cameraserver appdomain:binder { call transfer };
10105#line 8
10106# Allow the serverdomain to transfer references to the client on the reply.
10107#line 8
10108allow appdomain cameraserver:binder transfer;
10109#line 8
10110# Receive and use open files from the server.
10111#line 8
10112allow cameraserver appdomain:fd use;
10113#line 8
10114
10115
10116#line 9
10117typeattribute cameraserver binderservicedomain;
10118#line 9
10119
10120
10121
10122#line 11
10123typeattribute cameraserver halclientdomain;
10124#line 11
10125typeattribute cameraserver hal_camera_client;
10126#line 11
10127
10128#line 11
10129# TODO(b/34170079): Make the inclusion of the rules below conditional also on
10130#line 11
10131# non-Treble devices. For now, on non-Treble device, always grant clients of a
10132#line 11
10133# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
10134#line 11
10135
10136#line 11
10137
10138
10139
10140#line 13
10141typeattribute cameraserver halclientdomain;
10142#line 13
10143typeattribute cameraserver hal_graphics_allocator_client;
10144#line 13
10145
10146#line 13
10147# TODO(b/34170079): Make the inclusion of the rules below conditional also on
10148#line 13
10149# non-Treble devices. For now, on non-Treble device, always grant clients of a
10150#line 13
10151# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
10152#line 13
10153
10154#line 13
10155
10156
10157allow cameraserver ion_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10158
10159# Talk with graphics composer fences
10160allow cameraserver hal_graphics_composer:fd use;
10161
10162
10163#line 20
10164  allow cameraserver cameraserver_service:service_manager { add find };
10165#line 20
10166  neverallow { domain -cameraserver } cameraserver_service:service_manager add;
10167#line 20
10168
10169
10170#line 21
10171  allow cameraserver fwk_camera_hwservice:hwservice_manager { add find };
10172#line 21
10173  allow cameraserver hidl_base_hwservice:hwservice_manager add;
10174#line 21
10175  neverallow { domain -cameraserver } fwk_camera_hwservice:hwservice_manager add;
10176#line 21
10177
10178
10179allow cameraserver activity_service:service_manager find;
10180allow cameraserver appops_service:service_manager find;
10181allow cameraserver audioserver_service:service_manager find;
10182allow cameraserver batterystats_service:service_manager find;
10183allow cameraserver cameraproxy_service:service_manager find;
10184allow cameraserver mediaserver_service:service_manager find;
10185allow cameraserver processinfo_service:service_manager find;
10186allow cameraserver scheduling_policy_service:service_manager find;
10187allow cameraserver sensor_privacy_service:service_manager find;
10188allow cameraserver surfaceflinger_service:service_manager find;
10189
10190allow cameraserver hidl_token_hwservice:hwservice_manager find;
10191
10192###
10193### neverallow rules
10194###
10195
10196# cameraserver should never execute any executable without a
10197# domain transition
10198neverallow cameraserver { file_type fs_type }:file execute_no_trans;
10199
10200# The goal of the mediaserver split is to place media processing code into
10201# restrictive sandboxes with limited responsibilities and thus limited
10202# permissions. Example: Audioserver is only responsible for controlling audio
10203# hardware and processing audio content. Cameraserver does the same for camera
10204# hardware/content. Etc.
10205#
10206# Media processing code is inherently risky and thus should have limited
10207# permissions and be isolated from the rest of the system and network.
10208# Lengthier explanation here:
10209# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
10210neverallow cameraserver domain:{ tcp_socket udp_socket rawip_socket } *;
10211
10212# Allow shell commands from ADB for CTS testing/dumping
10213allow cameraserver adbd:fd use;
10214allow cameraserver adbd:unix_stream_socket { read write };
10215allow cameraserver shell:fd use;
10216allow cameraserver shell:unix_stream_socket { read write };
10217allow cameraserver shell:fifo_file { read write };
10218
10219# Allow to talk with media codec
10220allow cameraserver mediametrics_service:service_manager find;
10221
10222#line 65
10223typeattribute cameraserver halclientdomain;
10224#line 65
10225typeattribute cameraserver hal_codec2_client;
10226#line 65
10227
10228#line 65
10229# TODO(b/34170079): Make the inclusion of the rules below conditional also on
10230#line 65
10231# non-Treble devices. For now, on non-Treble device, always grant clients of a
10232#line 65
10233# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
10234#line 65
10235
10236#line 65
10237
10238
10239#line 66
10240typeattribute cameraserver halclientdomain;
10241#line 66
10242typeattribute cameraserver hal_omx_client;
10243#line 66
10244
10245#line 66
10246# TODO(b/34170079): Make the inclusion of the rules below conditional also on
10247#line 66
10248# non-Treble devices. For now, on non-Treble device, always grant clients of a
10249#line 66
10250# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
10251#line 66
10252
10253#line 66
10254
10255
10256#line 67
10257typeattribute cameraserver halclientdomain;
10258#line 67
10259typeattribute cameraserver hal_allocator_client;
10260#line 67
10261
10262#line 67
10263# TODO(b/34170079): Make the inclusion of the rules below conditional also on
10264#line 67
10265# non-Treble devices. For now, on non-Treble device, always grant clients of a
10266#line 67
10267# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
10268#line 67
10269
10270#line 67
10271
10272
10273# Allow shell commands from ADB for CTS testing/dumping
10274#line 74
10275
10276#line 1 "system/sepolicy/prebuilts/api/29.0/public/charger.te"
10277type charger, domain;
10278type charger_exec, system_file_type, exec_type, file_type;
10279
10280# Write to /dev/kmsg
10281allow charger kmsg_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10282
10283# Read access to pseudo filesystems.
10284
10285#line 8
10286allow charger rootfs:dir { open getattr read search ioctl lock };
10287#line 8
10288allow charger rootfs:{ file lnk_file } { getattr open read ioctl lock map };
10289#line 8
10290
10291
10292#line 9
10293allow charger cgroup:dir { open getattr read search ioctl lock };
10294#line 9
10295allow charger cgroup:{ file lnk_file } { getattr open read ioctl lock map };
10296#line 9
10297
10298
10299# Allow to read /sys/class/power_supply directory
10300allow charger sysfs_type:dir { open getattr read search ioctl lock };
10301
10302allow charger self:{ capability cap_userns } { sys_tty_config };
10303allow charger self:{ capability cap_userns } sys_boot;
10304
10305
10306#line 17
10307# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
10308#line 17
10309# deprecated.
10310#line 17
10311# Access /sys/power/wake_lock and /sys/power/wake_unlock
10312#line 17
10313allow charger sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
10314#line 17
10315# Accessing these files requires CAP_BLOCK_SUSPEND
10316#line 17
10317allow charger self:{ capability2 cap2_userns } block_suspend;
10318#line 17
10319# system_suspend permissions
10320#line 17
10321
10322#line 17
10323# Call the server domain and optionally transfer references to it.
10324#line 17
10325allow charger system_suspend_server:binder { call transfer };
10326#line 17
10327# Allow the serverdomain to transfer references to the client on the reply.
10328#line 17
10329allow system_suspend_server charger:binder transfer;
10330#line 17
10331# Receive and use open files from the server.
10332#line 17
10333allow charger system_suspend_server:fd use;
10334#line 17
10335
10336#line 17
10337allow charger system_suspend_hwservice:hwservice_manager find;
10338#line 17
10339# halclientdomain permissions
10340#line 17
10341
10342#line 17
10343# Call the hwservicemanager and transfer references to it.
10344#line 17
10345allow charger hwservicemanager:binder { call transfer };
10346#line 17
10347# Allow hwservicemanager to send out callbacks
10348#line 17
10349allow hwservicemanager charger:binder { call transfer };
10350#line 17
10351# hwservicemanager performs getpidcon on clients.
10352#line 17
10353allow hwservicemanager charger:dir search;
10354#line 17
10355allow hwservicemanager charger:file { read open map };
10356#line 17
10357allow hwservicemanager charger:process getattr;
10358#line 17
10359# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
10360#line 17
10361# all domains in domain.te.
10362#line 17
10363
10364#line 17
10365
10366#line 17
10367allow charger hwservicemanager_prop:file { getattr open read map };
10368#line 17
10369
10370#line 17
10371allow charger hidl_manager_hwservice:hwservice_manager find;
10372#line 17
10373
10374
10375allow charger self:netlink_kobject_uevent_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
10376
10377# Read/write to /sys/power/state
10378allow charger sysfs_power:file { { getattr open read ioctl lock map } { open append write lock map } };
10379
10380
10381#line 24
10382allow charger sysfs_batteryinfo:dir { open getattr read search ioctl lock };
10383#line 24
10384allow charger sysfs_batteryinfo:{ file lnk_file } { getattr open read ioctl lock map };
10385#line 24
10386
10387
10388# Read /sys/fs/pstore/console-ramoops
10389# Don't worry about overly broad permissions for now, as there's
10390# only one file in /sys/fs/pstore
10391allow charger pstorefs:dir { open getattr read search ioctl lock };
10392allow charger pstorefs:file { getattr open read ioctl lock map };
10393
10394allow charger graphics_device:dir { open getattr read search ioctl lock };
10395allow charger graphics_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10396allow charger input_device:dir { open getattr read search ioctl lock };
10397allow charger input_device:chr_file { getattr open read ioctl lock map };
10398allow charger tty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10399allow charger proc_sysrq:file { { getattr open read ioctl lock map } { open append write lock map } };
10400
10401# charger needs to tell init to continue the boot
10402# process when running in charger mode.
10403
10404#line 41
10405
10406#line 41
10407allow charger property_socket:sock_file write;
10408#line 41
10409allow charger init:unix_stream_socket connectto;
10410#line 41
10411
10412#line 41
10413allow charger system_prop:property_service set;
10414#line 41
10415
10416#line 41
10417allow charger system_prop:file { getattr open read map };
10418#line 41
10419
10420#line 41
10421
10422
10423#line 42
10424
10425#line 42
10426allow charger property_socket:sock_file write;
10427#line 42
10428allow charger init:unix_stream_socket connectto;
10429#line 42
10430
10431#line 42
10432allow charger exported_system_prop:property_service set;
10433#line 42
10434
10435#line 42
10436allow charger exported_system_prop:file { getattr open read map };
10437#line 42
10438
10439#line 42
10440
10441
10442#line 43
10443
10444#line 43
10445allow charger property_socket:sock_file write;
10446#line 43
10447allow charger init:unix_stream_socket connectto;
10448#line 43
10449
10450#line 43
10451allow charger exported2_system_prop:property_service set;
10452#line 43
10453
10454#line 43
10455allow charger exported2_system_prop:file { getattr open read map };
10456#line 43
10457
10458#line 43
10459
10460
10461#line 44
10462
10463#line 44
10464allow charger property_socket:sock_file write;
10465#line 44
10466allow charger init:unix_stream_socket connectto;
10467#line 44
10468
10469#line 44
10470allow charger exported3_system_prop:property_service set;
10471#line 44
10472
10473#line 44
10474allow charger exported3_system_prop:file { getattr open read map };
10475#line 44
10476
10477#line 44
10478
10479#line 1 "system/sepolicy/prebuilts/api/29.0/public/clatd.te"
10480# 464xlat daemon
10481type clatd, domain;
10482type clatd_exec, system_file_type, exec_type, file_type;
10483
10484
10485#line 5
10486typeattribute clatd netdomain;
10487#line 5
10488
10489
10490
10491#line 7
10492allow clatd proc_net_type:dir { open getattr read search ioctl lock };
10493#line 7
10494allow clatd proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
10495#line 7
10496
10497#line 10
10498
10499
10500# Access objects inherited from netd.
10501allow clatd netd:fd use;
10502allow clatd netd:fifo_file { read write };
10503# TODO: Check whether some or all of these sockets should be close-on-exec.
10504allow clatd netd:netlink_kobject_uevent_socket { read write };
10505allow clatd netd:netlink_nflog_socket { read write };
10506allow clatd netd:netlink_route_socket { read write };
10507allow clatd netd:udp_socket { read write };
10508allow clatd netd:unix_stream_socket { read write };
10509allow clatd netd:unix_dgram_socket { read write };
10510
10511allow clatd self:{ capability cap_userns } { net_admin net_raw setuid setgid };
10512
10513# clatd calls mmap(MAP_LOCKED) with a 1M buffer. MAP_LOCKED first checks
10514# capable(CAP_IPC_LOCK), and then checks to see the requested amount is
10515# under RLIMIT_MEMLOCK. If the latter check succeeds clatd won't have
10516# needed CAP_IPC_LOCK. But this is not guaranteed to succeed on all devices
10517# so we permit any requests we see from clatd asking for this capability.
10518# See https://android-review.googlesource.com/127940 and
10519# https://b.corp.google.com/issues/21736319
10520allow clatd self:{ capability cap_userns } ipc_lock;
10521
10522allow clatd self:netlink_route_socket nlmsg_write;
10523allow clatd self:{ packet_socket rawip_socket } { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
10524allow clatd tun_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };type crash_dump, domain;
10525#line 2 "system/sepolicy/prebuilts/api/29.0/public/crash_dump.te"
10526type crash_dump_exec, system_file_type, exec_type, file_type;
10527
10528# crash_dump might inherit CAP_SYS_PTRACE from a privileged process,
10529# which will result in an audit log even when it's allowed to trace.
10530dontaudit crash_dump self:{ capability cap_userns } { sys_ptrace };
10531
10532#line 13
10533
10534
10535# Use inherited file descriptors
10536allow crash_dump domain:fd use;
10537
10538# Read/write IPC pipes inherited from crashing processes.
10539allow crash_dump domain:fifo_file { read write };
10540
10541# Append to pipes given to us by processes requesting dumps (e.g. dumpstate)
10542allow crash_dump domain:fifo_file { append };
10543
10544
10545#line 24
10546allow crash_dump domain:dir { open getattr read search ioctl lock };
10547#line 24
10548allow crash_dump domain:{ file lnk_file } { getattr open read ioctl lock map };
10549#line 24
10550
10551allow crash_dump exec_type:file { getattr open read ioctl lock map };
10552
10553# Read /data/dalvik-cache.
10554allow crash_dump dalvikcache_data_file:dir { search getattr };
10555allow crash_dump dalvikcache_data_file:file { getattr open read ioctl lock map };
10556
10557# Read APK files.
10558
10559#line 32
10560allow crash_dump apk_data_file:dir { open getattr read search ioctl lock };
10561#line 32
10562allow crash_dump apk_data_file:{ file lnk_file } { getattr open read ioctl lock map };
10563#line 32
10564;
10565
10566# Read all /vendor
10567
10568#line 35
10569allow crash_dump { vendor_file same_process_hal_file }:dir { open getattr read search ioctl lock };
10570#line 35
10571allow crash_dump { vendor_file same_process_hal_file }:{ file lnk_file } { getattr open read ioctl lock map };
10572#line 35
10573
10574
10575# Talk to tombstoned
10576
10577#line 38
10578allow crash_dump tombstoned_crash_socket:sock_file write;
10579#line 38
10580allow crash_dump tombstoned:unix_stream_socket connectto;
10581#line 38
10582
10583
10584# Talk to ActivityManager.
10585
10586#line 41
10587allow crash_dump system_ndebug_socket:sock_file write;
10588#line 41
10589allow crash_dump system_server:unix_stream_socket connectto;
10590#line 41
10591
10592
10593# Append to ANR files.
10594allow crash_dump anr_data_file:file { append getattr };
10595
10596# Append to tombstone files.
10597allow crash_dump tombstone_data_file:file { append getattr };
10598
10599# crash_dump writes out logcat logs at the bottom of tombstones,
10600# which is super useful in some cases.
10601
10602#line 51
10603allow crash_dump logdr_socket:sock_file write;
10604#line 51
10605allow crash_dump logd:unix_stream_socket connectto;
10606#line 51
10607
10608
10609# Crash dump is not intended to access the following files. Since these
10610# are WAI, suppress the denials to clean up the logs.
10611dontaudit crash_dump {
10612  core_data_file_type
10613  vendor_file_type
10614}:dir search;
10615dontaudit crash_dump system_data_file:file read;
10616dontaudit crash_dump property_type:file read;
10617
10618###
10619### neverallow assertions
10620###
10621
10622# A domain transition must occur for crash_dump to get the privileges needed to trace the process.
10623# Do not allow the execution of crash_dump without a domain transition.
10624neverallow domain crash_dump_exec:file execute_no_trans;
10625#line 1 "system/sepolicy/prebuilts/api/29.0/public/device.te"
10626# Device types
10627type device, dev_type, fs_type;
10628type ashmem_device, dev_type, mlstrustedobject;
10629type audio_device, dev_type;
10630type binder_device, dev_type, mlstrustedobject;
10631type hwbinder_device, dev_type, mlstrustedobject;
10632type vndbinder_device, dev_type;
10633type block_device, dev_type;
10634type camera_device, dev_type;
10635type dm_device, dev_type;
10636type keychord_device, dev_type;
10637type loop_control_device, dev_type;
10638type loop_device, dev_type;
10639type pmsg_device, dev_type, mlstrustedobject;
10640type radio_device, dev_type;
10641type ram_device, dev_type;
10642type rtc_device, dev_type;
10643type vold_device, dev_type;
10644type console_device, dev_type;
10645type fscklogs, dev_type;
10646# GPU (used by most UI apps)
10647type gpu_device, dev_type, mlstrustedobject;
10648type graphics_device, dev_type;
10649type hw_random_device, dev_type;
10650type input_device, dev_type;
10651type port_device, dev_type;
10652type lowpan_device, dev_type;
10653type mtp_device, dev_type, mlstrustedobject;
10654type nfc_device, dev_type;
10655type ptmx_device, dev_type, mlstrustedobject;
10656type kmsg_device, dev_type;
10657type kmsg_debug_device, dev_type;
10658type null_device, dev_type, mlstrustedobject;
10659type random_device, dev_type, mlstrustedobject;
10660type secure_element_device, dev_type;
10661type sensors_device, dev_type;
10662type serial_device, dev_type;
10663type socket_device, dev_type;
10664type owntty_device, dev_type, mlstrustedobject;
10665type tty_device, dev_type;
10666type video_device, dev_type;
10667type zero_device, dev_type, mlstrustedobject;
10668type fuse_device, dev_type, mlstrustedobject;
10669type iio_device, dev_type;
10670type ion_device, dev_type, mlstrustedobject;
10671type qtaguid_device, dev_type;
10672type watchdog_device, dev_type;
10673type uhid_device, dev_type;
10674type uio_device, dev_type;
10675type tun_device, dev_type, mlstrustedobject;
10676type usbaccessory_device, dev_type, mlstrustedobject;
10677type usb_device, dev_type, mlstrustedobject;
10678type properties_device, dev_type;
10679type properties_serial, dev_type;
10680type property_info, dev_type;
10681
10682# All devices have a uart for the hci
10683# attach service. The uart dev node
10684# varies per device. This type
10685# is used in per device policy
10686type hci_attach_dev, dev_type;
10687
10688# All devices have a rpmsg device for
10689# achieving remoteproc and rpmsg modules
10690type rpmsg_device, dev_type;
10691
10692# Partition layout block device
10693type root_block_device, dev_type;
10694
10695# factory reset protection block device
10696type frp_block_device, dev_type;
10697
10698# System block device mounted on /system.
10699# Documented at https://source.android.com/devices/bootloader/partitions-images
10700type system_block_device, dev_type;
10701
10702# Recovery block device.
10703# Documented at https://source.android.com/devices/bootloader/partitions-images
10704type recovery_block_device, dev_type;
10705
10706# boot block device.
10707# Documented at https://source.android.com/devices/bootloader/partitions-images
10708type boot_block_device, dev_type;
10709
10710# Userdata block device mounted on /data.
10711# Documented at https://source.android.com/devices/bootloader/partitions-images
10712type userdata_block_device, dev_type;
10713
10714# Cache block device mounted on /cache.
10715# Documented at https://source.android.com/devices/bootloader/partitions-images
10716type cache_block_device, dev_type;
10717
10718# Block device for any swap partition.
10719type swap_block_device, dev_type;
10720
10721# Metadata block device used for encryption metadata.
10722# Assign this type to the partition specified by the encryptable=
10723# mount option in your fstab file in the entry for userdata.
10724# Documented at https://source.android.com/devices/bootloader/partitions-images
10725type metadata_block_device, dev_type;
10726
10727# The 'misc' partition used by recovery and A/B.
10728# Documented at https://source.android.com/devices/bootloader/partitions-images
10729type misc_block_device, dev_type;
10730
10731# 'super' partition to be used for logical partitioning.
10732type super_block_device, super_block_device_type, dev_type;
10733
10734# sdcard devices; normally vold uses the vold_block_device label and creates a
10735# separate device node. gsid, however, accesses the original devide node
10736# created through uevents, so we use a separate label.
10737type sdcard_block_device, dev_type;
10738#line 1 "system/sepolicy/prebuilts/api/29.0/public/dhcp.te"
10739type dhcp, domain;
10740type dhcp_exec, system_file_type, exec_type, file_type;
10741
10742
10743#line 4
10744typeattribute dhcp netdomain;
10745#line 4
10746
10747
10748allow dhcp cgroup:dir { create write add_name };
10749allow dhcp self:{ capability cap_userns } { setgid setuid net_admin net_raw net_bind_service };
10750allow dhcp self:packet_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
10751allow dhcp self:netlink_route_socket nlmsg_write;
10752allow dhcp shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
10753allow dhcp system_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
10754
10755
10756# dhcpcd runs dhcpcd-hooks/*, which runs getprop / setprop (toolbox_exec)
10757allow dhcp toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
10758
10759# For /proc/sys/net/ipv4/conf/*/promote_secondaries
10760allow dhcp proc_net_type:file write;
10761
10762
10763#line 20
10764
10765#line 20
10766allow dhcp property_socket:sock_file write;
10767#line 20
10768allow dhcp init:unix_stream_socket connectto;
10769#line 20
10770
10771#line 20
10772allow dhcp dhcp_prop:property_service set;
10773#line 20
10774
10775#line 20
10776allow dhcp dhcp_prop:file { getattr open read map };
10777#line 20
10778
10779#line 20
10780
10781
10782#line 21
10783
10784#line 21
10785allow dhcp property_socket:sock_file write;
10786#line 21
10787allow dhcp init:unix_stream_socket connectto;
10788#line 21
10789
10790#line 21
10791allow dhcp pan_result_prop:property_service set;
10792#line 21
10793
10794#line 21
10795allow dhcp pan_result_prop:file { getattr open read map };
10796#line 21
10797
10798#line 21
10799
10800
10801allow dhcp dhcp_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
10802allow dhcp dhcp_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
10803
10804# PAN connections
10805allow dhcp netd:fd use;
10806allow dhcp netd:fifo_file { { getattr open read ioctl lock map } { open append write lock map } };
10807allow dhcp netd:{ { udp_socket unix_dgram_socket } unix_stream_socket } { read write };
10808allow dhcp netd:{ netlink_kobject_uevent_socket netlink_route_socket netlink_nflog_socket } { read write };
10809#line 1 "system/sepolicy/prebuilts/api/29.0/public/display_service_server.te"
10810
10811#line 1
10812  allow display_service_server fwk_display_hwservice:hwservice_manager { add find };
10813#line 1
10814  allow display_service_server hidl_base_hwservice:hwservice_manager add;
10815#line 1
10816  neverallow { domain -display_service_server } fwk_display_hwservice:hwservice_manager add;
10817#line 1
10818
10819#line 1 "system/sepolicy/prebuilts/api/29.0/public/dnsmasq.te"
10820# DNS, DHCP services
10821type dnsmasq, domain;
10822type dnsmasq_exec, system_file_type, exec_type, file_type;
10823
10824
10825#line 5
10826typeattribute dnsmasq netdomain;
10827#line 5
10828
10829allowxperm dnsmasq self:udp_socket ioctl
10830#line 6
10831{
10832#line 6
10833# qualcomm rmnet ioctls
10834#line 6
108350x00006900 0x00006902
10836#line 6
10837# socket ioctls
10838#line 6
108390x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
10840#line 6
108410x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
10842#line 6
108430x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
10844#line 6
108450x00008927 0x00008929 0x00008930 0x00008931 0x00008932
10846#line 6
108470x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
10848#line 6
108490x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
10850#line 6
108510x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
10852#line 6
108530x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
10854#line 6
108550x00008991 0x00008992 0x00008993 0x00008994
10856#line 6
108570x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
10858#line 6
10859# device and protocol specific ioctls
10860#line 6
108610x000089f0-0x000089ff
10862#line 6
108630x000089e0-0x000089ef
10864#line 6
10865# Wireless extension ioctls
10866#line 6
108670x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
10868#line 6
108690x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
10870#line 6
108710x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
10872#line 6
108730x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
10874#line 6
108750x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
10876#line 6
108770x00008b34 0x00008b35 0x00008b36
10878#line 6
10879# Dev private ioctl i.e. hardware specific ioctls
10880#line 6
108810x00008be0-0x00008bff
10882#line 6
10883};
10884
10885# TODO:  Run with dhcp group to avoid need for dac_override.
10886allow dnsmasq self:{ capability cap_userns } { dac_override dac_read_search };
10887
10888allow dnsmasq self:{ capability cap_userns } { net_admin net_raw net_bind_service setgid setuid };
10889
10890allow dnsmasq dhcp_data_file:dir { open search write add_name remove_name lock };
10891allow dnsmasq dhcp_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
10892
10893# Inherit and use open files from netd.
10894allow dnsmasq netd:fd use;
10895allow dnsmasq netd:fifo_file { getattr read write };
10896# TODO: Investigate whether these inherited sockets should be closed on exec.
10897allow dnsmasq netd:netlink_kobject_uevent_socket { read write };
10898allow dnsmasq netd:netlink_nflog_socket { read write };
10899allow dnsmasq netd:netlink_route_socket { read write };
10900allow dnsmasq netd:unix_stream_socket { getattr read write };
10901allow dnsmasq netd:unix_dgram_socket { read write };
10902allow dnsmasq netd:udp_socket { read write };
10903#line 1 "system/sepolicy/prebuilts/api/29.0/public/domain.te"
10904# Rules for all domains.
10905
10906# Allow reaping by init.
10907allow domain init:process sigchld;
10908
10909# Intra-domain accesses.
10910allow domain self:process {
10911    fork
10912    sigchld
10913    sigkill
10914    sigstop
10915    signull
10916    signal
10917    getsched
10918    setsched
10919    getsession
10920    getpgid
10921    setpgid
10922    getcap
10923    setcap
10924    getattr
10925    setrlimit
10926};
10927allow domain self:fd use;
10928allow domain proc:dir { open getattr read search ioctl lock };
10929allow domain proc_net_type:dir search;
10930
10931#line 27
10932allow domain self:dir { open getattr read search ioctl lock };
10933#line 27
10934allow domain self:{ file lnk_file } { getattr open read ioctl lock map };
10935#line 27
10936
10937allow domain self:{ fifo_file file } { { getattr open read ioctl lock map } { open append write lock map } };
10938allow domain self:unix_dgram_socket { { create { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } } sendto };
10939allow domain self:unix_stream_socket { { create { { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } listen accept } } connectto };
10940
10941# Inherit or receive open files from others.
10942allow domain init:fd use;
10943
10944#line 52
10945
10946
10947#line 58
10948
10949
10950# Root fs.
10951allow domain tmpfs:dir { getattr search };
10952allow domain rootfs:dir search;
10953allow domain rootfs:lnk_file { read getattr };
10954
10955# Device accesses.
10956allow domain device:dir search;
10957allow domain dev_type:lnk_file { getattr open read ioctl lock map };
10958allow domain devpts:dir search;
10959allow domain socket_device:dir { open getattr read search ioctl lock };
10960allow domain owntty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10961allow domain null_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10962allow domain zero_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10963allow {
10964  domain
10965  # TODO(b/113362644): route coredomain to ashmemd
10966  #-coredomain
10967  -mediaprovider
10968  -ephemeral_app
10969  -isolated_app
10970  -untrusted_app_all
10971} ashmem_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10972
10973# Allow using fds to /dev/ashmem.
10974allow domain ashmemd:fd use;
10975
10976# /dev/binder can be accessed by non-vendor domains and by apps
10977allow {
10978  coredomain
10979  appdomain
10980  binder_in_vendor_violators # TODO(b/35870313): Remove once all violations are gone
10981  -hwservicemanager
10982} binder_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10983# Devices which are not full TREBLE have fewer restrictions on access to /dev/binder
10984
10985allow { domain -servicemanager -vndservicemanager -isolated_app } hwbinder_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10986allow domain ptmx_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10987allow domain random_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
10988allow domain proc_random:dir { open getattr read search ioctl lock };
10989allow domain proc_random:file { getattr open read ioctl lock map };
10990allow domain properties_device:dir { search getattr };
10991allow domain properties_serial:file { getattr open read ioctl lock map };
10992allow domain property_info:file { getattr open read ioctl lock map };
10993
10994# Public readable properties
10995
10996#line 105
10997allow domain debug_prop:file { getattr open read map };
10998#line 105
10999
11000
11001#line 106
11002allow domain exported_config_prop:file { getattr open read map };
11003#line 106
11004
11005
11006#line 107
11007allow domain exported_default_prop:file { getattr open read map };
11008#line 107
11009
11010
11011#line 108
11012allow domain exported_dumpstate_prop:file { getattr open read map };
11013#line 108
11014
11015
11016#line 109
11017allow domain exported_fingerprint_prop:file { getattr open read map };
11018#line 109
11019
11020
11021#line 110
11022allow domain exported_radio_prop:file { getattr open read map };
11023#line 110
11024
11025
11026#line 111
11027allow domain exported_secure_prop:file { getattr open read map };
11028#line 111
11029
11030
11031#line 112
11032allow domain exported_system_prop:file { getattr open read map };
11033#line 112
11034
11035
11036#line 113
11037allow domain exported_vold_prop:file { getattr open read map };
11038#line 113
11039
11040
11041#line 114
11042allow domain exported2_default_prop:file { getattr open read map };
11043#line 114
11044
11045
11046#line 115
11047allow domain logd_prop:file { getattr open read map };
11048#line 115
11049
11050
11051# Let everyone read log properties, so that liblog can avoid sending unloggable
11052# messages to logd.
11053
11054#line 119
11055allow domain log_property_type:file { getattr open read map };
11056#line 119
11057
11058dontaudit domain property_type:file audit_access;
11059allow domain property_contexts_file:file { getattr open read ioctl lock map };
11060
11061allow domain init:key search;
11062allow domain vold:key search;
11063
11064# logd access
11065
11066#line 127
11067
11068#line 127
11069allow domain logdw_socket:sock_file write;
11070#line 127
11071allow domain logd:unix_dgram_socket sendto;
11072#line 127
11073
11074#line 127
11075allow domain pmsg_device:chr_file { open append write lock map };
11076#line 127
11077
11078
11079# Directory/link file access for path resolution.
11080allow domain {
11081    system_file
11082    system_lib_file
11083    system_seccomp_policy_file
11084    system_security_cacerts_file
11085}:dir { open getattr read search ioctl lock };
11086allow domain system_file:lnk_file { getattr read };
11087
11088# Global access to /system/etc/security/cacerts/*, /system/etc/seccomp_policy/*, /system/lib[64]/*,
11089# linker and its config.
11090allow domain system_seccomp_policy_file:file { getattr open read ioctl lock map };
11091# cacerts are accessible from public Java API.
11092allow domain system_security_cacerts_file:file { getattr open read ioctl lock map };
11093allow domain system_linker_exec:file { execute read open getattr map };
11094allow domain system_linker_config_file:file { getattr open read ioctl lock map };
11095allow domain system_lib_file:file { execute read open getattr map };
11096# To allow following symlinks at /system/bin/linker, /system/lib/libc.so, etc.
11097allow domain system_linker_exec:lnk_file { read open getattr };
11098allow domain system_lib_file:lnk_file { read open getattr };
11099
11100allow domain system_event_log_tags_file:file { getattr open read ioctl lock map };
11101
11102allow { appdomain coredomain } system_file:file { execute read open getattr map };
11103
11104# Make sure system/vendor split doesn not affect non-treble
11105# devices
11106#line 161
11107
11108
11109# All domains are allowed to open and read directories
11110# that contain HAL implementations (e.g. passthrough
11111# HALs require clients to have these permissions)
11112allow domain vendor_hal_file:dir { open getattr read search ioctl lock };
11113
11114# Everyone can read and execute all same process HALs
11115allow domain same_process_hal_file:dir { open getattr read search ioctl lock };
11116allow {
11117    domain
11118    -coredomain # access is explicitly granted to individual coredomains
11119} same_process_hal_file:file { execute read open getattr map };
11120
11121# Any process can load vndk-sp libraries, which are system libraries
11122# used by same process HALs
11123allow domain vndk_sp_file:dir { open getattr read search ioctl lock };
11124allow domain vndk_sp_file:file { execute read open getattr map };
11125
11126# All domains get access to /vendor/etc
11127allow domain vendor_configs_file:dir { open getattr read search ioctl lock };
11128allow domain vendor_configs_file:file { read open getattr map };
11129
11130
11131#line 184
11132    # Allow all domains to be able to follow /system/vendor and/or
11133#line 184
11134    # /vendor/odm symlinks.
11135#line 184
11136    allow domain vendor_file_type:lnk_file { getattr open read };
11137#line 184
11138
11139#line 184
11140    # This is required to be able to search & read /vendor/lib64
11141#line 184
11142    # in order to lookup vendor libraries. The execute permission
11143#line 184
11144    # for coredomains is granted *only* for same process HALs
11145#line 184
11146    allow domain vendor_file:dir { getattr search };
11147#line 184
11148
11149#line 184
11150    # Allow reading and executing out of /vendor to all vendor domains
11151#line 184
11152    allow { domain -coredomain } vendor_file_type:dir { open getattr read search ioctl lock };
11153#line 184
11154    allow { domain -coredomain } vendor_file_type:file { read open getattr execute map };
11155#line 184
11156    allow { domain -coredomain } vendor_file_type:lnk_file { getattr read };
11157#line 198
11158
11159
11160# read and stat any sysfs symlinks
11161allow domain sysfs:lnk_file { getattr read };
11162
11163# libc references /data/misc/zoneinfo and /system/usr/share/zoneinfo for
11164# timezone related information.
11165# This directory is considered to be a VNDK-stable
11166allow domain { system_zoneinfo_file zoneinfo_data_file }:file { getattr open read ioctl lock map };
11167allow domain { system_zoneinfo_file zoneinfo_data_file }:dir { open getattr read search ioctl lock };
11168
11169# Lots of processes access current CPU information
11170
11171#line 210
11172allow domain sysfs_devices_system_cpu:dir { open getattr read search ioctl lock };
11173#line 210
11174allow domain sysfs_devices_system_cpu:{ file lnk_file } { getattr open read ioctl lock map };
11175#line 210
11176
11177
11178
11179#line 212
11180allow domain sysfs_usb:dir { open getattr read search ioctl lock };
11181#line 212
11182allow domain sysfs_usb:{ file lnk_file } { getattr open read ioctl lock map };
11183#line 212
11184;
11185
11186# If kernel CONFIG_TRANSPARENT_HUGEPAGE is enabled, libjemalloc5 (statically
11187# included by libc) reads /sys/kernel/mm/transparent_hugepage/enabled.
11188allow domain sysfs_transparent_hugepage:dir search;
11189allow domain sysfs_transparent_hugepage:file { getattr open read ioctl lock map };
11190
11191# files under /data.
11192#line 222
11193
11194allow { coredomain appdomain } system_data_file:dir getattr;
11195# /data has the label system_data_file. Vendor components need the search
11196# permission on system_data_file for path traversal to /data/vendor.
11197allow domain system_data_file:dir search;
11198# TODO restrict this to non-coredomain
11199allow domain vendor_data_file:dir { getattr search };
11200
11201# required by the dynamic linker
11202allow domain proc:lnk_file { getattr read };
11203
11204# /proc/cpuinfo
11205allow domain proc_cpuinfo:file { getattr open read ioctl lock map };
11206
11207# /dev/cpu_variant:.*
11208allow domain dev_cpu_variant:file { getattr open read ioctl lock map };
11209
11210# jemalloc needs to read /proc/sys/vm/overcommit_memory
11211allow domain proc_overcommit_memory:file { getattr open read ioctl lock map };
11212
11213# profiling needs to read /proc/sys/kernel/perf_event_max_sample_rate
11214allow domain proc_perf:file { getattr open read ioctl lock map };
11215
11216# toybox loads libselinux which stats /sys/fs/selinux/
11217allow domain selinuxfs:dir search;
11218allow domain selinuxfs:file getattr;
11219allow domain sysfs:dir search;
11220allow domain selinuxfs:filesystem getattr;
11221
11222# Almost all processes log tracing information to
11223# /sys/kernel/debug/tracing/trace_marker
11224# The reason behind this is documented in b/6513400
11225allow domain debugfs:dir search;
11226allow domain debugfs_tracing:dir search;
11227allow domain debugfs_tracing_debug:dir search;
11228allow domain debugfs_trace_marker:file { open append write lock map };
11229
11230# Filesystem access.
11231allow domain fs_type:filesystem getattr;
11232allow domain fs_type:dir getattr;
11233
11234# Restrict all domains to a allowlist for common socket types. Additional
11235# ioctl commands may be added to individual domains, but this sets safe
11236# defaults for all processes. Note that granting this allowlist to domain does
11237# not grant the ioctl permission on these socket types. That must be granted
11238# separately.
11239allowxperm domain domain:{ icmp_socket rawip_socket tcp_socket udp_socket }
11240  ioctl {
11241#line 269
11242{
11243#line 269
11244# Socket ioctls for gathering information about the interface
11245#line 269
112460x00008906 0x00008907
11247#line 269
112480x00008910 0x00008912 0x00008913 0x00008915 0x00008917 0x00008919
11249#line 269
112500x0000891b 0x00008921 0x00008933 0x00008938 0x00008942
11251#line 269
11252# Wireless extension ioctls. Primarily get functions.
11253#line 269
112540x00008b01 0x00008b05 0x00008b07 0x00008b09 0x00008b0b 0x00008b0d
11255#line 269
112560x00008b0f 0x00008b11 0x00008b12 0x00008b13 0x00008b21 0x00008b23
11257#line 269
112580x00008b25 0x00008b27 0x00008b29 0x00008b2d
11259#line 269
11260} {
11261#line 269
11262  0x00005411 0x00005451 0x00005450 0x00005401 0x00005402 0x00005413 0x00005414 0x0000540e
11263#line 269
11264  0x00005403 0x0000540b 0x00005410 0x0000540f
11265#line 269
11266} };
11267# default allowlist for unix sockets.
11268allowxperm domain { domain pdx_channel_socket_type }:{ unix_dgram_socket unix_stream_socket }
11269  ioctl {
11270#line 272
11271  0x00005411 0x00005451 0x00005450 0x00005401 0x00005413 0x00005414 0x0000541b
11272#line 272
11273};
11274
11275# Restrict PTYs to only allowlisted ioctls.
11276# Note that granting this allowlist to domain does
11277# not grant the wider ioctl permission. That must be granted
11278# separately.
11279allowxperm domain devpts:chr_file ioctl {
11280#line 278
11281  0x00005411 0x00005451 0x00005450 0x00005401 0x00005402 0x00005413 0x00005414 0x0000540e
11282#line 278
11283  0x00005403 0x0000540b 0x00005410 0x0000540f
11284#line 278
11285};
11286
11287# All domains must clearly enumerate what ioctls they use
11288# on filesystem objects (plain files, directories, symbolic links,
11289# named pipes, and named sockets). We start off with a safe set.
11290allowxperm domain { file_type fs_type domain dev_type }:{ dir { file lnk_file sock_file fifo_file } blk_file } ioctl { 0x00005451 0x00005450 };
11291
11292# If a domain has ioctl access to tun_device, it must clearly enumerate the
11293# ioctls used. Safe defaults are listed below.
11294allowxperm domain tun_device:chr_file ioctl { 0x00005451 0x00005450 };
11295
11296# Allow a process to make a determination whether a file descriptor
11297# for a plain file or pipe (fifo_file) is a tty. Note that granting
11298# this allowlist to domain does not grant the ioctl permission to
11299# these files. That must be granted separately.
11300allowxperm domain { file_type fs_type }:file ioctl { 0x00005401 };
11301allowxperm domain domain:fifo_file ioctl { 0x00005401 };
11302
11303# If a domain has access to perform an ioctl on a block device, allow these
11304# very common, benign ioctls
11305allowxperm domain dev_type:blk_file ioctl { 0x80081272 0x00001268 };
11306
11307# Support sqlite F2FS specific optimizations
11308# ioctl permission on the specific file type is still required
11309# TODO: consider only compiling these rules if we know the
11310# /data partition is F2FS
11311allowxperm domain { file_type sdcard_type }:file ioctl {
11312  0xf505
11313  0xf502
11314  0xf50c
11315  0xf50e
11316  0xf50d
11317  0xf501
11318};
11319
11320# Workaround for policy compiler being too aggressive and removing hwservice_manager_type
11321# when it's not explicitly used in allow rules
11322allow { domain -domain } hwservice_manager_type:hwservice_manager { add find };
11323# Workaround for policy compiler being too aggressive and removing vndservice_manager_type
11324# when it's not explicitly used in allow rules
11325allow { domain -domain } vndservice_manager_type:service_manager { add find };
11326
11327# Under ASAN, processes will try to read /data, as the sanitized libraries are there.
11328
11329# Under ASAN, /system/asan.options needs to be globally accessible.
11330
11331
11332# read APEX dir and stat any symlink pointing to APEXs.
11333allow domain apex_mnt_dir:dir { getattr search };
11334allow domain apex_mnt_dir:lnk_file { getattr open read ioctl lock map };
11335
11336###
11337### neverallow rules
11338###
11339
11340# All ioctls on file-like objects (except chr_file and blk_file) and
11341# sockets must be restricted to a allowlist.
11342neverallowxperm * *:{ dir { file lnk_file sock_file fifo_file } { socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket appletalk_socket netlink_route_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket xdp_socket } blk_file } ioctl { 0 };
11343
11344# b/68014825 and https://android-review.googlesource.com/516535
11345# rfc6093 says that processes should not use the TCP urgent mechanism
11346neverallowxperm domain domain:{ socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket appletalk_socket netlink_route_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket xdp_socket } ioctl { 0x00008905 };
11347
11348# TIOCSTI is only ever used for exploits. Block it.
11349# b/33073072, b/7530569
11350# http://www.openwall.com/lists/oss-security/2016/09/26/14
11351neverallowxperm * devpts:chr_file ioctl 0x00005412;
11352
11353# Do not allow any domain other than init to create unlabeled files.
11354neverallow { domain -init -recovery } unlabeled:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } create;
11355
11356# Limit device node creation to these allowlisted domains.
11357neverallow {
11358  domain
11359  -kernel
11360  -init
11361  -ueventd
11362  -vold
11363} self:{ capability cap_userns } mknod;
11364
11365# No process can map low memory (< CONFIG_LSM_MMAP_MIN_ADDR).
11366neverallow * self:memprotect mmap_zero;
11367
11368# No domain needs mac_override as it is unused by SELinux.
11369neverallow * self:{ capability2 cap2_userns } mac_override;
11370
11371# Disallow attempts to set contexts not defined in current policy
11372# This helps guarantee that unknown or dangerous contents will not ever
11373# be set.
11374neverallow * self:{ capability2 cap2_userns } mac_admin;
11375
11376# Once the policy has been loaded there shall be none to modify the policy.
11377# It is sealed.
11378neverallow * kernel:security load_policy;
11379
11380# Only init prior to switching context should be able to set enforcing mode.
11381# init starts in kernel domain and switches to init domain via setcon in
11382# the init.rc, so the setenforce occurs while still in kernel. After
11383# switching domains, there is never any need to setenforce again by init.
11384neverallow * kernel:security setenforce;
11385neverallow { domain -kernel } kernel:security setcheckreqprot;
11386
11387# No booleans in AOSP policy, so no need to ever set them.
11388neverallow * kernel:security setbool;
11389
11390# Adjusting the AVC cache threshold.
11391# Not presently allowed to anything in policy, but possibly something
11392# that could be set from init.rc.
11393neverallow { domain -init } kernel:security setsecparam;
11394
11395# Only init, ueventd, shell and system_server should be able to access HW RNG
11396neverallow {
11397  domain
11398  -init
11399  -shell # For CTS and is restricted to getattr in shell.te
11400  -system_server
11401  -ueventd
11402} hw_random_device:chr_file *;
11403# b/78174219 b/64114943
11404neverallow {
11405  domain
11406  -shell # stat of /dev, getattr only
11407  -ueventd
11408} keychord_device:chr_file *;
11409
11410# Ensure that all entrypoint executables are in exec_type or postinstall_file.
11411neverallow * { file_type -exec_type -postinstall_file }:file entrypoint;
11412
11413# The dynamic linker always calls access(2) on the path. Don't generate SElinux
11414# denials since the linker does not actually access the path in case the path
11415# does not exist or isn't accessible for the process.
11416dontaudit domain postinstall_mnt_dir:dir audit_access;
11417
11418#Ensure that nothing in userspace can access /dev/port
11419neverallow {
11420  domain
11421  -shell # Shell user should not have any abilities outside of getattr
11422  -ueventd
11423} port_device:chr_file *;
11424neverallow * port_device:chr_file ~{ create relabelto unlink setattr getattr };
11425# Only init should be able to configure kernel usermodehelpers or
11426# security-sensitive proc settings.
11427neverallow { domain -init } usermodehelper:file { append write };
11428neverallow { domain -init -ueventd } sysfs_usermodehelper:file { append write };
11429neverallow { domain -init -vendor_init } proc_security:file { append open read write };
11430
11431# Nobody is allowed to make binder calls into init.
11432# Only servicemanager may transfer binder references to init
11433# vendor_init shouldn't use binder at all.
11434neverallow * init:binder ~{ transfer };
11435neverallow { domain -servicemanager } init:binder { transfer };
11436neverallow * vendor_init:binder *;
11437
11438# Don't allow raw read/write/open access to block_device
11439# Rather force a relabel to a more specific type
11440neverallow { domain -kernel -init -recovery } block_device:blk_file { open read write };
11441
11442# Do not allow renaming of block files or character files
11443# Ability to do so can lead to possible use in an exploit chain
11444# e.g. https://googleprojectzero.blogspot.com/2016/12/chrome-os-exploit-one-byte-overflow-and.html
11445neverallow * *:{ blk_file chr_file } rename;
11446
11447# Don't allow raw read/write/open access to generic devices.
11448# Rather force a relabel to a more specific type.
11449neverallow domain device:chr_file { open read write };
11450
11451# Files from cache should never be executed
11452neverallow domain { cache_file cache_backup_file cache_private_backup_file cache_recovery_file }:file execute;
11453
11454# Protect most domains from executing arbitrary content from /data.
11455neverallow {
11456  domain
11457  -appdomain
11458} {
11459  data_file_type
11460  -dalvikcache_data_file
11461  -system_data_file # shared libs in apks
11462  -apk_data_file
11463}:file { execute execute_no_trans };
11464
11465# The test files and executables MUST not be accessible to any domain
11466neverallow { domain  } nativetest_data_file:{ { chr_file blk_file } { file lnk_file sock_file fifo_file } } { append create link unlink relabelfrom rename setattr write };
11467neverallow domain nativetest_data_file:dir { add_name create link relabelfrom remove_name rename reparent rmdir setattr write };
11468neverallow { domain  } nativetest_data_file:file { execute execute_no_trans };
11469
11470# Only the init property service should write to /data/property and /dev/__properties__
11471neverallow { domain -init } property_data_file:dir { add_name create link relabelfrom remove_name rename reparent rmdir setattr write };
11472neverallow { domain -init } property_data_file:file { { append create link unlink relabelfrom rename setattr write } { execute execute_no_trans } };
11473neverallow { domain -init } property_type:file { { append create link unlink relabelfrom rename setattr write } { execute execute_no_trans } };
11474neverallow { domain -init } properties_device:file { { append create link unlink relabelfrom rename setattr write } { execute execute_no_trans } };
11475neverallow { domain -init } properties_serial:file { { append create link unlink relabelfrom rename setattr write } { execute execute_no_trans } };
11476
11477# Nobody should be doing writes to /system & /vendor
11478# These partitions are intended to be read-only and must never be
11479# modified. Doing so would violate important Android security guarantees
11480# and invalidate dm-verity signatures.
11481neverallow {
11482    domain
11483
11484
11485} {
11486    system_file_type
11487    vendor_file_type
11488    exec_type
11489}:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } { create write setattr relabelfrom append unlink link rename };
11490
11491neverallow { domain -kernel  } { system_file_type vendor_file_type exec_type }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } relabelto;
11492
11493# Don't allow mounting on top of /system files or directories
11494neverallow * exec_type:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } mounton;
11495neverallow { domain -init } { system_file_type vendor_file_type }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } mounton;
11496
11497# Nothing should be writing to files in the rootfs.
11498neverallow * rootfs:file { create write setattr relabelto append unlink link rename };
11499
11500# Restrict context mounts to specific types marked with
11501# the contextmount_type attribute.
11502neverallow * {fs_type -contextmount_type}:filesystem relabelto;
11503
11504# Ensure that context mount types are not writable, to ensure that
11505# the write to /system restriction above is not bypassed via context=
11506# mount to another type.
11507neverallow * contextmount_type:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } }
11508    { create setattr relabelfrom relabelto append link rename };
11509neverallow { domain  } contextmount_type:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } { write unlink };
11510
11511# Do not allow service_manager add for default service labels.
11512# Instead domains should use a more specific type such as
11513# system_app_service rather than the generic type.
11514# New service_types are defined in {,hw,vnd}service.te and new mappings
11515# from service name to service_type are defined in {,hw,vnd}service_contexts.
11516neverallow * default_android_service:service_manager add;
11517neverallow * default_android_vndservice:service_manager { add find };
11518neverallow * default_android_hwservice:hwservice_manager { add find };
11519
11520# Looking up the base class/interface of all HwBinder services is a bad idea.
11521# hwservicemanager currently offer such lookups only to make it so that security
11522# decisions are expressed in SELinux policy. However, it's unclear whether this
11523# lookup has security implications. If it doesn't, hwservicemanager should be
11524# modified to not offer this lookup.
11525# This rule can be removed if hwservicemanager is modified to not permit these
11526# lookups.
11527neverallow * hidl_base_hwservice:hwservice_manager find;
11528
11529# Require that domains explicitly label unknown properties, and do not allow
11530# anyone but init to modify unknown properties.
11531neverallow { domain -init -vendor_init } default_prop:property_service set;
11532neverallow { domain -init -vendor_init } mmc_prop:property_service set;
11533
11534
11535#line 527
11536    neverallow { domain -init } default_prop:property_service set;
11537#line 527
11538    neverallow { domain -init } mmc_prop:property_service set;
11539#line 527
11540    neverallow { domain -init -vendor_init } exported_default_prop:property_service set;
11541#line 527
11542    neverallow { domain -init } exported_secure_prop:property_service set;
11543#line 527
11544    neverallow { domain -init } exported2_default_prop:property_service set;
11545#line 527
11546    neverallow { domain -init -vendor_init } exported3_default_prop:property_service set;
11547#line 527
11548    neverallow { domain -init -vendor_init } vendor_default_prop:property_service set;
11549#line 535
11550
11551
11552# Only core domains are allowed to access package_manager properties
11553neverallow { domain -init -system_server } pm_prop:property_service set;
11554neverallow { domain -coredomain } pm_prop:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11555
11556
11557#line 541
11558    neverallow { domain -init -system_server -vendor_init } exported_pm_prop:property_service set;
11559#line 541
11560    neverallow { domain -coredomain -vendor_init } exported_pm_prop:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11561#line 544
11562
11563
11564# Do not allow reading device's serial number from system properties except form
11565# a few allowlisted domains.
11566neverallow {
11567  domain
11568  -adbd
11569  -dumpstate
11570  -fastbootd
11571  -hal_camera_server
11572  -hal_cas_server
11573  -hal_drm_server
11574  -init
11575  -mediadrmserver
11576  -recovery
11577  -shell
11578  -system_server
11579  -vendor_init
11580} serialno_prop:file { getattr open read ioctl lock map };
11581
11582# Do not allow reading the last boot timestamp from system properties
11583neverallow { domain -init -system_server -dumpstate } firstboot_prop:file { getattr open read ioctl lock map };
11584
11585neverallow {
11586  domain
11587  -init
11588  -recovery
11589  -system_server
11590  -shell # Shell is further restricted in shell.te
11591  -ueventd # Further restricted in ueventd.te
11592} frp_block_device:blk_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11593
11594# The metadata block device is set aside for device encryption and
11595# verified boot metadata. It may be reset at will and should not
11596# be used by other domains.
11597neverallow {
11598  domain
11599  -init
11600  -recovery
11601  -vold
11602  -e2fs
11603  -fsck
11604  -fastbootd
11605} metadata_block_device:blk_file { append link rename write open read ioctl lock };
11606
11607# No domain other than recovery, update_engine and fastbootd can write to system partition(s).
11608neverallow {
11609  domain
11610  -fastbootd
11611
11612
11613  -recovery
11614  -update_engine
11615} system_block_device:blk_file { write append };
11616
11617# No domains other than a select few can access the misc_block_device. This
11618# block device is reserved for OTA use.
11619# Do not assert this rule on userdebug/eng builds, due to some devices using
11620# this partition for testing purposes.
11621neverallow {
11622  domain
11623   # exclude debuggable builds
11624  -fastbootd
11625  -hal_bootctl_server
11626  -init
11627  -uncrypt
11628  -update_engine
11629  -vendor_init
11630  -vendor_misc_writer
11631  -vold
11632  -recovery
11633  -ueventd
11634} misc_block_device:blk_file { append link relabelfrom rename write open read ioctl lock };
11635
11636# Only (hw|vnd|)servicemanager should be able to register with binder as the context manager
11637neverallow { domain -servicemanager -hwservicemanager -vndservicemanager } *:binder set_context_mgr;
11638# The service managers are only allowed to access their own device node
11639neverallow servicemanager hwbinder_device:chr_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11640neverallow servicemanager vndbinder_device:chr_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11641neverallow hwservicemanager binder_device:chr_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11642neverallow hwservicemanager vndbinder_device:chr_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11643neverallow vndservicemanager binder_device:chr_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11644neverallow vndservicemanager hwbinder_device:chr_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
11645
11646# On full TREBLE devices, only core components and apps can use Binder and servicemanager. Non-core
11647# domain apps need this because Android framework offers many of its services to apps as Binder
11648# services.
11649
11650#line 631
11651  neverallow {
11652#line 631
11653    domain
11654#line 631
11655    -coredomain
11656#line 631
11657    -appdomain
11658#line 631
11659    -binder_in_vendor_violators # TODO(b/35870313): Remove once all violations are gone
11660#line 631
11661  } binder_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
11662#line 638
11663
11664
11665# libcutils can probe for /dev/binder permissions with access(). Ignore
11666# generated denials. See b/129073672 for details.
11667dontaudit domain binder_device:chr_file audit_access;
11668
11669
11670#line 644
11671  neverallow {
11672#line 644
11673    domain
11674#line 644
11675    -coredomain
11676#line 644
11677    -appdomain # restrictions for vendor apps are declared lower down
11678#line 644
11679    -binder_in_vendor_violators # TODO(b/35870313): Remove once all violations are gone
11680#line 644
11681  } service_manager_type:service_manager find;
11682#line 651
11683
11684
11685#line 652
11686  # Vendor apps are permited to use only stable public services. If they were to use arbitrary
11687#line 652
11688  # services which can change any time framework/core is updated, breakage is likely.
11689#line 652
11690  neverallow {
11691#line 652
11692    appdomain
11693#line 652
11694    -coredomain
11695#line 652
11696  } {
11697#line 652
11698    service_manager_type
11699#line 652
11700    -app_api_service
11701#line 652
11702    -ephemeral_app_api_service
11703#line 652
11704    -audioserver_service # TODO(b/36783122) remove exemptions below once app_api_service is fixed
11705#line 652
11706    -cameraserver_service
11707#line 652
11708    -drmserver_service
11709#line 652
11710    -keystore_service
11711#line 652
11712    -mediadrmserver_service
11713#line 652
11714    -mediaextractor_service
11715#line 652
11716    -mediametrics_service
11717#line 652
11718    -mediaserver_service
11719#line 652
11720    -nfc_service
11721#line 652
11722    -radio_service
11723#line 652
11724    -virtual_touchpad_service
11725#line 652
11726    -vr_hwc_service
11727#line 652
11728    -vr_manager_service
11729#line 652
11730  }:service_manager find;
11731#line 676
11732
11733
11734#line 677
11735  neverallow {
11736#line 677
11737    domain
11738#line 677
11739    -coredomain
11740#line 677
11741    -appdomain
11742#line 677
11743    -binder_in_vendor_violators # TODO(b/35870313): Remove once all violations are gone
11744#line 677
11745  } servicemanager:binder { call transfer };
11746#line 684
11747
11748
11749# On full TREBLE devices, only vendor components, shell, and su can use VendorBinder.
11750
11751#line 687
11752  neverallow {
11753#line 687
11754    coredomain
11755#line 687
11756    -shell
11757#line 687
11758
11759#line 687
11760    -ueventd # uevent is granted create for this device, but we still neverallow I/O below
11761#line 687
11762  } vndbinder_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
11763#line 694
11764
11765
11766#line 695
11767  neverallow ueventd vndbinder_device:chr_file { read write append ioctl };
11768#line 697
11769
11770
11771#line 698
11772  neverallow {
11773#line 698
11774    coredomain
11775#line 698
11776    -shell
11777#line 698
11778
11779#line 698
11780  } vndservice_manager_type:service_manager *;
11781#line 704
11782
11783
11784#line 705
11785  neverallow {
11786#line 705
11787    coredomain
11788#line 705
11789    -shell
11790#line 705
11791
11792#line 705
11793  } vndservicemanager:binder *;
11794#line 711
11795
11796
11797# On full TREBLE devices, socket communications between core components and vendor components are
11798# not permitted.
11799  # Most general rules first, more specific rules below.
11800
11801  # Core domains are not permitted to initiate communications to vendor domain sockets.
11802  # We are not restricting the use of already established sockets because it is fine for a process
11803  # to obtain an already established socket via some public/official/stable API and then exchange
11804  # data with its peer over that socket. The wire format in this scenario is dicatated by the API
11805  # and thus does not break the core-vendor separation.
11806
11807#line 722
11808
11809#line 722
11810  neverallow {
11811#line 722
11812    coredomain
11813#line 722
11814    -init
11815#line 722
11816    -adbd
11817#line 722
11818  } {
11819#line 722
11820    domain
11821#line 722
11822    -coredomain
11823#line 722
11824    -socket_between_core_and_vendor_violators
11825#line 722
11826  }:{ socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket appletalk_socket netlink_route_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket xdp_socket } { connect sendto };
11827#line 722
11828  neverallow {
11829#line 722
11830    coredomain
11831#line 722
11832    -init
11833#line 722
11834    -adbd
11835#line 722
11836  } {
11837#line 722
11838    domain
11839#line 722
11840    -coredomain
11841#line 722
11842    -socket_between_core_and_vendor_violators
11843#line 722
11844  }:unix_stream_socket connectto;
11845#line 722
11846;
11847#line 732
11848
11849  # Vendor domains are not permitted to initiate communications to core domain sockets
11850
11851#line 734
11852
11853#line 734
11854  neverallow {
11855#line 734
11856    domain
11857#line 734
11858    -coredomain
11859#line 734
11860    -appdomain
11861#line 734
11862    -socket_between_core_and_vendor_violators
11863#line 734
11864  } {
11865#line 734
11866    coredomain
11867#line 734
11868    -logd # Logging by writing to logd Unix domain socket is public API
11869#line 734
11870    -netd # netdomain needs this
11871#line 734
11872    -mdnsd # netdomain needs this
11873#line 734
11874     # communications with su are permitted only on userdebug or eng builds
11875#line 734
11876    -init
11877#line 734
11878    -tombstoned # linker to tombstoned
11879#line 734
11880
11881#line 734
11882  }:{ socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket appletalk_socket netlink_route_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket xdp_socket } { connect sendto };
11883#line 734
11884  neverallow {
11885#line 734
11886    domain
11887#line 734
11888    -coredomain
11889#line 734
11890    -appdomain
11891#line 734
11892    -socket_between_core_and_vendor_violators
11893#line 734
11894  } {
11895#line 734
11896    coredomain
11897#line 734
11898    -logd # Logging by writing to logd Unix domain socket is public API
11899#line 734
11900    -netd # netdomain needs this
11901#line 734
11902    -mdnsd # netdomain needs this
11903#line 734
11904     # communications with su are permitted only on userdebug or eng builds
11905#line 734
11906    -init
11907#line 734
11908    -tombstoned # linker to tombstoned
11909#line 734
11910
11911#line 734
11912  }:unix_stream_socket connectto;
11913#line 734
11914;
11915#line 750
11916
11917
11918  # Vendor domains (except netdomain) are not permitted to initiate communications to netd sockets
11919
11920#line 753
11921
11922#line 753
11923  neverallow {
11924#line 753
11925    domain
11926#line 753
11927    -coredomain
11928#line 753
11929    -netdomain
11930#line 753
11931    -socket_between_core_and_vendor_violators
11932#line 753
11933  } netd:{ socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket appletalk_socket netlink_route_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket xdp_socket } { connect sendto };
11934#line 753
11935  neverallow {
11936#line 753
11937    domain
11938#line 753
11939    -coredomain
11940#line 753
11941    -netdomain
11942#line 753
11943    -socket_between_core_and_vendor_violators
11944#line 753
11945  } netd:unix_stream_socket connectto;
11946#line 753
11947;
11948#line 760
11949
11950
11951  # Vendor domains are not permitted to initiate create/open sockets owned by core domains
11952
11953#line 763
11954  neverallow {
11955#line 763
11956    domain
11957#line 763
11958    -coredomain
11959#line 763
11960    -appdomain # appdomain restrictions below
11961#line 763
11962    -data_between_core_and_vendor_violators # b/70393317
11963#line 763
11964    -socket_between_core_and_vendor_violators
11965#line 763
11966    -vendor_init
11967#line 763
11968  } {
11969#line 763
11970    coredomain_socket
11971#line 763
11972    core_data_file_type
11973#line 763
11974    unlabeled # used only by core domains
11975#line 763
11976  }:sock_file ~{ append getattr ioctl read write };
11977#line 776
11978
11979
11980#line 777
11981  neverallow {
11982#line 777
11983    appdomain
11984#line 777
11985    -coredomain
11986#line 777
11987  } {
11988#line 777
11989    coredomain_socket
11990#line 777
11991    unlabeled # used only by core domains
11992#line 777
11993    core_data_file_type
11994#line 777
11995    -app_data_file
11996#line 777
11997    -privapp_data_file
11998#line 777
11999    -pdx_endpoint_socket_type # used by VR layer
12000#line 777
12001    -pdx_channel_socket_type # used by VR layer
12002#line 777
12003  }:sock_file ~{ append getattr ioctl read write };
12004#line 790
12005
12006
12007  # Core domains are not permitted to create/open sockets owned by vendor domains
12008
12009#line 793
12010  neverallow {
12011#line 793
12012    coredomain
12013#line 793
12014    -init
12015#line 793
12016    -ueventd
12017#line 793
12018    -socket_between_core_and_vendor_violators
12019#line 793
12020  } {
12021#line 793
12022    file_type
12023#line 793
12024    dev_type
12025#line 793
12026    -coredomain_socket
12027#line 793
12028    -core_data_file_type
12029#line 793
12030    -unlabeled
12031#line 793
12032  }:sock_file ~{ append getattr ioctl read write };
12033#line 806
12034
12035
12036# On TREBLE devices, vendor and system components are only allowed to share
12037# files by passing open FDs over hwbinder. Ban all directory access and all file
12038# accesses other than what can be applied to an open FD such as
12039# ioctl/stat/read/write/append. This is enforced by segregating /data.
12040# Vendor domains may directly access file in /data/vendor by path, but may only
12041# access files outside of /data/vendor via an open FD passed over hwbinder.
12042# Likewise, core domains may only directly access files outside /data/vendor by
12043# path and files in /data/vendor by open FD.
12044
12045#line 816
12046  # only coredomains may only access core_data_file_type, particularly not
12047#line 816
12048  # /data/vendor
12049#line 816
12050  neverallow {
12051#line 816
12052    coredomain
12053#line 816
12054    -appdomain # TODO(b/34980020) remove exemption for appdomain
12055#line 816
12056    -data_between_core_and_vendor_violators
12057#line 816
12058    -init
12059#line 816
12060    -vold_prepare_subdirs
12061#line 816
12062  } {
12063#line 816
12064    data_file_type
12065#line 816
12066    -core_data_file_type
12067#line 816
12068  }:{ { chr_file blk_file } { file lnk_file sock_file fifo_file } } ~{ append getattr ioctl read write map };
12069#line 829
12070
12071
12072#line 830
12073  neverallow {
12074#line 830
12075    coredomain
12076#line 830
12077    -appdomain # TODO(b/34980020) remove exemption for appdomain
12078#line 830
12079    -data_between_core_and_vendor_violators
12080#line 830
12081    -init
12082#line 830
12083    -vold_prepare_subdirs
12084#line 830
12085    } {
12086#line 830
12087      data_file_type
12088#line 830
12089      -core_data_file_type
12090#line 830
12091      # TODO(b/72998741) Remove exemption. Further restricted in a subsequent
12092#line 830
12093      # neverallow. Currently only getattr and search are allowed.
12094#line 830
12095      -vendor_data_file
12096#line 830
12097    }:dir *;
12098#line 830
12099
12100#line 845
12101
12102
12103#line 846
12104  # vendor domains may only access files in /data/vendor, never core_data_file_types
12105#line 846
12106  neverallow {
12107#line 846
12108    domain
12109#line 846
12110    -appdomain # TODO(b/34980020) remove exemption for appdomain
12111#line 846
12112    -coredomain
12113#line 846
12114    -data_between_core_and_vendor_violators # TODO(b/34980020) Remove once all violators have been cleaned up
12115#line 846
12116    -vendor_init
12117#line 846
12118  } {
12119#line 846
12120    core_data_file_type
12121#line 846
12122    # libc includes functions like mktime and localtime which attempt to access
12123#line 846
12124    # files in /data/misc/zoneinfo/tzdata and /system/usr/share/zoneinfo/tzdata.
12125#line 846
12126    # These functions are considered vndk-stable and thus must be allowed for
12127#line 846
12128    # all processes.
12129#line 846
12130    -zoneinfo_data_file
12131#line 846
12132
12133#line 846
12134  }:{ { chr_file blk_file } { file lnk_file sock_file fifo_file } } ~{ append getattr ioctl read write map };
12135#line 846
12136  neverallow {
12137#line 846
12138    vendor_init
12139#line 846
12140    -data_between_core_and_vendor_violators
12141#line 846
12142  } {
12143#line 846
12144    core_data_file_type
12145#line 846
12146    -unencrypted_data_file
12147#line 846
12148    -zoneinfo_data_file
12149#line 846
12150
12151#line 846
12152  }:{ { chr_file blk_file } { file lnk_file sock_file fifo_file } } ~{ append getattr ioctl read write map };
12153#line 846
12154  # vendor init needs to be able to read unencrypted_data_file to create directories with FBE.
12155#line 846
12156  # The vendor init binary lives on the system partition so there is not a concern with stability.
12157#line 846
12158  neverallow vendor_init unencrypted_data_file:file ~{ getattr open read ioctl lock map };
12159#line 875
12160
12161
12162#line 876
12163  # vendor domains may only access dirs in /data/vendor, never core_data_file_types
12164#line 876
12165  neverallow {
12166#line 876
12167    domain
12168#line 876
12169    -appdomain # TODO(b/34980020) remove exemption for appdomain
12170#line 876
12171    -coredomain
12172#line 876
12173    -data_between_core_and_vendor_violators
12174#line 876
12175    -vendor_init
12176#line 876
12177  } {
12178#line 876
12179    core_data_file_type
12180#line 876
12181    -system_data_file # default label for files on /data. Covered below...
12182#line 876
12183    -vendor_data_file
12184#line 876
12185    -zoneinfo_data_file
12186#line 876
12187
12188#line 876
12189  }:dir *;
12190#line 876
12191  neverallow {
12192#line 876
12193    vendor_init
12194#line 876
12195    -data_between_core_and_vendor_violators
12196#line 876
12197  } {
12198#line 876
12199    core_data_file_type
12200#line 876
12201    -unencrypted_data_file
12202#line 876
12203    -system_data_file
12204#line 876
12205    -vendor_data_file
12206#line 876
12207    -zoneinfo_data_file
12208#line 876
12209
12210#line 876
12211  }:dir *;
12212#line 876
12213  # vendor init needs to be able to read unencrypted_data_file to create directories with FBE.
12214#line 876
12215  # The vendor init binary lives on the system partition so there is not a concern with stability.
12216#line 876
12217  neverallow vendor_init unencrypted_data_file:dir ~search;
12218#line 905
12219
12220
12221#line 906
12222  # vendor domains may only access dirs in /data/vendor, never core_data_file_types
12223#line 906
12224  neverallow {
12225#line 906
12226    domain
12227#line 906
12228    -appdomain # TODO(b/34980020) remove exemption for appdomain
12229#line 906
12230    -coredomain
12231#line 906
12232    -data_between_core_and_vendor_violators # TODO(b/34980020) Remove once all violators have been cleaned up
12233#line 906
12234    } {
12235#line 906
12236      system_data_file # default label for files on /data. Covered below
12237#line 906
12238    }:dir ~{ getattr search };
12239#line 916
12240
12241
12242
12243#line 918
12244  #  coredomains may not access dirs in /data/vendor.
12245#line 918
12246  neverallow {
12247#line 918
12248    coredomain
12249#line 918
12250    -data_between_core_and_vendor_violators # TODO(b/34980020) Remove once all violators have been cleaned up
12251#line 918
12252    -init
12253#line 918
12254    -vold # vold creates per-user storage for both system and vendor
12255#line 918
12256    -vold_prepare_subdirs
12257#line 918
12258    } {
12259#line 918
12260      vendor_data_file # default label for files on /data. Covered below
12261#line 918
12262    }:dir ~{ getattr search };
12263#line 929
12264
12265
12266
12267#line 931
12268  #  coredomains may not access dirs in /data/vendor.
12269#line 931
12270  neverallow {
12271#line 931
12272    coredomain
12273#line 931
12274    -data_between_core_and_vendor_violators # TODO(b/34980020) Remove once all violators have been cleaned up
12275#line 931
12276    -init
12277#line 931
12278    } {
12279#line 931
12280      vendor_data_file # default label for files on /data/vendor{,_ce,_de}.
12281#line 931
12282    }:{ { chr_file blk_file } { file lnk_file sock_file fifo_file } } ~{ append getattr ioctl read write map };
12283#line 940
12284
12285
12286
12287#line 942
12288    # Non-vendor domains are not allowed to file execute shell
12289#line 942
12290    # from vendor
12291#line 942
12292    neverallow {
12293#line 942
12294        coredomain
12295#line 942
12296        -init
12297#line 942
12298        -shell
12299#line 942
12300    } vendor_shell_exec:file { execute execute_no_trans };
12301#line 950
12302
12303
12304
12305#line 952
12306    # Do not allow vendor components to execute files from system
12307#line 952
12308    # except for the ones allowlist here.
12309#line 952
12310    neverallow {
12311#line 952
12312        domain
12313#line 952
12314        -coredomain
12315#line 952
12316        -appdomain
12317#line 952
12318        -vendor_executes_system_violators
12319#line 952
12320        -vendor_init
12321#line 952
12322    } {
12323#line 952
12324        system_file_type
12325#line 952
12326        -system_lib_file
12327#line 952
12328        -system_linker_exec
12329#line 952
12330        -crash_dump_exec
12331#line 952
12332        -netutils_wrapper_exec
12333#line 952
12334
12335#line 952
12336    }:file { entrypoint execute execute_no_trans };
12337#line 969
12338
12339
12340
12341#line 971
12342    # Do not allow system components to execute files from vendor
12343#line 971
12344    # except for the ones allowlisted here.
12345#line 971
12346    neverallow {
12347#line 971
12348      coredomain
12349#line 971
12350      -init
12351#line 971
12352      -shell
12353#line 971
12354      -system_executes_vendor_violators
12355#line 971
12356    } {
12357#line 971
12358      vendor_file_type
12359#line 971
12360      -same_process_hal_file
12361#line 971
12362      -vndk_sp_file
12363#line 971
12364      -vendor_app_file
12365#line 971
12366      -vendor_public_lib_file
12367#line 971
12368    }:file execute;
12369#line 986
12370
12371
12372
12373#line 988
12374    neverallow {
12375#line 988
12376      coredomain
12377#line 988
12378      -shell
12379#line 988
12380      -system_executes_vendor_violators
12381#line 988
12382    } {
12383#line 988
12384      vendor_file_type
12385#line 988
12386      -same_process_hal_file
12387#line 988
12388    }:file execute_no_trans;
12389#line 997
12390
12391
12392
12393#line 999
12394  # Do not allow system components access to /vendor files except for the
12395#line 999
12396  # ones allowlisted here.
12397#line 999
12398  neverallow {
12399#line 999
12400    coredomain
12401#line 999
12402    # TODO(b/37168747): clean up fwk access to /vendor
12403#line 999
12404    -crash_dump
12405#line 999
12406    -init # starts vendor executables
12407#line 999
12408    -kernel # loads /vendor/firmware
12409#line 999
12410
12411#line 999
12412
12413#line 999
12414    -shell
12415#line 999
12416    -system_executes_vendor_violators
12417#line 999
12418    -ueventd # reads /vendor/ueventd.rc
12419#line 999
12420  } {
12421#line 999
12422    vendor_file_type
12423#line 999
12424    -same_process_hal_file
12425#line 999
12426    -vendor_app_file
12427#line 999
12428    -vendor_configs_file
12429#line 999
12430    -vendor_framework_file
12431#line 999
12432    -vendor_idc_file
12433#line 999
12434    -vendor_keychars_file
12435#line 999
12436    -vendor_keylayout_file
12437#line 999
12438    -vendor_overlay_file
12439#line 999
12440    -vendor_public_lib_file
12441#line 999
12442    -vendor_task_profiles_file
12443#line 999
12444    -vndk_sp_file
12445#line 999
12446  }:file *;
12447#line 1027
12448
12449
12450
12451#line 1029
12452  # Do not allow vendor components access to /system files except for the
12453#line 1029
12454  # ones allowlisted here.
12455#line 1029
12456  neverallow {
12457#line 1029
12458    domain
12459#line 1029
12460    -appdomain
12461#line 1029
12462    -coredomain
12463#line 1029
12464    -vendor_executes_system_violators
12465#line 1029
12466    # vendor_init needs access to init_exec for domain transition. vendor_init
12467#line 1029
12468    # neverallows are covered in public/vendor_init.te
12469#line 1029
12470    -vendor_init
12471#line 1029
12472  } {
12473#line 1029
12474    system_file_type
12475#line 1029
12476    -crash_dump_exec
12477#line 1029
12478    -file_contexts_file
12479#line 1029
12480    -netutils_wrapper_exec
12481#line 1029
12482    -property_contexts_file
12483#line 1029
12484    -system_event_log_tags_file
12485#line 1029
12486    -system_lib_file
12487#line 1029
12488
12489#line 1029
12490    -system_linker_exec
12491#line 1029
12492    -system_linker_config_file
12493#line 1029
12494    -system_seccomp_policy_file
12495#line 1029
12496    -system_security_cacerts_file
12497#line 1029
12498    -system_zoneinfo_file
12499#line 1029
12500    -task_profiles_file
12501#line 1029
12502
12503#line 1029
12504  }:file *;
12505#line 1057
12506
12507
12508# Only system_server should be able to send commands via the zygote socket
12509neverallow { domain -zygote -system_server } zygote:unix_stream_socket connectto;
12510neverallow { domain -system_server } zygote_socket:sock_file write;
12511
12512neverallow { domain -system_server -webview_zygote -app_zygote } webview_zygote:unix_stream_socket connectto;
12513neverallow { domain -system_server } webview_zygote:sock_file write;
12514neverallow { domain -system_server } app_zygote:sock_file write;
12515
12516neverallow {
12517  domain
12518  -tombstoned
12519  -crash_dump
12520  -dumpstate
12521  -incidentd
12522  -system_server
12523
12524  # Processes that can't exec crash_dump
12525  -hal_codec2_server
12526  -hal_omx_server
12527  -mediaextractor
12528} tombstoned_crash_socket:unix_stream_socket connectto;
12529
12530# Never allow anyone except dumpstate, incidentd, or the system server to connect or write to
12531# the tombstoned intercept socket.
12532neverallow { domain -dumpstate -incidentd -system_server } tombstoned_intercept_socket:sock_file write;
12533neverallow { domain -dumpstate -incidentd -system_server } tombstoned_intercept_socket:unix_stream_socket connectto;
12534
12535# Android does not support System V IPCs.
12536#
12537# The reason for this is due to the fact that, by design, they lead to global
12538# kernel resource leakage.
12539#
12540# For example, there is no way to automatically release a SysV semaphore
12541# allocated in the kernel when:
12542#
12543# - a buggy or malicious process exits
12544# - a non-buggy and non-malicious process crashes or is explicitly killed.
12545#
12546# Killing processes automatically to make room for new ones is an
12547# important part of Android's application lifecycle implementation. This means
12548# that, even assuming only non-buggy and non-malicious code, it is very likely
12549# that over time, the kernel global tables used to implement SysV IPCs will fill
12550# up.
12551neverallow * *:{ shm sem msg msgq } *;
12552
12553# Do not mount on top of symlinks, fifos, or sockets.
12554# Feature parity with Chromium LSM.
12555neverallow * { file_type fs_type dev_type }:{ lnk_file fifo_file sock_file } mounton;
12556
12557# Nobody should be able to execute su on user builds.
12558# On userdebug/eng builds, only dumpstate, shell, and
12559# su itself execute su.
12560neverallow { domain  } su_exec:file { execute execute_no_trans };
12561
12562# Do not allow the introduction of new execmod rules. Text relocations
12563# and modification of executable pages are unsafe.
12564# The only exceptions are for NDK text relocations associated with
12565# https://code.google.com/p/android/issues/detail?id=23203
12566# which, long term, need to go away.
12567neverallow * {
12568  file_type
12569  -apk_data_file
12570  -app_data_file
12571  -asec_public_file
12572}:file execmod;
12573
12574# Do not allow making the stack or heap executable.
12575# We would also like to minimize execmem but it seems to be
12576# required by some device-specific service domains.
12577neverallow * self:process { execstack execheap };
12578
12579# Do not allow the introduction of new execmod rules. Text relocations
12580# and modification of executable pages are unsafe.
12581neverallow { domain -untrusted_app_25 -untrusted_app_27 } file_type:file execmod;
12582
12583neverallow { domain -init } proc:{ file dir } mounton;
12584
12585# Ensure that all types assigned to processes are included
12586# in the domain attribute, so that all allow and neverallow rules
12587# written on domain are applied to all processes.
12588# This is achieved by ensuring that it is impossible to transition
12589# from a domain to a non-domain type and vice versa.
12590# TODO - rework this: neverallow domain ~domain:process { transition dyntransition };
12591neverallow ~domain domain:process { transition dyntransition };
12592
12593#
12594# Only system_app and system_server should be creating or writing
12595# their files. The proper way to share files is to setup
12596# type transitions to a more specific type or assigning a type
12597# to its parent directory via a file_contexts entry.
12598# Example type transition:
12599#  mydomain.te:file_type_auto_trans(mydomain, system_data_file, new_file_type)
12600#
12601neverallow {
12602  domain
12603  -system_server
12604  -system_app
12605  -init
12606  -installd # for relabelfrom and unlink, check for this in explicit neverallow
12607  -vold_prepare_subdirs # For unlink
12608
12609} system_data_file:file { append create link unlink relabelfrom rename setattr write };
12610# do not grant anything greater than r_file_perms and relabelfrom unlink
12611# to installd
12612neverallow installd system_data_file:file ~{ { getattr open read ioctl lock map } relabelfrom unlink };
12613
12614# respect system_app sandboxes
12615neverallow {
12616  domain
12617  -appdomain # finer-grained rules for appdomain are listed below
12618  -system_server #populate com.android.providers.settings/databases/settings.db.
12619  -installd # creation of app sandbox
12620  -traced_probes # resolve inodes for i/o tracing.
12621                 # only needs open and read, the rest is neverallow in
12622                 # traced_probes.te.
12623} system_app_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } { create unlink open };
12624neverallow {
12625  isolated_app
12626  untrusted_app_all # finer-grained rules for appdomain are listed below
12627  ephemeral_app
12628  priv_app
12629} system_app_data_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } { create unlink open };
12630
12631#
12632# Only these domains should transition to shell domain. This domain is
12633# permissible for the "shell user". If you need a process to exec a shell
12634# script with differing privilege, define a domain and set up a transition.
12635#
12636neverallow {
12637  domain
12638  -adbd
12639  -init
12640  -runas
12641  -zygote
12642} shell:process { transition dyntransition };
12643
12644# Only domains spawned from zygote, runas and simpleperf_app_runner may have the appdomain
12645# attribute.
12646neverallow { domain -simpleperf_app_runner -runas -app_zygote -webview_zygote -zygote } {
12647  appdomain -shell
12648}:process { transition dyntransition };
12649
12650# Minimize read access to shell- or app-writable symlinks.
12651# This is to prevent malicious symlink attacks.
12652neverallow {
12653  domain
12654  -appdomain
12655  -installd
12656} { app_data_file privapp_data_file }:lnk_file read;
12657
12658neverallow {
12659  domain
12660  -shell
12661
12662  -installd
12663} shell_data_file:lnk_file read;
12664
12665# In addition to the symlink reading restrictions above, restrict
12666# write access to shell owned directories. The /data/local/tmp
12667# directory is untrustworthy, and non-allowlisted domains should
12668# not be trusting any content in those directories.
12669neverallow {
12670  domain
12671  -adbd
12672  -dumpstate
12673  -installd
12674  -init
12675  -shell
12676  -vold
12677} shell_data_file:dir { add_name create link relabelfrom remove_name rename reparent rmdir setattr write };
12678
12679neverallow {
12680  domain
12681  -adbd
12682  -appdomain
12683  -dumpstate
12684  -init
12685  -installd
12686  -simpleperf_app_runner
12687  -system_server # why?
12688
12689} shell_data_file:dir { open search };
12690
12691# Same as above for /data/local/tmp files. We allow shell files
12692# to be passed around by file descriptor, but not directly opened.
12693neverallow {
12694  domain
12695  -adbd
12696  -appdomain
12697  -dumpstate
12698  -installd
12699
12700} shell_data_file:file open;
12701
12702# servicemanager and vndservicemanager are the only processes which handle the
12703# service_manager list request
12704neverallow * ~{
12705    servicemanager
12706    vndservicemanager
12707    }:service_manager list;
12708
12709# hwservicemanager is the only process which handles hw list requests
12710neverallow * ~{
12711    hwservicemanager
12712    }:hwservice_manager list;
12713
12714# only service_manager_types can be added to service_manager
12715# TODO - rework this: neverallow * ~service_manager_type:service_manager { add find };
12716
12717# Prevent assigning non property types to properties
12718# TODO - rework this: neverallow * ~property_type:property_service set;
12719
12720# Domain types should never be assigned to any files other
12721# than the /proc/pid files associated with a process. The
12722# executable file used to enter a domain should be labeled
12723# with its own _exec type, not with the domain type.
12724# Conventionally, this looks something like:
12725# $ cat mydaemon.te
12726# type mydaemon, domain;
12727# type mydaemon_exec, exec_type, file_type;
12728# init_daemon_domain(mydaemon)
12729# $ grep mydaemon file_contexts
12730# /system/bin/mydaemon -- u:object_r:mydaemon_exec:s0
12731neverallow * domain:file { execute execute_no_trans entrypoint };
12732
12733# Do not allow access to the generic debugfs label. This is too broad.
12734# Instead, if access to part of debugfs is desired, it should have a
12735# more specific label.
12736# TODO: fix dumpstate
12737neverallow { domain -init -vendor_init -dumpstate } debugfs:{ file lnk_file } { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
12738
12739# Do not allow executable files in debugfs.
12740neverallow domain debugfs_type:file { execute execute_no_trans };
12741
12742# Profiles contain untrusted data and profman parses that. We should only run
12743# in from installd forked processes.
12744neverallow {
12745  domain
12746  -installd
12747  -profman
12748} profman_exec:file { execute execute_no_trans };
12749
12750# Enforce restrictions on kernel module origin.
12751# Do not allow kernel module loading except from system,
12752# vendor, and boot partitions.
12753neverallow * ~{ system_file vendor_file rootfs }:system module_load;
12754
12755# Only allow filesystem caps to be set at build time. Runtime changes
12756# to filesystem capabilities are not permitted.
12757neverallow * self:{ capability cap_userns } setfcap;
12758
12759# Enforce AT_SECURE for executing crash_dump.
12760neverallow domain crash_dump:process noatsecure;
12761
12762# Do not permit non-core domains to register HwBinder services which are
12763# guaranteed to be provided by core domains only.
12764neverallow ~coredomain coredomain_hwservice:hwservice_manager add;
12765
12766# Do not permit the registeration of HwBinder services which are guaranteed to
12767# be passthrough only (i.e., run in the process of their clients instead of a
12768# separate server process).
12769neverallow * same_process_hwservice:hwservice_manager add;
12770
12771# On TREBLE devices, most coredomains should not access vendor_files.
12772# TODO(b/71553434): Remove exceptions here.
12773
12774#line 1324
12775  neverallow {
12776#line 1324
12777    coredomain
12778#line 1324
12779    -appdomain
12780#line 1324
12781    -bootanim
12782#line 1324
12783    -crash_dump
12784#line 1324
12785    -init
12786#line 1324
12787    -kernel
12788#line 1324
12789    -perfprofd
12790#line 1324
12791    -heapprofd
12792#line 1324
12793    -ueventd
12794#line 1324
12795  } vendor_file:file { { append create link unlink relabelfrom rename setattr write } { execute execute_no_trans } open };
12796#line 1336
12797
12798
12799# If an already existing file is opened with O_CREAT, the kernel might generate
12800# a false report of a create denial. Silence these denials and make sure that
12801# inappropriate permissions are not granted.
12802
12803# These filesystems don't allow files or directories to be created, so the permission
12804# to do so should never be granted.
12805neverallow domain {
12806  proc_type
12807  sysfs_type
12808}:dir { add_name create link remove_name rename reparent rmdir write };
12809
12810# cgroupfs directories can be created, but not files within them.
12811neverallow domain cgroup:file create;
12812
12813dontaudit domain proc_type:dir write;
12814dontaudit domain sysfs_type:dir write;
12815dontaudit domain cgroup:file create;
12816
12817# These are only needed in permissive mode - in enforcing mode the
12818# directory write check fails and so these are never attempted.
12819#line 1363
12820
12821
12822# Platform must not have access to /mnt/vendor.
12823neverallow {
12824  coredomain
12825  -init
12826  -ueventd
12827  -vold
12828  -system_writes_mnt_vendor_violators
12829} mnt_vendor_file:dir *;
12830
12831# Only apps are allowed access to vendor public libraries.
12832
12833#line 1375
12834  neverallow {
12835#line 1375
12836    coredomain
12837#line 1375
12838    -appdomain
12839#line 1375
12840  } vendor_public_lib_file:file { execute execute_no_trans };
12841#line 1380
12842
12843
12844# Vendor domian must not have access to /mnt/product.
12845neverallow {
12846  domain
12847  -coredomain
12848} mnt_product_file:dir *;
12849
12850# Platform must not have access to sysfs_batteryinfo, but should do it via health HAL and healthd
12851
12852#line 1389
12853  neverallow {
12854#line 1389
12855    coredomain
12856#line 1389
12857    -healthd
12858#line 1389
12859    -shell
12860#line 1389
12861    # Generate uevents for health info
12862#line 1389
12863    -ueventd
12864#line 1389
12865    # Recovery uses health HAL passthrough implementation.
12866#line 1389
12867    -recovery
12868#line 1389
12869    # Charger uses health HAL passthrough implementation.
12870#line 1389
12871    -charger
12872#line 1389
12873    # TODO(b/110891300): remove this exception
12874#line 1389
12875    -incidentd
12876#line 1389
12877  } sysfs_batteryinfo:file { open read };
12878#line 1403
12879
12880
12881neverallow {
12882  domain
12883  -hal_codec2_server
12884  -hal_omx_server
12885} hal_codec2_hwservice:hwservice_manager add;
12886
12887#line 1 "system/sepolicy/prebuilts/api/29.0/public/drmserver.te"
12888# drmserver - DRM service
12889type drmserver, domain;
12890type drmserver_exec, system_file_type, exec_type, file_type;
12891
12892typeattribute drmserver mlstrustedsubject;
12893
12894
12895#line 7
12896typeattribute drmserver netdomain;
12897#line 7
12898
12899
12900# Perform Binder IPC to system server.
12901
12902#line 10
12903# Call the servicemanager and transfer references to it.
12904#line 10
12905allow drmserver servicemanager:binder { call transfer };
12906#line 10
12907# servicemanager performs getpidcon on clients.
12908#line 10
12909allow servicemanager drmserver:dir search;
12910#line 10
12911allow servicemanager drmserver:file { read open };
12912#line 10
12913allow servicemanager drmserver:process getattr;
12914#line 10
12915# rw access to /dev/binder and /dev/ashmem is presently granted to
12916#line 10
12917# all domains in domain.te.
12918#line 10
12919
12920
12921#line 11
12922# Call the server domain and optionally transfer references to it.
12923#line 11
12924allow drmserver system_server:binder { call transfer };
12925#line 11
12926# Allow the serverdomain to transfer references to the client on the reply.
12927#line 11
12928allow system_server drmserver:binder transfer;
12929#line 11
12930# Receive and use open files from the server.
12931#line 11
12932allow drmserver system_server:fd use;
12933#line 11
12934
12935
12936#line 12
12937# Call the server domain and optionally transfer references to it.
12938#line 12
12939allow drmserver appdomain:binder { call transfer };
12940#line 12
12941# Allow the serverdomain to transfer references to the client on the reply.
12942#line 12
12943allow appdomain drmserver:binder transfer;
12944#line 12
12945# Receive and use open files from the server.
12946#line 12
12947allow drmserver appdomain:fd use;
12948#line 12
12949
12950
12951#line 13
12952typeattribute drmserver binderservicedomain;
12953#line 13
12954
12955# Inherit or receive open files from system_server.
12956allow drmserver system_server:fd use;
12957
12958# Perform Binder IPC to mediaserver
12959
12960#line 18
12961# Call the server domain and optionally transfer references to it.
12962#line 18
12963allow drmserver mediaserver:binder { call transfer };
12964#line 18
12965# Allow the serverdomain to transfer references to the client on the reply.
12966#line 18
12967allow mediaserver drmserver:binder transfer;
12968#line 18
12969# Receive and use open files from the server.
12970#line 18
12971allow drmserver mediaserver:fd use;
12972#line 18
12973
12974
12975allow drmserver sdcard_type:dir search;
12976allow drmserver drm_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
12977allow drmserver drm_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
12978allow drmserver { app_data_file privapp_data_file }:file { read write getattr map };
12979allow drmserver sdcard_type:file { read write getattr map };
12980
12981#line 25
12982allow drmserver efs_file:dir { open getattr read search ioctl lock };
12983#line 25
12984allow drmserver efs_file:{ file lnk_file } { getattr open read ioctl lock map };
12985#line 25
12986
12987
12988type drmserver_socket, file_type;
12989
12990# /data/app/tlcd_sock socket file.
12991# Clearly, /data/app is the most logical place to create a socket.  Not.
12992allow drmserver apk_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
12993allow drmserver drmserver_socket:sock_file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
12994# Delete old socket file if present.
12995allow drmserver apk_data_file:sock_file unlink;
12996
12997# After taking a video, drmserver looks at the video file.
12998
12999#line 37
13000allow drmserver media_rw_data_file:dir { open getattr read search ioctl lock };
13001#line 37
13002allow drmserver media_rw_data_file:{ file lnk_file } { getattr open read ioctl lock map };
13003#line 37
13004
13005
13006# Read resources from open apk files passed over Binder.
13007allow drmserver apk_data_file:file { read getattr map };
13008allow drmserver asec_apk_file:file { read getattr map };
13009allow drmserver ringtone_file:file { read getattr map };
13010
13011# Read /data/data/com.android.providers.telephony files passed over Binder.
13012allow drmserver radio_data_file:file { read getattr map };
13013
13014# /oem access
13015allow drmserver oemfs:dir search;
13016allow drmserver oemfs:file { getattr open read ioctl lock map };
13017
13018
13019#line 51
13020  allow drmserver drmserver_service:service_manager { add find };
13021#line 51
13022  neverallow { domain -drmserver } drmserver_service:service_manager add;
13023#line 51
13024
13025allow drmserver permission_service:service_manager find;
13026
13027
13028#line 54
13029
13030#line 54
13031allow drmserver selinuxfs:dir { open getattr read search ioctl lock };
13032#line 54
13033allow drmserver selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
13034#line 54
13035
13036#line 54
13037allow drmserver selinuxfs:file { open append write lock map };
13038#line 54
13039allow drmserver kernel:security compute_av;
13040#line 54
13041allow drmserver self:netlink_selinux_socket { read write create getattr setattr lock relabelfrom relabelto append bind connect listen accept getopt setopt shutdown recvfrom sendto name_bind };
13042#line 54
13043
13044
13045
13046#line 56
13047allow drmserver cgroup:dir { open getattr read search ioctl lock };
13048#line 56
13049allow drmserver cgroup:{ file lnk_file } { getattr open read ioctl lock map };
13050#line 56
13051
13052
13053#line 57
13054allow drmserver system_file:dir { open getattr read search ioctl lock };
13055#line 57
13056allow drmserver system_file:{ file lnk_file } { getattr open read ioctl lock map };
13057#line 57
13058
13059#line 1 "system/sepolicy/prebuilts/api/29.0/public/dumpstate.te"
13060# dumpstate
13061type dumpstate, domain, mlstrustedsubject;
13062type dumpstate_exec, system_file_type, exec_type, file_type;
13063
13064
13065#line 5
13066typeattribute dumpstate netdomain;
13067#line 5
13068
13069
13070#line 6
13071# Call the servicemanager and transfer references to it.
13072#line 6
13073allow dumpstate servicemanager:binder { call transfer };
13074#line 6
13075# servicemanager performs getpidcon on clients.
13076#line 6
13077allow servicemanager dumpstate:dir search;
13078#line 6
13079allow servicemanager dumpstate:file { read open };
13080#line 6
13081allow servicemanager dumpstate:process getattr;
13082#line 6
13083# rw access to /dev/binder and /dev/ashmem is presently granted to
13084#line 6
13085# all domains in domain.te.
13086#line 6
13087
13088
13089#line 7
13090# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
13091#line 7
13092# deprecated.
13093#line 7
13094# Access /sys/power/wake_lock and /sys/power/wake_unlock
13095#line 7
13096allow dumpstate sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
13097#line 7
13098# Accessing these files requires CAP_BLOCK_SUSPEND
13099#line 7
13100allow dumpstate self:{ capability2 cap2_userns } block_suspend;
13101#line 7
13102# system_suspend permissions
13103#line 7
13104
13105#line 7
13106# Call the server domain and optionally transfer references to it.
13107#line 7
13108allow dumpstate system_suspend_server:binder { call transfer };
13109#line 7
13110# Allow the serverdomain to transfer references to the client on the reply.
13111#line 7
13112allow system_suspend_server dumpstate:binder transfer;
13113#line 7
13114# Receive and use open files from the server.
13115#line 7
13116allow dumpstate system_suspend_server:fd use;
13117#line 7
13118
13119#line 7
13120allow dumpstate system_suspend_hwservice:hwservice_manager find;
13121#line 7
13122# halclientdomain permissions
13123#line 7
13124
13125#line 7
13126# Call the hwservicemanager and transfer references to it.
13127#line 7
13128allow dumpstate hwservicemanager:binder { call transfer };
13129#line 7
13130# Allow hwservicemanager to send out callbacks
13131#line 7
13132allow hwservicemanager dumpstate:binder { call transfer };
13133#line 7
13134# hwservicemanager performs getpidcon on clients.
13135#line 7
13136allow hwservicemanager dumpstate:dir search;
13137#line 7
13138allow hwservicemanager dumpstate:file { read open map };
13139#line 7
13140allow hwservicemanager dumpstate:process getattr;
13141#line 7
13142# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
13143#line 7
13144# all domains in domain.te.
13145#line 7
13146
13147#line 7
13148
13149#line 7
13150allow dumpstate hwservicemanager_prop:file { getattr open read map };
13151#line 7
13152
13153#line 7
13154allow dumpstate hidl_manager_hwservice:hwservice_manager find;
13155#line 7
13156
13157
13158# Allow setting process priority, protect from OOM killer, and dropping
13159# privileges by switching UID / GID
13160allow dumpstate self:{ capability cap_userns } { setuid setgid sys_resource };
13161
13162# Allow dumpstate to scan through /proc/pid for all processes
13163
13164#line 14
13165allow dumpstate domain:dir { open getattr read search ioctl lock };
13166#line 14
13167allow dumpstate domain:{ file lnk_file } { getattr open read ioctl lock map };
13168#line 14
13169
13170
13171allow dumpstate self:{ capability cap_userns } {
13172    # Send signals to processes
13173    kill
13174    # Run iptables
13175    net_raw
13176    net_admin
13177};
13178
13179# Allow executing files on system, such as:
13180#   /system/bin/toolbox
13181#   /system/bin/logcat
13182#   /system/bin/dumpsys
13183allow dumpstate system_file:file execute_no_trans;
13184
13185allow dumpstate toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
13186
13187# hidl searches for files in /system/lib(64)/hw/
13188allow dumpstate system_file:dir { open getattr read search ioctl lock };
13189
13190# Create and write into /data/anr/
13191allow dumpstate self:{ capability cap_userns } { dac_override dac_read_search chown fowner fsetid };
13192allow dumpstate anr_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
13193allow dumpstate anr_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
13194
13195# Allow reading /data/system/uiderrors.txt
13196# TODO: scope this down.
13197allow dumpstate system_data_file:file { getattr open read ioctl lock map };
13198
13199# Allow dumpstate to append into privileged apps private files.
13200allow dumpstate privapp_data_file:file append;
13201
13202# Read dmesg
13203allow dumpstate self:{ capability2 cap2_userns } syslog;
13204allow dumpstate kernel:system syslog_read;
13205
13206# Read /sys/fs/pstore/console-ramoops
13207allow dumpstate pstorefs:dir { open getattr read search ioctl lock };
13208allow dumpstate pstorefs:file { getattr open read ioctl lock map };
13209
13210# Get process attributes
13211allow dumpstate domain:process getattr;
13212
13213# Signal java processes to dump their stack
13214allow dumpstate { appdomain system_server zygote }:process signal;
13215
13216# Signal native processes to dump their stack.
13217allow dumpstate {
13218  # This list comes from native_processes_to_dump in dumputils/dump_utils.c
13219  audioserver
13220  cameraserver
13221  drmserver
13222  inputflinger
13223  mediadrmserver
13224  mediaextractor
13225  mediametrics
13226  mediaserver
13227  mediaswcodec
13228  sdcardd
13229  surfaceflinger
13230  vold
13231
13232  # This list comes from hal_interfaces_to_dump in dumputils/dump_utils.c
13233  hal_audio_server
13234  hal_bluetooth_server
13235  hal_camera_server
13236  hal_codec2_server
13237  hal_drm_server
13238  hal_face_server
13239  hal_graphics_allocator_server
13240  hal_graphics_composer_server
13241  hal_health_server
13242  hal_omx_server
13243  hal_power_server
13244  hal_power_stats_server
13245  hal_sensors_server
13246  hal_thermal_server
13247  hal_vr_server
13248}:process signal;
13249
13250# Connect to tombstoned to intercept dumps.
13251
13252#line 96
13253allow dumpstate tombstoned_intercept_socket:sock_file write;
13254#line 96
13255allow dumpstate tombstoned:unix_stream_socket connectto;
13256#line 96
13257
13258
13259# Access to /sys
13260allow dumpstate sysfs_type:dir { open getattr read search ioctl lock };
13261
13262allow dumpstate {
13263  sysfs_devices_block
13264  sysfs_dm
13265  sysfs_loop
13266  sysfs_usb
13267  sysfs_zram
13268}:file { getattr open read ioctl lock map };
13269
13270# Other random bits of data we want to collect
13271allow dumpstate debugfs:file { getattr open read ioctl lock map };
13272auditallow dumpstate debugfs:file { getattr open read ioctl lock map };
13273
13274allow dumpstate debugfs_mmc:file { getattr open read ioctl lock map };
13275
13276# df for
13277allow dumpstate {
13278  block_device
13279  cache_file
13280  metadata_file
13281  rootfs
13282  selinuxfs
13283  storage_file
13284  tmpfs
13285}:dir { search getattr };
13286allow dumpstate fuse_device:chr_file getattr;
13287allow dumpstate { dm_device cache_block_device }:blk_file getattr;
13288allow dumpstate { cache_file rootfs }:lnk_file { getattr read };
13289
13290# Read /dev/cpuctl and /dev/cpuset
13291
13292#line 130
13293allow dumpstate cgroup:dir { open getattr read search ioctl lock };
13294#line 130
13295allow dumpstate cgroup:{ file lnk_file } { getattr open read ioctl lock map };
13296#line 130
13297
13298
13299# Allow dumpstate to make binder calls to any binder service
13300
13301#line 133
13302# Call the server domain and optionally transfer references to it.
13303#line 133
13304allow dumpstate binderservicedomain:binder { call transfer };
13305#line 133
13306# Allow the serverdomain to transfer references to the client on the reply.
13307#line 133
13308allow binderservicedomain dumpstate:binder transfer;
13309#line 133
13310# Receive and use open files from the server.
13311#line 133
13312allow dumpstate binderservicedomain:fd use;
13313#line 133
13314
13315
13316#line 134
13317# Call the server domain and optionally transfer references to it.
13318#line 134
13319allow dumpstate { appdomain netd wificond }:binder { call transfer };
13320#line 134
13321# Allow the serverdomain to transfer references to the client on the reply.
13322#line 134
13323allow { appdomain netd wificond } dumpstate:binder transfer;
13324#line 134
13325# Receive and use open files from the server.
13326#line 134
13327allow dumpstate { appdomain netd wificond }:fd use;
13328#line 134
13329
13330
13331
13332#line 136
13333typeattribute dumpstate halclientdomain;
13334#line 136
13335typeattribute dumpstate hal_dumpstate_client;
13336#line 136
13337
13338#line 136
13339# TODO(b/34170079): Make the inclusion of the rules below conditional also on
13340#line 136
13341# non-Treble devices. For now, on non-Treble device, always grant clients of a
13342#line 136
13343# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
13344#line 136
13345
13346#line 136
13347
13348
13349#line 137
13350typeattribute dumpstate halclientdomain;
13351#line 137
13352typeattribute dumpstate hal_wifi_client;
13353#line 137
13354
13355#line 137
13356# TODO(b/34170079): Make the inclusion of the rules below conditional also on
13357#line 137
13358# non-Treble devices. For now, on non-Treble device, always grant clients of a
13359#line 137
13360# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
13361#line 137
13362
13363#line 137
13364
13365
13366#line 138
13367typeattribute dumpstate halclientdomain;
13368#line 138
13369typeattribute dumpstate hal_graphics_allocator_client;
13370#line 138
13371
13372#line 138
13373# TODO(b/34170079): Make the inclusion of the rules below conditional also on
13374#line 138
13375# non-Treble devices. For now, on non-Treble device, always grant clients of a
13376#line 138
13377# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
13378#line 138
13379
13380#line 138
13381
13382# Vibrate the device after we are done collecting the bugreport
13383
13384#line 140
13385typeattribute dumpstate halclientdomain;
13386#line 140
13387typeattribute dumpstate hal_vibrator_client;
13388#line 140
13389
13390#line 140
13391# TODO(b/34170079): Make the inclusion of the rules below conditional also on
13392#line 140
13393# non-Treble devices. For now, on non-Treble device, always grant clients of a
13394#line 140
13395# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
13396#line 140
13397
13398#line 140
13399
13400
13401# Reading /proc/PID/maps of other processes
13402allow dumpstate self:{ capability cap_userns } sys_ptrace;
13403
13404# Allow the bugreport service to create a file in
13405# /data/data/com.android.shell/files/bugreports/bugreport
13406allow dumpstate shell_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
13407allow dumpstate shell_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
13408
13409# Run a shell.
13410allow dumpstate shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
13411
13412# For running am and similar framework commands.
13413# Run /system/bin/app_process.
13414allow dumpstate zygote_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
13415
13416# For Bluetooth
13417allow dumpstate bluetooth_data_file:dir search;
13418allow dumpstate bluetooth_logs_data_file:dir { open getattr read search ioctl lock };
13419allow dumpstate bluetooth_logs_data_file:file { getattr open read ioctl lock map };
13420
13421# Dumpstate calls screencap, which grabs a screenshot. Needs gpu access
13422allow dumpstate gpu_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
13423
13424# logd access
13425
13426#line 166
13427allow dumpstate logcat_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
13428#line 166
13429
13430#line 166
13431allow dumpstate logdr_socket:sock_file write;
13432#line 166
13433allow dumpstate logd:unix_stream_socket connectto;
13434#line 166
13435
13436#line 166
13437
13438
13439#line 167
13440# Group AID_LOG checked by filesystem & logd
13441#line 167
13442# to permit control commands
13443#line 167
13444
13445#line 167
13446allow dumpstate logd_socket:sock_file write;
13447#line 167
13448allow dumpstate logd:unix_stream_socket connectto;
13449#line 167
13450
13451#line 167
13452
13453
13454#line 168
13455allow dumpstate runtime_event_log_tags_file:file { getattr open read ioctl lock map };
13456#line 168
13457
13458
13459# Read files in /proc
13460allow dumpstate {
13461  proc_buddyinfo
13462  proc_cmdline
13463  proc_meminfo
13464  proc_modules
13465  proc_net_type
13466  proc_pipe_conf
13467  proc_pagetypeinfo
13468  proc_qtaguid_ctrl
13469  proc_qtaguid_stat
13470  proc_slabinfo
13471  proc_version
13472  proc_vmallocinfo
13473  proc_vmstat
13474}:file { getattr open read ioctl lock map };
13475
13476# Read network state info files.
13477allow dumpstate net_data_file:dir search;
13478allow dumpstate net_data_file:file { getattr open read ioctl lock map };
13479
13480# List sockets via ss.
13481allow dumpstate self:netlink_tcpdiag_socket { { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } } nlmsg_read };
13482
13483# Access /data/tombstones.
13484allow dumpstate tombstone_data_file:dir { open getattr read search ioctl lock };
13485allow dumpstate tombstone_data_file:file { getattr open read ioctl lock map };
13486
13487# Access /cache/recovery
13488allow dumpstate cache_recovery_file:dir { open getattr read search ioctl lock };
13489allow dumpstate cache_recovery_file:file { getattr open read ioctl lock map };
13490
13491# Access /data/misc/recovery
13492allow dumpstate recovery_data_file:dir { open getattr read search ioctl lock };
13493allow dumpstate recovery_data_file:file { getattr open read ioctl lock map };
13494
13495#Access /data/misc/update_engine_log
13496allow dumpstate update_engine_log_data_file:dir { open getattr read search ioctl lock };
13497allow dumpstate update_engine_log_data_file:file { getattr open read ioctl lock map };
13498
13499# Access /data/misc/profiles/{cur,ref}/
13500#line 214
13501
13502
13503# Access /data/misc/logd
13504#line 220
13505
13506
13507allow dumpstate app_fuse_file:dir { open getattr read search ioctl lock };
13508allow dumpstate overlayfs_file:dir { open getattr read search ioctl lock };
13509
13510allow dumpstate {
13511  service_manager_type
13512  -apex_service
13513  -dumpstate_service
13514  -gatekeeper_service
13515  -iorapd_service
13516  -virtual_touchpad_service
13517  -vold_service
13518  -vr_hwc_service
13519}:service_manager find;
13520# suppress denials for services dumpstate should not be accessing.
13521dontaudit dumpstate {
13522  apex_service
13523  dumpstate_service
13524  gatekeeper_service
13525  iorapd_service
13526  virtual_touchpad_service
13527  vold_service
13528  vr_hwc_service
13529}:service_manager find;
13530
13531# Most of these are neverallowed.
13532dontaudit dumpstate hwservice_manager_type:hwservice_manager find;
13533
13534allow dumpstate servicemanager:service_manager list;
13535allow dumpstate hwservicemanager:hwservice_manager list;
13536
13537allow dumpstate devpts:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
13538
13539# Set properties.
13540# dumpstate_prop is used to share state with the Shell app.
13541
13542#line 256
13543
13544#line 256
13545allow dumpstate property_socket:sock_file write;
13546#line 256
13547allow dumpstate init:unix_stream_socket connectto;
13548#line 256
13549
13550#line 256
13551allow dumpstate dumpstate_prop:property_service set;
13552#line 256
13553
13554#line 256
13555allow dumpstate dumpstate_prop:file { getattr open read map };
13556#line 256
13557
13558#line 256
13559
13560
13561#line 257
13562
13563#line 257
13564allow dumpstate property_socket:sock_file write;
13565#line 257
13566allow dumpstate init:unix_stream_socket connectto;
13567#line 257
13568
13569#line 257
13570allow dumpstate exported_dumpstate_prop:property_service set;
13571#line 257
13572
13573#line 257
13574allow dumpstate exported_dumpstate_prop:file { getattr open read map };
13575#line 257
13576
13577#line 257
13578
13579# dumpstate_options_prop is used to pass extra command-line args.
13580
13581#line 259
13582
13583#line 259
13584allow dumpstate property_socket:sock_file write;
13585#line 259
13586allow dumpstate init:unix_stream_socket connectto;
13587#line 259
13588
13589#line 259
13590allow dumpstate dumpstate_options_prop:property_service set;
13591#line 259
13592
13593#line 259
13594allow dumpstate dumpstate_options_prop:file { getattr open read map };
13595#line 259
13596
13597#line 259
13598
13599
13600# Read any system properties
13601
13602#line 262
13603allow dumpstate property_type:file { getattr open read map };
13604#line 262
13605
13606
13607# Access to /data/media.
13608# This should be removed if sdcardfs is modified to alter the secontext for its
13609# accesses to the underlying FS.
13610allow dumpstate media_rw_data_file:dir getattr;
13611allow dumpstate proc_interrupts:file { getattr open read ioctl lock map };
13612allow dumpstate proc_zoneinfo:file { getattr open read ioctl lock map };
13613
13614# Create a service for talking back to system_server
13615
13616#line 272
13617  allow dumpstate dumpstate_service:service_manager { add find };
13618#line 272
13619  neverallow { domain -dumpstate } dumpstate_service:service_manager add;
13620#line 272
13621
13622
13623# use /dev/ion for screen capture
13624allow dumpstate ion_device:chr_file { getattr open read ioctl lock map };
13625
13626# Allow dumpstate to run top
13627allow dumpstate proc_stat:file { getattr open read ioctl lock map };
13628
13629# Allow dumpstate to talk to installd over binder
13630
13631#line 281
13632# Call the server domain and optionally transfer references to it.
13633#line 281
13634allow dumpstate installd:binder { call transfer };
13635#line 281
13636# Allow the serverdomain to transfer references to the client on the reply.
13637#line 281
13638allow installd dumpstate:binder transfer;
13639#line 281
13640# Receive and use open files from the server.
13641#line 281
13642allow dumpstate installd:fd use;
13643#line 281
13644;
13645
13646# Allow dumpstate to run ip xfrm policy
13647allow dumpstate self:netlink_xfrm_socket { { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } } nlmsg_read };
13648
13649# Allow dumpstate to run iotop
13650allow dumpstate self:netlink_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
13651# newer kernels (e.g. 4.4) have a new class for sockets
13652allow dumpstate self:netlink_generic_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
13653
13654# Allow dumpstate to run ss
13655allow dumpstate { domain pdx_channel_socket_type pdx_endpoint_socket_type }:{ socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket appletalk_socket netlink_route_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket xdp_socket } getattr;
13656
13657# For when dumpstate runs df
13658dontaudit dumpstate mnt_vendor_file:dir search;
13659dontaudit dumpstate apex_mnt_dir:dir getattr;
13660
13661# Allow dumpstate to talk to bufferhubd over binder
13662
13663#line 299
13664# Call the server domain and optionally transfer references to it.
13665#line 299
13666allow dumpstate bufferhubd:binder { call transfer };
13667#line 299
13668# Allow the serverdomain to transfer references to the client on the reply.
13669#line 299
13670allow bufferhubd dumpstate:binder transfer;
13671#line 299
13672# Receive and use open files from the server.
13673#line 299
13674allow dumpstate bufferhubd:fd use;
13675#line 299
13676;
13677
13678# Allow dumpstate to talk to mediaswcodec over binder
13679
13680#line 302
13681# Call the server domain and optionally transfer references to it.
13682#line 302
13683allow dumpstate mediaswcodec:binder { call transfer };
13684#line 302
13685# Allow the serverdomain to transfer references to the client on the reply.
13686#line 302
13687allow mediaswcodec dumpstate:binder transfer;
13688#line 302
13689# Receive and use open files from the server.
13690#line 302
13691allow dumpstate mediaswcodec:fd use;
13692#line 302
13693;
13694
13695# Allow dumpstate to kill vendor dumpstate service by init
13696
13697#line 305
13698
13699#line 305
13700allow dumpstate property_socket:sock_file write;
13701#line 305
13702allow dumpstate init:unix_stream_socket connectto;
13703#line 305
13704
13705#line 305
13706allow dumpstate ctl_dumpstate_prop:property_service set;
13707#line 305
13708
13709#line 305
13710allow dumpstate ctl_dumpstate_prop:file { getattr open read map };
13711#line 305
13712
13713#line 305
13714
13715
13716###
13717### neverallow rules
13718###
13719
13720# dumpstate has capability sys_ptrace, but should only use that capability for
13721# accessing sensitive /proc/PID files, never for using ptrace attach.
13722neverallow dumpstate *:process ptrace;
13723
13724# only system_server, dumpstate, traceur_app and shell can find the dumpstate service
13725neverallow {
13726  domain
13727  -system_server
13728  -shell
13729  -traceur_app
13730  -dumpstate
13731} dumpstate_service:service_manager find;
13732#line 1 "system/sepolicy/prebuilts/api/29.0/public/e2fs.te"
13733type e2fs, domain, coredomain;
13734type e2fs_exec, system_file_type, exec_type, file_type;
13735
13736allow e2fs devpts:chr_file { read write getattr ioctl };
13737
13738allow e2fs dev_type:blk_file getattr;
13739allow e2fs block_device:dir search;
13740allow e2fs userdata_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
13741allow e2fs metadata_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
13742allow e2fs dm_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
13743allowxperm e2fs { userdata_block_device metadata_block_device dm_device }:blk_file ioctl {
13744  0x0000127d 0x00001277 0x0000127b 0x0000127c 0x0000125e
13745};
13746
13747allow e2fs {
13748  proc_filesystems
13749  proc_mounts
13750  proc_swaps
13751}:file { getattr open read ioctl lock map };
13752
13753# access /sys/fs/ext4/features
13754allow e2fs sysfs_fs_ext4_features:dir search;
13755allow e2fs sysfs_fs_ext4_features:file { getattr open read ioctl lock map };
13756
13757# access SELinux context files
13758allow e2fs file_contexts_file:file { getattr open read ioctl lock map };
13759#line 1 "system/sepolicy/prebuilts/api/29.0/public/ephemeral_app.te"
13760###
13761### Ephemeral apps.
13762###
13763### This file defines the security policy for apps with the ephemeral
13764### feature.
13765###
13766### The ephemeral_app domain is a reduced permissions sandbox allowing
13767### ephemeral applications to be safely installed and run. Non ephemeral
13768### applications may also opt-in to ephemeral to take advantage of the
13769### additional security features.
13770###
13771### PackageManager flags an app as ephemeral at install time.
13772
13773type ephemeral_app, domain;
13774#line 1 "system/sepolicy/prebuilts/api/29.0/public/fastbootd.te"
13775# fastbootd (used in recovery init.rc for /sbin/fastbootd)
13776
13777# Declare the domain unconditionally so we can always reference it
13778# in neverallow rules.
13779type fastbootd, domain;
13780
13781# But the allow rules are only included in the recovery policy.
13782# Otherwise fastbootd is only allowed the domain rules.
13783#line 107
13784
13785
13786###
13787### neverallow rules
13788###
13789
13790# Write permission is required to wipe userdata
13791# until recovery supports vold.
13792neverallow fastbootd {
13793   data_file_type
13794}:file { { execute execute_no_trans } };
13795#line 1 "system/sepolicy/prebuilts/api/29.0/public/file.te"
13796# Filesystem types
13797type labeledfs, fs_type;
13798type pipefs, fs_type;
13799type sockfs, fs_type;
13800type rootfs, fs_type;
13801type proc, fs_type, proc_type;
13802# Security-sensitive proc nodes that should not be writable to most.
13803type proc_security, fs_type, proc_type;
13804type proc_drop_caches, fs_type, proc_type;
13805type proc_overcommit_memory, fs_type, proc_type;
13806type proc_min_free_order_shift, fs_type, proc_type;
13807# proc, sysfs, or other nodes that permit configuration of kernel usermodehelpers.
13808type usermodehelper, fs_type, proc_type;
13809type sysfs_usermodehelper, fs_type, sysfs_type;
13810type proc_qtaguid_ctrl, fs_type, mlstrustedobject, proc_type;
13811type proc_qtaguid_stat, fs_type, mlstrustedobject, proc_type;
13812type proc_bluetooth_writable, fs_type, proc_type;
13813type proc_abi, fs_type, proc_type;
13814type proc_asound, fs_type, proc_type;
13815type proc_buddyinfo, fs_type, proc_type;
13816type proc_cmdline, fs_type, proc_type;
13817type proc_cpuinfo, fs_type, proc_type;
13818type proc_dirty, fs_type, proc_type;
13819type proc_diskstats, fs_type, proc_type;
13820type proc_extra_free_kbytes, fs_type, proc_type;
13821type proc_filesystems, fs_type, proc_type;
13822type proc_fs_verity, fs_type, proc_type;
13823type proc_hostname, fs_type, proc_type;
13824type proc_hung_task, fs_type, proc_type;
13825type proc_interrupts, fs_type, proc_type;
13826type proc_iomem, fs_type, proc_type;
13827type proc_keys, fs_type, proc_type;
13828type proc_kmsg, fs_type, proc_type;
13829type proc_loadavg, fs_type, proc_type;
13830type proc_max_map_count, fs_type, proc_type;
13831type proc_meminfo, fs_type, proc_type;
13832type proc_misc, fs_type, proc_type;
13833type proc_modules, fs_type, proc_type;
13834type proc_mounts, fs_type, proc_type;
13835type proc_net, fs_type, proc_type, proc_net_type;
13836type proc_net_tcp_udp, fs_type, proc_type;
13837type proc_page_cluster, fs_type, proc_type;
13838type proc_pagetypeinfo, fs_type, proc_type;
13839type proc_panic, fs_type, proc_type;
13840type proc_perf, fs_type, proc_type;
13841type proc_pid_max, fs_type, proc_type;
13842type proc_pipe_conf, fs_type, proc_type;
13843type proc_pressure_cpu, fs_type, proc_type;
13844type proc_pressure_io, fs_type, proc_type;
13845type proc_pressure_mem, fs_type, proc_type;
13846type proc_random, fs_type, proc_type;
13847type proc_sched, fs_type, proc_type;
13848type proc_slabinfo, fs_type, proc_type;
13849type proc_stat, fs_type, proc_type;
13850type proc_swaps, fs_type, proc_type;
13851type proc_sysrq, fs_type, proc_type;
13852type proc_timer, fs_type, proc_type;
13853type proc_tty_drivers, fs_type, proc_type;
13854type proc_uid_cputime_showstat, fs_type, proc_type;
13855type proc_uid_cputime_removeuid, fs_type, proc_type;
13856type proc_uid_io_stats, fs_type, proc_type;
13857type proc_uid_procstat_set, fs_type, proc_type;
13858type proc_uid_time_in_state, fs_type, proc_type;
13859type proc_uid_concurrent_active_time, fs_type, proc_type;
13860type proc_uid_concurrent_policy_time, fs_type, proc_type;
13861type proc_uid_cpupower, fs_type, proc_type;
13862type proc_uptime, fs_type, proc_type;
13863type proc_version, fs_type, proc_type;
13864type proc_vmallocinfo, fs_type, proc_type;
13865type proc_vmstat, fs_type, proc_type;
13866type proc_zoneinfo, fs_type, proc_type;
13867type selinuxfs, fs_type, mlstrustedobject;
13868type cgroup, fs_type, mlstrustedobject;
13869type cgroup_bpf, fs_type;
13870type sysfs, fs_type, sysfs_type, mlstrustedobject;
13871type sysfs_android_usb, fs_type, sysfs_type;
13872type sysfs_uio, sysfs_type, fs_type;
13873type sysfs_batteryinfo, fs_type, sysfs_type;
13874type sysfs_bluetooth_writable, fs_type, sysfs_type, mlstrustedobject;
13875type sysfs_devices_block, fs_type, sysfs_type;
13876type sysfs_dm, fs_type, sysfs_type;
13877type sysfs_dt_firmware_android, fs_type, sysfs_type;
13878type sysfs_extcon, fs_type, sysfs_type;
13879type sysfs_ipv4, fs_type, sysfs_type;
13880type sysfs_kernel_notes, fs_type, sysfs_type, mlstrustedobject;
13881type sysfs_leds, fs_type, sysfs_type;
13882type sysfs_loop, fs_type, sysfs_type;
13883type sysfs_hwrandom, fs_type, sysfs_type;
13884type sysfs_nfc_power_writable, fs_type, sysfs_type, mlstrustedobject;
13885type sysfs_wake_lock, fs_type, sysfs_type;
13886type sysfs_mac_address, fs_type, sysfs_type;
13887type sysfs_net, fs_type, sysfs_type;
13888type sysfs_power, fs_type, sysfs_type;
13889type sysfs_rtc, fs_type, sysfs_type;
13890type sysfs_switch, fs_type, sysfs_type;
13891type sysfs_transparent_hugepage, fs_type, sysfs_type;
13892type sysfs_usb, fs_type, sysfs_type;
13893type sysfs_wakeup_reasons, fs_type, sysfs_type;
13894type sysfs_fs_ext4_features, sysfs_type, fs_type;
13895type sysfs_fs_f2fs, sysfs_type, fs_type;
13896type fs_bpf, fs_type;
13897type configfs, fs_type;
13898# /sys/devices/system/cpu
13899type sysfs_devices_system_cpu, fs_type, sysfs_type;
13900# /sys/module/lowmemorykiller
13901type sysfs_lowmemorykiller, fs_type, sysfs_type;
13902# /sys/module/wlan/parameters/fwpath
13903type sysfs_wlan_fwpath, fs_type, sysfs_type;
13904type sysfs_vibrator, fs_type, sysfs_type;
13905
13906type sysfs_thermal, sysfs_type, fs_type;
13907
13908type sysfs_zram, fs_type, sysfs_type;
13909type sysfs_zram_uevent, fs_type, sysfs_type;
13910type inotify, fs_type, mlstrustedobject;
13911type devpts, fs_type, mlstrustedobject;
13912type tmpfs, fs_type;
13913type shm, fs_type;
13914type mqueue, fs_type;
13915type fuse, sdcard_type, fs_type, mlstrustedobject;
13916type sdcardfs, sdcard_type, fs_type, mlstrustedobject;
13917type vfat, sdcard_type, fs_type, mlstrustedobject;
13918type exfat, sdcard_type, fs_type, mlstrustedobject;
13919type debugfs, fs_type, debugfs_type;
13920type debugfs_mmc, fs_type, debugfs_type;
13921type debugfs_trace_marker, fs_type, debugfs_type, mlstrustedobject;
13922type debugfs_tracing, fs_type, debugfs_type, mlstrustedobject;
13923type debugfs_tracing_debug, fs_type, debugfs_type, mlstrustedobject;
13924type debugfs_tracing_instances, fs_type, debugfs_type;
13925type debugfs_wakeup_sources, fs_type, debugfs_type;
13926type debugfs_wifi_tracing, fs_type, debugfs_type;
13927
13928type pstorefs, fs_type;
13929type functionfs, fs_type, mlstrustedobject;
13930type oemfs, fs_type, contextmount_type;
13931type usbfs, fs_type;
13932type binfmt_miscfs, fs_type;
13933type app_fusefs, fs_type, contextmount_type;
13934
13935# File types
13936type unlabeled, file_type;
13937
13938# Default type for anything under /system.
13939type system_file, system_file_type, file_type;
13940# Default type for /system/asan.options
13941type system_asan_options_file, system_file_type, file_type;
13942# Type for /system/etc/event-log-tags (liblog implementation detail)
13943type system_event_log_tags_file, system_file_type, file_type;
13944# Default type for anything under /system/lib[64].
13945type system_lib_file, system_file_type, file_type;
13946# system libraries that are available only to bootstrap processes
13947type system_bootstrap_lib_file, system_file_type, file_type;
13948# Default type for linker executable /system/bin/linker[64].
13949type system_linker_exec, system_file_type, file_type;
13950# Default type for linker config /system/etc/ld.config.*.
13951type system_linker_config_file, system_file_type, file_type;
13952# Default type for linker config /system/etc/seccomp_policy/*.
13953type system_seccomp_policy_file, system_file_type, file_type;
13954# Default type for cacerts in /system/etc/security/cacerts/*.
13955type system_security_cacerts_file, system_file_type, file_type;
13956# Default type for /system/bin/tcpdump.
13957type tcpdump_exec, system_file_type, exec_type, file_type;
13958# Default type for zoneinfo files in /system/usr/share/zoneinfo/*.
13959type system_zoneinfo_file, system_file_type, file_type;
13960# Cgroups description file under /system/etc/cgroups.json
13961type cgroup_desc_file, system_file_type, file_type;
13962# Vendor cgroups description file under /vendor/etc/cgroups.json
13963type vendor_cgroup_desc_file, vendor_file_type, file_type;
13964# Task profiles file under /system/etc/task_profiles.json
13965type task_profiles_file, system_file_type, file_type;
13966# Vendor task profiles file under /vendor/etc/task_profiles.json
13967type vendor_task_profiles_file, vendor_file_type, file_type;
13968
13969# Default type for directories search for
13970# HAL implementations
13971type vendor_hal_file, vendor_file_type, file_type;
13972# Default type for under /vendor or /system/vendor
13973type vendor_file, vendor_file_type, file_type;
13974# Default type for everything in /vendor/app
13975type vendor_app_file, vendor_file_type, file_type;
13976# Default type for everything under /vendor/etc/
13977type vendor_configs_file, vendor_file_type, file_type;
13978# Default type for all *same process* HALs and their lib/bin dependencies.
13979# e.g. libEGL_xxx.so, [email protected]
13980type same_process_hal_file, vendor_file_type, file_type;
13981# Default type for vndk-sp libs. /vendor/lib/vndk-sp
13982type vndk_sp_file, vendor_file_type, file_type;
13983# Default type for everything in /vendor/framework
13984type vendor_framework_file, vendor_file_type, file_type;
13985# Default type for everything in /vendor/overlay
13986type vendor_overlay_file, vendor_file_type, file_type;
13987# Type for all vendor public libraries. These libs should only be exposed to
13988# apps. ABI stability of these libs is vendor's responsibility.
13989type vendor_public_lib_file, vendor_file_type, file_type;
13990
13991# Input configuration
13992type vendor_keylayout_file, vendor_file_type, file_type;
13993type vendor_keychars_file, vendor_file_type, file_type;
13994type vendor_idc_file, vendor_file_type, file_type;
13995
13996# /metadata partition itself
13997type metadata_file, file_type;
13998# Vold files within /metadata
13999type vold_metadata_file, file_type;
14000# GSI files within /metadata
14001type gsi_metadata_file, file_type;
14002# system_server shares Weaver slot information in /metadata
14003type password_slot_metadata_file, file_type;
14004# APEX files within /metadata
14005type apex_metadata_file, file_type;
14006
14007# Type for /dev/cpu_variant:.*.
14008type dev_cpu_variant, file_type;
14009# Speedup access for trusted applications to the runtime event tags
14010type runtime_event_log_tags_file, file_type;
14011# Type for /system/bin/logcat.
14012type logcat_exec, system_file_type, exec_type, file_type;
14013# Speedup access to cgroup map file
14014type cgroup_rc_file, file_type;
14015# /cores for coredumps on userdebug / eng builds
14016type coredump_file, file_type;
14017# Default type for anything under /data.
14018type system_data_file, file_type, data_file_type, core_data_file_type;
14019# Type for /data/system/packages.list.
14020# TODO(b/129332765): Narrow down permissions to this.
14021# Find out users of system_data_file that should be granted only this.
14022type packages_list_file, file_type, data_file_type, core_data_file_type;
14023# Default type for anything under /data/vendor{_ce,_de}.
14024type vendor_data_file, file_type, data_file_type;
14025# Unencrypted data
14026type unencrypted_data_file, file_type, data_file_type, core_data_file_type;
14027# /data/.layout_version or other installd-created files that
14028# are created in a system_data_file directory.
14029type install_data_file, file_type, data_file_type, core_data_file_type;
14030# /data/drm - DRM plugin data
14031type drm_data_file, file_type, data_file_type, core_data_file_type;
14032# /data/adb - adb debugging files
14033type adb_data_file, file_type, data_file_type, core_data_file_type;
14034# /data/anr - ANR traces
14035type anr_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14036# /data/tombstones - core dumps
14037type tombstone_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14038# /data/vendor/tombstones/wifi - vendor wifi dumps
14039type tombstone_wifi_data_file, file_type, data_file_type;
14040# /data/apex - APEX data files
14041type apex_data_file, file_type, data_file_type, core_data_file_type;
14042# /data/app - user-installed apps
14043type apk_data_file, file_type, data_file_type, core_data_file_type;
14044type apk_tmp_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14045# /data/app-private - forward-locked apps
14046type apk_private_data_file, file_type, data_file_type, core_data_file_type;
14047type apk_private_tmp_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14048# /data/dalvik-cache
14049type dalvikcache_data_file, file_type, data_file_type, core_data_file_type;
14050# /data/ota
14051type ota_data_file, file_type, data_file_type, core_data_file_type;
14052# /data/ota_package
14053type ota_package_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14054# /data/misc/profiles
14055type user_profile_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14056# /data/misc/profman
14057type profman_dump_data_file, file_type, data_file_type, core_data_file_type;
14058# /data/resource-cache
14059type resourcecache_data_file, file_type, data_file_type, core_data_file_type;
14060# /data/local - writable by shell
14061type shell_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14062# /data/property
14063type property_data_file, file_type, data_file_type, core_data_file_type;
14064# /data/bootchart
14065type bootchart_data_file, file_type, data_file_type, core_data_file_type;
14066# /data/system/dropbox
14067type dropbox_data_file, file_type, data_file_type, core_data_file_type;
14068# /data/system/heapdump
14069type heapdump_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14070# /data/nativetest
14071type nativetest_data_file, file_type, data_file_type, core_data_file_type;
14072# /data/system_de/0/ringtones
14073type ringtone_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14074# /data/preloads
14075type preloads_data_file, file_type, data_file_type, core_data_file_type;
14076# /data/preloads/media
14077type preloads_media_file, file_type, data_file_type, core_data_file_type;
14078# /data/misc/dhcp and /data/misc/dhcp-6.8.2
14079type dhcp_data_file, file_type, data_file_type, core_data_file_type;
14080# /data/server_configurable_flags
14081type server_configurable_flags_data_file, file_type, data_file_type, core_data_file_type;
14082# /data/app-staging
14083type staging_data_file, file_type, data_file_type, core_data_file_type;
14084
14085# Mount locations managed by vold
14086type mnt_media_rw_file, file_type;
14087type mnt_user_file, file_type;
14088type mnt_expand_file, file_type;
14089type storage_file, file_type;
14090
14091# Label for storage dirs which are just mount stubs
14092type mnt_media_rw_stub_file, file_type;
14093type storage_stub_file, file_type;
14094
14095# Mount location for read-write vendor partitions.
14096type mnt_vendor_file, file_type;
14097
14098# Mount location for read-write product partitions.
14099type mnt_product_file, file_type;
14100
14101# Mount point used for APEX images
14102type apex_mnt_dir, file_type;
14103
14104# /postinstall: Mount point used by update_engine to run postinstall.
14105type postinstall_mnt_dir, file_type;
14106# Files inside the /postinstall mountpoint are all labeled as postinstall_file.
14107type postinstall_file, file_type;
14108# /postinstall/apex: Mount point used for APEX images within /postinstall.
14109type postinstall_apex_mnt_dir, file_type;
14110
14111# /data/misc subdirectories
14112type adb_keys_file, file_type, data_file_type, core_data_file_type;
14113type audio_data_file, file_type, data_file_type, core_data_file_type;
14114type audioserver_data_file, file_type, data_file_type, core_data_file_type;
14115type bluetooth_data_file, file_type, data_file_type, core_data_file_type;
14116type bluetooth_logs_data_file, file_type, data_file_type, core_data_file_type;
14117type bootstat_data_file, file_type, data_file_type, core_data_file_type;
14118type boottrace_data_file, file_type, data_file_type, core_data_file_type;
14119type camera_data_file, file_type, data_file_type, core_data_file_type;
14120type gatekeeper_data_file, file_type, data_file_type, core_data_file_type;
14121type incident_data_file, file_type, data_file_type, core_data_file_type;
14122type keychain_data_file, file_type, data_file_type, core_data_file_type;
14123type keystore_data_file, file_type, data_file_type, core_data_file_type;
14124type media_data_file, file_type, data_file_type, core_data_file_type;
14125type media_rw_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14126type misc_user_data_file, file_type, data_file_type, core_data_file_type;
14127type net_data_file, file_type, data_file_type, core_data_file_type;
14128type network_watchlist_data_file, file_type, data_file_type, core_data_file_type;
14129type nfc_data_file, file_type, data_file_type, core_data_file_type;
14130type radio_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14131type recovery_data_file, file_type, data_file_type, core_data_file_type;
14132type shared_relro_file, file_type, data_file_type, core_data_file_type;
14133type stats_data_file, file_type, data_file_type, core_data_file_type;
14134type systemkeys_data_file, file_type, data_file_type, core_data_file_type;
14135type textclassifier_data_file, file_type, data_file_type, core_data_file_type;
14136type trace_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14137type vpn_data_file, file_type, data_file_type, core_data_file_type;
14138type wifi_data_file, file_type, data_file_type, core_data_file_type;
14139type zoneinfo_data_file, file_type, data_file_type, core_data_file_type;
14140type vold_data_file, file_type, data_file_type, core_data_file_type;
14141type iorapd_data_file, file_type, data_file_type, core_data_file_type;
14142type perfprofd_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14143type tee_data_file, file_type, data_file_type;
14144type update_engine_data_file, file_type, data_file_type, core_data_file_type;
14145type update_engine_log_data_file, file_type, data_file_type, core_data_file_type;
14146# /data/misc/trace for method traces on userdebug / eng builds
14147type method_trace_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14148type gsi_data_file, file_type, data_file_type, core_data_file_type;
14149
14150# /data/data subdirectories - app sandboxes
14151type app_data_file, file_type, data_file_type, core_data_file_type;
14152# /data/data subdirectories - priv-app sandboxes
14153type privapp_data_file, file_type, data_file_type, core_data_file_type;
14154# /data/data subdirectory for system UID apps.
14155type system_app_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14156# Compatibility with type name used in Android 4.3 and 4.4.
14157# Default type for anything under /cache
14158type cache_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14159# Type for /cache/overlay /mnt/scratch/overlay
14160type overlayfs_file, file_type, data_file_type, core_data_file_type;
14161# Type for /cache/backup_stage/* (fd interchange with apps)
14162type cache_backup_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14163# type for anything under /cache/backup (local transport storage)
14164type cache_private_backup_file, file_type, data_file_type, core_data_file_type;
14165# Type for anything under /cache/recovery
14166type cache_recovery_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14167# Default type for anything under /efs
14168type efs_file, file_type;
14169# Type for wallpaper file.
14170type wallpaper_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14171# Type for shortcut manager icon file.
14172type shortcut_manager_icons, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14173# Type for user icon file.
14174type icon_file, file_type, data_file_type, core_data_file_type;
14175# /mnt/asec
14176type asec_apk_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14177# Elements of asec files (/mnt/asec) that are world readable
14178type asec_public_file, file_type, data_file_type, core_data_file_type;
14179# /data/app-asec
14180type asec_image_file, file_type, data_file_type, core_data_file_type;
14181# /data/backup and /data/secure/backup
14182type backup_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14183# All devices have bluetooth efs files. But they
14184# vary per device, so this type is used in per
14185# device policy
14186type bluetooth_efs_file, file_type;
14187# Type for fingerprint template file
14188type fingerprintd_data_file, file_type, data_file_type, core_data_file_type;
14189# Type for _new_ fingerprint template file
14190type fingerprint_vendor_data_file, file_type, data_file_type;
14191# Type for appfuse file.
14192type app_fuse_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
14193# Type for face template file
14194type face_vendor_data_file, file_type, data_file_type;
14195# Type for iris template file
14196type iris_vendor_data_file, file_type, data_file_type;
14197
14198# Socket types
14199type adbd_socket, file_type, coredomain_socket;
14200type bluetooth_socket, file_type, data_file_type, core_data_file_type, coredomain_socket;
14201type dnsproxyd_socket, file_type, coredomain_socket, mlstrustedobject;
14202type dumpstate_socket, file_type, coredomain_socket;
14203type fwmarkd_socket, file_type, coredomain_socket, mlstrustedobject;
14204type lmkd_socket, file_type, coredomain_socket;
14205type logd_socket, file_type, coredomain_socket, mlstrustedobject;
14206type logdr_socket, file_type, coredomain_socket, mlstrustedobject;
14207type logdw_socket, file_type, coredomain_socket, mlstrustedobject;
14208type mdns_socket, file_type, coredomain_socket;
14209type mdnsd_socket, file_type, coredomain_socket, mlstrustedobject;
14210type misc_logd_file, coredomain_socket, file_type, data_file_type, core_data_file_type;
14211type mtpd_socket, file_type, coredomain_socket;
14212type property_socket, file_type, coredomain_socket, mlstrustedobject;
14213type racoon_socket, file_type, coredomain_socket;
14214type recovery_socket, file_type, coredomain_socket;
14215type rild_socket, file_type;
14216type rild_debug_socket, file_type;
14217type statsdw_socket, file_type, coredomain_socket, mlstrustedobject;
14218type system_wpa_socket, file_type, data_file_type, core_data_file_type, coredomain_socket;
14219type system_ndebug_socket, file_type, data_file_type, core_data_file_type, coredomain_socket, mlstrustedobject;
14220type tombstoned_crash_socket, file_type, coredomain_socket, mlstrustedobject;
14221type tombstoned_java_trace_socket, file_type, mlstrustedobject;
14222type tombstoned_intercept_socket, file_type, coredomain_socket;
14223type traced_producer_socket, file_type, coredomain_socket, mlstrustedobject;
14224type traced_consumer_socket, file_type, coredomain_socket, mlstrustedobject;
14225type uncrypt_socket, file_type, coredomain_socket;
14226type wpa_socket, file_type, data_file_type, core_data_file_type;
14227type zygote_socket, file_type, coredomain_socket;
14228type heapprofd_socket, file_type, coredomain_socket, mlstrustedobject;
14229# UART (for GPS) control proc file
14230type gps_control, file_type;
14231
14232# PDX endpoint types
14233type pdx_display_dir, pdx_endpoint_dir_type, file_type;
14234type pdx_performance_dir, pdx_endpoint_dir_type, file_type;
14235type pdx_bufferhub_dir, pdx_endpoint_dir_type, file_type;
14236
14237
14238#line 442
14239typeattribute pdx_display_dir pdx_display_client_endpoint_dir_type;
14240#line 442
14241type pdx_display_client_endpoint_socket, pdx_display_client_endpoint_socket_type, pdx_endpoint_socket_type, file_type, coredomain_socket, mlstrustedobject, mlstrustedsubject;
14242#line 442
14243type pdx_display_client_channel_socket, pdx_display_client_channel_socket_type, pdx_channel_socket_type, coredomain_socket;
14244#line 442
14245
14246#line 442
14247
14248
14249#line 443
14250typeattribute pdx_display_dir pdx_display_manager_endpoint_dir_type;
14251#line 443
14252type pdx_display_manager_endpoint_socket, pdx_display_manager_endpoint_socket_type, pdx_endpoint_socket_type, file_type, coredomain_socket, mlstrustedobject, mlstrustedsubject;
14253#line 443
14254type pdx_display_manager_channel_socket, pdx_display_manager_channel_socket_type, pdx_channel_socket_type, coredomain_socket;
14255#line 443
14256
14257#line 443
14258
14259
14260#line 444
14261typeattribute pdx_display_dir pdx_display_screenshot_endpoint_dir_type;
14262#line 444
14263type pdx_display_screenshot_endpoint_socket, pdx_display_screenshot_endpoint_socket_type, pdx_endpoint_socket_type, file_type, coredomain_socket, mlstrustedobject, mlstrustedsubject;
14264#line 444
14265type pdx_display_screenshot_channel_socket, pdx_display_screenshot_channel_socket_type, pdx_channel_socket_type, coredomain_socket;
14266#line 444
14267
14268#line 444
14269
14270
14271#line 445
14272typeattribute pdx_display_dir pdx_display_vsync_endpoint_dir_type;
14273#line 445
14274type pdx_display_vsync_endpoint_socket, pdx_display_vsync_endpoint_socket_type, pdx_endpoint_socket_type, file_type, coredomain_socket, mlstrustedobject, mlstrustedsubject;
14275#line 445
14276type pdx_display_vsync_channel_socket, pdx_display_vsync_channel_socket_type, pdx_channel_socket_type, coredomain_socket;
14277#line 445
14278
14279#line 445
14280
14281
14282#line 446
14283typeattribute pdx_performance_dir pdx_performance_client_endpoint_dir_type;
14284#line 446
14285type pdx_performance_client_endpoint_socket, pdx_performance_client_endpoint_socket_type, pdx_endpoint_socket_type, file_type, coredomain_socket, mlstrustedobject, mlstrustedsubject;
14286#line 446
14287type pdx_performance_client_channel_socket, pdx_performance_client_channel_socket_type, pdx_channel_socket_type, coredomain_socket;
14288#line 446
14289
14290#line 446
14291
14292
14293#line 447
14294typeattribute pdx_bufferhub_dir pdx_bufferhub_client_endpoint_dir_type;
14295#line 447
14296type pdx_bufferhub_client_endpoint_socket, pdx_bufferhub_client_endpoint_socket_type, pdx_endpoint_socket_type, file_type, coredomain_socket, mlstrustedobject, mlstrustedsubject;
14297#line 447
14298type pdx_bufferhub_client_channel_socket, pdx_bufferhub_client_channel_socket_type, pdx_channel_socket_type, coredomain_socket;
14299#line 447
14300
14301#line 447
14302
14303
14304# file_contexts files
14305type file_contexts_file, system_file_type, file_type;
14306
14307# mac_permissions file
14308type mac_perms_file, system_file_type, file_type;
14309
14310# property_contexts file
14311type property_contexts_file, system_file_type, file_type;
14312
14313# seapp_contexts file
14314type seapp_contexts_file, system_file_type, file_type;
14315
14316# sepolicy files binary and others
14317type sepolicy_file, system_file_type, file_type;
14318
14319# service_contexts file
14320type service_contexts_file, system_file_type, file_type;
14321
14322# nonplat service_contexts file (only accessible on non full-treble devices)
14323type nonplat_service_contexts_file, file_type;
14324
14325# hwservice_contexts file
14326type hwservice_contexts_file, system_file_type, file_type;
14327
14328# vndservice_contexts file
14329type vndservice_contexts_file, file_type;
14330
14331# Allow files to be created in their appropriate filesystems.
14332allow fs_type self:filesystem associate;
14333allow cgroup tmpfs:filesystem associate;
14334allow cgroup_bpf tmpfs:filesystem associate;
14335allow cgroup_rc_file tmpfs:filesystem associate;
14336allow sysfs_type sysfs:filesystem associate;
14337allow debugfs_type { debugfs debugfs_tracing debugfs_tracing_debug }:filesystem associate;
14338allow file_type labeledfs:filesystem associate;
14339allow file_type tmpfs:filesystem associate;
14340allow file_type rootfs:filesystem associate;
14341allow dev_type tmpfs:filesystem associate;
14342allow app_fuse_file app_fusefs:filesystem associate;
14343allow postinstall_file self:filesystem associate;
14344
14345# asanwrapper (run a sanitized app_process, to be used with wrap properties)
14346
14347
14348# Deprecated in SDK version 28
14349type audiohal_data_file, file_type, data_file_type, core_data_file_type;
14350
14351# It's a bug to assign the file_type attribute and fs_type attribute
14352# to any type. Do not allow it.
14353#
14354# For example, the following is a bug:
14355#   type apk_data_file, file_type, data_file_type, fs_type;
14356# Should be:
14357#   type apk_data_file, file_type, data_file_type;
14358neverallow fs_type file_type:filesystem associate;
14359#line 1 "system/sepolicy/prebuilts/api/29.0/public/fingerprintd.te"
14360type fingerprintd, domain;
14361type fingerprintd_exec, system_file_type, exec_type, file_type;
14362
14363
14364#line 4
14365# Call the servicemanager and transfer references to it.
14366#line 4
14367allow fingerprintd servicemanager:binder { call transfer };
14368#line 4
14369# servicemanager performs getpidcon on clients.
14370#line 4
14371allow servicemanager fingerprintd:dir search;
14372#line 4
14373allow servicemanager fingerprintd:file { read open };
14374#line 4
14375allow servicemanager fingerprintd:process getattr;
14376#line 4
14377# rw access to /dev/binder and /dev/ashmem is presently granted to
14378#line 4
14379# all domains in domain.te.
14380#line 4
14381
14382
14383# Scan through /system/lib64/hw looking for installed HALs
14384allow fingerprintd system_file:dir { open getattr read search ioctl lock };
14385
14386# need to find KeyStore and add self
14387
14388#line 10
14389  allow fingerprintd fingerprintd_service:service_manager { add find };
14390#line 10
14391  neverallow { domain -fingerprintd } fingerprintd_service:service_manager add;
14392#line 10
14393
14394
14395# allow HAL module to read dir contents
14396allow fingerprintd fingerprintd_data_file:file { { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } } };
14397
14398# allow HAL module to read/write/unlink contents of this dir
14399allow fingerprintd fingerprintd_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
14400
14401# Need to add auth tokens to KeyStore
14402
14403#line 19
14404  allow keystore fingerprintd:dir search;
14405#line 19
14406  allow keystore fingerprintd:file { read open };
14407#line 19
14408  allow keystore fingerprintd:process getattr;
14409#line 19
14410  allow fingerprintd keystore_service:service_manager find;
14411#line 19
14412
14413#line 19
14414# Call the server domain and optionally transfer references to it.
14415#line 19
14416allow fingerprintd keystore:binder { call transfer };
14417#line 19
14418# Allow the serverdomain to transfer references to the client on the reply.
14419#line 19
14420allow keystore fingerprintd:binder transfer;
14421#line 19
14422# Receive and use open files from the server.
14423#line 19
14424allow fingerprintd keystore:fd use;
14425#line 19
14426
14427#line 19
14428
14429#line 19
14430# Call the server domain and optionally transfer references to it.
14431#line 19
14432allow keystore fingerprintd:binder { call transfer };
14433#line 19
14434# Allow the serverdomain to transfer references to the client on the reply.
14435#line 19
14436allow fingerprintd keystore:binder transfer;
14437#line 19
14438# Receive and use open files from the server.
14439#line 19
14440allow keystore fingerprintd:fd use;
14441#line 19
14442
14443#line 19
14444
14445allow fingerprintd keystore:keystore_key { add_auth };
14446
14447# For permissions checking
14448
14449#line 23
14450# Call the server domain and optionally transfer references to it.
14451#line 23
14452allow fingerprintd system_server:binder { call transfer };
14453#line 23
14454# Allow the serverdomain to transfer references to the client on the reply.
14455#line 23
14456allow system_server fingerprintd:binder transfer;
14457#line 23
14458# Receive and use open files from the server.
14459#line 23
14460allow fingerprintd system_server:fd use;
14461#line 23
14462;
14463allow fingerprintd permission_service:service_manager find;
14464
14465allow fingerprintd ion_device:chr_file { getattr open read ioctl lock map };
14466#line 1 "system/sepolicy/prebuilts/api/29.0/public/flags_health_check.te"
14467# The flags_health_check command run by init.
14468type flags_health_check, domain, coredomain;
14469type flags_health_check_exec, system_file_type, exec_type, file_type;
14470
14471
14472#line 5
14473
14474#line 5
14475allow flags_health_check property_socket:sock_file write;
14476#line 5
14477allow flags_health_check init:unix_stream_socket connectto;
14478#line 5
14479
14480#line 5
14481allow flags_health_check device_config_boot_count_prop:property_service set;
14482#line 5
14483
14484#line 5
14485allow flags_health_check device_config_boot_count_prop:file { getattr open read map };
14486#line 5
14487
14488#line 5
14489
14490
14491#line 6
14492
14493#line 6
14494allow flags_health_check property_socket:sock_file write;
14495#line 6
14496allow flags_health_check init:unix_stream_socket connectto;
14497#line 6
14498
14499#line 6
14500allow flags_health_check device_config_reset_performed_prop:property_service set;
14501#line 6
14502
14503#line 6
14504allow flags_health_check device_config_reset_performed_prop:file { getattr open read map };
14505#line 6
14506
14507#line 6
14508
14509
14510#line 7
14511
14512#line 7
14513allow flags_health_check property_socket:sock_file write;
14514#line 7
14515allow flags_health_check init:unix_stream_socket connectto;
14516#line 7
14517
14518#line 7
14519allow flags_health_check device_config_runtime_native_boot_prop:property_service set;
14520#line 7
14521
14522#line 7
14523allow flags_health_check device_config_runtime_native_boot_prop:file { getattr open read map };
14524#line 7
14525
14526#line 7
14527
14528
14529#line 8
14530
14531#line 8
14532allow flags_health_check property_socket:sock_file write;
14533#line 8
14534allow flags_health_check init:unix_stream_socket connectto;
14535#line 8
14536
14537#line 8
14538allow flags_health_check device_config_runtime_native_prop:property_service set;
14539#line 8
14540
14541#line 8
14542allow flags_health_check device_config_runtime_native_prop:file { getattr open read map };
14543#line 8
14544
14545#line 8
14546
14547
14548#line 9
14549
14550#line 9
14551allow flags_health_check property_socket:sock_file write;
14552#line 9
14553allow flags_health_check init:unix_stream_socket connectto;
14554#line 9
14555
14556#line 9
14557allow flags_health_check device_config_input_native_boot_prop:property_service set;
14558#line 9
14559
14560#line 9
14561allow flags_health_check device_config_input_native_boot_prop:file { getattr open read map };
14562#line 9
14563
14564#line 9
14565
14566
14567#line 10
14568
14569#line 10
14570allow flags_health_check property_socket:sock_file write;
14571#line 10
14572allow flags_health_check init:unix_stream_socket connectto;
14573#line 10
14574
14575#line 10
14576allow flags_health_check device_config_netd_native_prop:property_service set;
14577#line 10
14578
14579#line 10
14580allow flags_health_check device_config_netd_native_prop:file { getattr open read map };
14581#line 10
14582
14583#line 10
14584
14585
14586#line 11
14587
14588#line 11
14589allow flags_health_check property_socket:sock_file write;
14590#line 11
14591allow flags_health_check init:unix_stream_socket connectto;
14592#line 11
14593
14594#line 11
14595allow flags_health_check device_config_activity_manager_native_boot_prop:property_service set;
14596#line 11
14597
14598#line 11
14599allow flags_health_check device_config_activity_manager_native_boot_prop:file { getattr open read map };
14600#line 11
14601
14602#line 11
14603
14604
14605#line 12
14606
14607#line 12
14608allow flags_health_check property_socket:sock_file write;
14609#line 12
14610allow flags_health_check init:unix_stream_socket connectto;
14611#line 12
14612
14613#line 12
14614allow flags_health_check device_config_media_native_prop:property_service set;
14615#line 12
14616
14617#line 12
14618allow flags_health_check device_config_media_native_prop:file { getattr open read map };
14619#line 12
14620
14621#line 12
14622
14623
14624allow flags_health_check server_configurable_flags_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
14625allow flags_health_check server_configurable_flags_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
14626
14627# system property device_config_boot_count_prop is used for deciding when to perform server
14628# configurable flags related disaster recovery. Mistakenly set up by unrelated components can, at a
14629# wrong timing, trigger server configurable flag related disaster recovery, which will override
14630# server configured values of all flags with default values.
14631neverallow { domain -init -flags_health_check } device_config_boot_count_prop:property_service set;
14632
14633# system property device_config_reset_performed_prop is used for indicating whether server
14634# configurable flags have been reset during booting. Mistakenly modified by unrelated components can
14635# cause bad server configurable flags synced back to device.
14636neverallow { domain -init -flags_health_check } device_config_reset_performed_prop:property_service set;
14637
14638# server_configurable_flags_data_file is used for storing whether server configurable flags which
14639# have been reset during current booting. Mistakenly modified by unrelated components can
14640# cause bad server configurable flags synced back to device.
14641neverallow { domain -init -flags_health_check } server_configurable_flags_data_file:file { append create link unlink relabelfrom rename setattr write };
14642#line 1 "system/sepolicy/prebuilts/api/29.0/public/fsck.te"
14643# Any fsck program run by init
14644type fsck, domain;
14645type fsck_exec, system_file_type, exec_type, file_type;
14646
14647# /dev/__null__ created by init prior to policy load,
14648# open fd inherited by fsck.
14649allow fsck tmpfs:chr_file { read write ioctl };
14650
14651# Inherit and use pty created by android_fork_execvp_ext().
14652allow fsck devpts:chr_file { read write ioctl getattr };
14653
14654# Allow stdin/out back to vold
14655allow fsck vold:fd use;
14656allow fsck vold:fifo_file { read write getattr };
14657
14658# Run fsck on certain block devices
14659allow fsck block_device:dir search;
14660allow fsck userdata_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
14661allow fsck cache_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
14662allow fsck dm_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
14663#line 23
14664
14665
14666# For the block devices where we have ioctl access,
14667# allow at a minimum the following common fsck ioctls.
14668allowxperm fsck dev_type:blk_file ioctl {
14669  0x0000127c
14670  0x0000125e
14671};
14672
14673# To determine if it is safe to run fsck on a filesystem, e2fsck
14674# must first determine if the filesystem is mounted. To do that,
14675# e2fsck scans through /proc/mounts and collects all the mounted
14676# block devices. With that information, it runs stat() on each block
14677# device, comparing the major and minor numbers to the filesystem
14678# passed in on the command line. If there is a match, then the filesystem
14679# is currently mounted and running fsck is dangerous.
14680# Allow stat access to all block devices so that fsck can compare
14681# major/minor values.
14682allow fsck dev_type:blk_file getattr;
14683
14684allow fsck {
14685  proc_mounts
14686  proc_swaps
14687}:file { getattr open read ioctl lock map };
14688allow fsck rootfs:dir { open getattr read search ioctl lock };
14689
14690###
14691### neverallow rules
14692###
14693
14694# fsck should never be run on these block devices
14695neverallow fsck {
14696  boot_block_device
14697  frp_block_device
14698  recovery_block_device
14699  root_block_device
14700  swap_block_device
14701  system_block_device
14702
14703  vold_device
14704}:blk_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
14705
14706# Only allow entry from init or vold via fsck binaries
14707neverallow { domain -init -vold } fsck:process transition;
14708neverallow * fsck:process dyntransition;
14709neverallow fsck { file_type fs_type -fsck_exec }:file entrypoint;
14710#line 1 "system/sepolicy/prebuilts/api/29.0/public/fsck_untrusted.te"
14711# Any fsck program run on untrusted block devices
14712type fsck_untrusted, domain;
14713
14714# Inherit and use pty created by android_fork_execvp_ext().
14715allow fsck_untrusted devpts:chr_file { read write ioctl getattr };
14716
14717# Allow stdin/out back to vold
14718allow fsck_untrusted vold:fd use;
14719allow fsck_untrusted vold:fifo_file { read write getattr };
14720
14721# Run fsck on vold block devices
14722allow fsck_untrusted block_device:dir search;
14723allow fsck_untrusted vold_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
14724
14725allow fsck_untrusted proc_mounts:file { getattr open read ioctl lock map };
14726
14727# To determine if it is safe to run fsck on a filesystem, e2fsck
14728# must first determine if the filesystem is mounted. To do that,
14729# e2fsck scans through /proc/mounts and collects all the mounted
14730# block devices. With that information, it runs stat() on each block
14731# device, comparing the major and minor numbers to the filesystem
14732# passed in on the command line. If there is a match, then the filesystem
14733# is currently mounted and running fsck is dangerous.
14734# Allow stat access to all block devices so that fsck can compare
14735# major/minor values.
14736allow fsck_untrusted dev_type:blk_file getattr;
14737
14738###
14739### neverallow rules
14740###
14741
14742# Untrusted fsck should never be run on block devices holding sensitive data
14743neverallow fsck_untrusted {
14744  boot_block_device
14745  frp_block_device
14746  metadata_block_device
14747  recovery_block_device
14748  root_block_device
14749  swap_block_device
14750  system_block_device
14751  userdata_block_device
14752  cache_block_device
14753  dm_device
14754}:blk_file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
14755
14756# Only allow entry from vold via fsck binaries
14757neverallow { domain -vold } fsck_untrusted:process transition;
14758neverallow * fsck_untrusted:process dyntransition;
14759neverallow fsck_untrusted { file_type fs_type -fsck_exec }:file entrypoint;
14760#line 1 "system/sepolicy/prebuilts/api/29.0/public/fwk_bufferhub.te"
14761
14762#line 1
14763# Call the server domain and optionally transfer references to it.
14764#line 1
14765allow hal_bufferhub_client hal_bufferhub_server:binder { call transfer };
14766#line 1
14767# Allow the serverdomain to transfer references to the client on the reply.
14768#line 1
14769allow hal_bufferhub_server hal_bufferhub_client:binder transfer;
14770#line 1
14771# Receive and use open files from the server.
14772#line 1
14773allow hal_bufferhub_client hal_bufferhub_server:fd use;
14774#line 1
14775
14776
14777#line 2
14778# Call the server domain and optionally transfer references to it.
14779#line 2
14780allow hal_bufferhub_server hal_bufferhub_client:binder { call transfer };
14781#line 2
14782# Allow the serverdomain to transfer references to the client on the reply.
14783#line 2
14784allow hal_bufferhub_client hal_bufferhub_server:binder transfer;
14785#line 2
14786# Receive and use open files from the server.
14787#line 2
14788allow hal_bufferhub_server hal_bufferhub_client:fd use;
14789#line 2
14790
14791
14792
14793#line 4
14794  allow hal_bufferhub_client fwk_bufferhub_hwservice:hwservice_manager find;
14795#line 4
14796
14797#line 4
14798  allow hal_bufferhub_server fwk_bufferhub_hwservice:hwservice_manager { add find };
14799#line 4
14800  allow hal_bufferhub_server hidl_base_hwservice:hwservice_manager add;
14801#line 4
14802  neverallow { domain -hal_bufferhub_server } fwk_bufferhub_hwservice:hwservice_manager add;
14803#line 4
14804
14805#line 4
14806
14807#line 4
14808
14809#line 4
14810    neverallow { domain -hal_bufferhub_client -hal_bufferhub_server } fwk_bufferhub_hwservice:hwservice_manager find;
14811#line 4
14812
14813#line 4
14814
14815#line 1 "system/sepolicy/prebuilts/api/29.0/public/gatekeeperd.te"
14816type gatekeeperd, domain;
14817type gatekeeperd_exec, system_file_type, exec_type, file_type;
14818
14819# gatekeeperd
14820
14821#line 5
14822typeattribute gatekeeperd binderservicedomain;
14823#line 5
14824
14825
14826#line 6
14827# Call the servicemanager and transfer references to it.
14828#line 6
14829allow gatekeeperd servicemanager:binder { call transfer };
14830#line 6
14831# servicemanager performs getpidcon on clients.
14832#line 6
14833allow servicemanager gatekeeperd:dir search;
14834#line 6
14835allow servicemanager gatekeeperd:file { read open };
14836#line 6
14837allow servicemanager gatekeeperd:process getattr;
14838#line 6
14839# rw access to /dev/binder and /dev/ashmem is presently granted to
14840#line 6
14841# all domains in domain.te.
14842#line 6
14843
14844
14845### Rules needed when Gatekeeper HAL runs inside gatekeeperd process.
14846### These rules should eventually be granted only when needed.
14847allow gatekeeperd ion_device:chr_file { getattr open read ioctl lock map };
14848# Load HAL implementation
14849allow gatekeeperd system_file:dir { open getattr read search ioctl lock };
14850###
14851
14852### Rules needed when Gatekeeper HAL runs outside of gatekeeperd process.
14853### These rules should eventually be granted only when needed.
14854
14855#line 17
14856typeattribute gatekeeperd halclientdomain;
14857#line 17
14858typeattribute gatekeeperd hal_gatekeeper_client;
14859#line 17
14860
14861#line 17
14862# TODO(b/34170079): Make the inclusion of the rules below conditional also on
14863#line 17
14864# non-Treble devices. For now, on non-Treble device, always grant clients of a
14865#line 17
14866# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
14867#line 17
14868
14869#line 17
14870
14871###
14872
14873# need to find KeyStore and add self
14874
14875#line 21
14876  allow gatekeeperd gatekeeper_service:service_manager { add find };
14877#line 21
14878  neverallow { domain -gatekeeperd } gatekeeper_service:service_manager add;
14879#line 21
14880
14881
14882# Need to add auth tokens to KeyStore
14883
14884#line 24
14885  allow keystore gatekeeperd:dir search;
14886#line 24
14887  allow keystore gatekeeperd:file { read open };
14888#line 24
14889  allow keystore gatekeeperd:process getattr;
14890#line 24
14891  allow gatekeeperd keystore_service:service_manager find;
14892#line 24
14893
14894#line 24
14895# Call the server domain and optionally transfer references to it.
14896#line 24
14897allow gatekeeperd keystore:binder { call transfer };
14898#line 24
14899# Allow the serverdomain to transfer references to the client on the reply.
14900#line 24
14901allow keystore gatekeeperd:binder transfer;
14902#line 24
14903# Receive and use open files from the server.
14904#line 24
14905allow gatekeeperd keystore:fd use;
14906#line 24
14907
14908#line 24
14909
14910#line 24
14911# Call the server domain and optionally transfer references to it.
14912#line 24
14913allow keystore gatekeeperd:binder { call transfer };
14914#line 24
14915# Allow the serverdomain to transfer references to the client on the reply.
14916#line 24
14917allow gatekeeperd keystore:binder transfer;
14918#line 24
14919# Receive and use open files from the server.
14920#line 24
14921allow keystore gatekeeperd:fd use;
14922#line 24
14923
14924#line 24
14925
14926allow gatekeeperd keystore:keystore_key { add_auth };
14927
14928# For permissions checking
14929allow gatekeeperd system_server:binder call;
14930allow gatekeeperd permission_service:service_manager find;
14931
14932# for SID file access
14933allow gatekeeperd gatekeeper_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
14934allow gatekeeperd gatekeeper_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
14935
14936# For hardware properties retrieval
14937allow gatekeeperd hardware_properties_service:service_manager find;
14938
14939# For checking whether GSI is running
14940
14941#line 39
14942allow gatekeeperd gsid_prop:file { getattr open read map };
14943#line 39
14944
14945
14946
14947#line 41
14948allow gatekeeperd cgroup:dir { open getattr read search ioctl lock };
14949#line 41
14950allow gatekeeperd cgroup:{ file lnk_file } { getattr open read ioctl lock map };
14951#line 41
14952
14953#line 1 "system/sepolicy/prebuilts/api/29.0/public/gpuservice.te"
14954# gpuservice - server for gpu stats and other gpu related services
14955type gpuservice, domain;
14956#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_allocator.te"
14957# HwBinder IPC from client to server
14958
14959#line 2
14960# Call the server domain and optionally transfer references to it.
14961#line 2
14962allow hal_allocator_client hal_allocator_server:binder { call transfer };
14963#line 2
14964# Allow the serverdomain to transfer references to the client on the reply.
14965#line 2
14966allow hal_allocator_server hal_allocator_client:binder transfer;
14967#line 2
14968# Receive and use open files from the server.
14969#line 2
14970allow hal_allocator_client hal_allocator_server:fd use;
14971#line 2
14972
14973
14974
14975#line 4
14976  allow hal_allocator_client hidl_allocator_hwservice:hwservice_manager find;
14977#line 4
14978
14979#line 4
14980  allow hal_allocator_server hidl_allocator_hwservice:hwservice_manager { add find };
14981#line 4
14982  allow hal_allocator_server hidl_base_hwservice:hwservice_manager add;
14983#line 4
14984  neverallow { domain -hal_allocator_server } hidl_allocator_hwservice:hwservice_manager add;
14985#line 4
14986
14987#line 4
14988
14989#line 4
14990
14991#line 4
14992    neverallow { domain -hal_allocator_client -hal_allocator_server } hidl_allocator_hwservice:hwservice_manager find;
14993#line 4
14994
14995#line 4
14996
14997allow hal_allocator_client hidl_memory_hwservice:hwservice_manager find;
14998allow hal_allocator_client same_process_hal_file:file { execute read open getattr map };
14999#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_atrace.te"
15000# HwBinder IPC from client to server
15001
15002#line 2
15003# Call the server domain and optionally transfer references to it.
15004#line 2
15005allow hal_atrace_client hal_atrace_server:binder { call transfer };
15006#line 2
15007# Allow the serverdomain to transfer references to the client on the reply.
15008#line 2
15009allow hal_atrace_server hal_atrace_client:binder transfer;
15010#line 2
15011# Receive and use open files from the server.
15012#line 2
15013allow hal_atrace_client hal_atrace_server:fd use;
15014#line 2
15015
15016
15017
15018#line 4
15019  allow hal_atrace_client hal_atrace_hwservice:hwservice_manager find;
15020#line 4
15021
15022#line 4
15023  allow hal_atrace_server hal_atrace_hwservice:hwservice_manager { add find };
15024#line 4
15025  allow hal_atrace_server hidl_base_hwservice:hwservice_manager add;
15026#line 4
15027  neverallow { domain -hal_atrace_server } hal_atrace_hwservice:hwservice_manager add;
15028#line 4
15029
15030#line 4
15031
15032#line 4
15033
15034#line 4
15035    neverallow { domain -hal_atrace_client -hal_atrace_server } hal_atrace_hwservice:hwservice_manager find;
15036#line 4
15037
15038#line 4
15039
15040#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_audio.te"
15041# HwBinder IPC from client to server, and callbacks
15042
15043#line 2
15044# Call the server domain and optionally transfer references to it.
15045#line 2
15046allow hal_audio_client hal_audio_server:binder { call transfer };
15047#line 2
15048# Allow the serverdomain to transfer references to the client on the reply.
15049#line 2
15050allow hal_audio_server hal_audio_client:binder transfer;
15051#line 2
15052# Receive and use open files from the server.
15053#line 2
15054allow hal_audio_client hal_audio_server:fd use;
15055#line 2
15056
15057
15058#line 3
15059# Call the server domain and optionally transfer references to it.
15060#line 3
15061allow hal_audio_server hal_audio_client:binder { call transfer };
15062#line 3
15063# Allow the serverdomain to transfer references to the client on the reply.
15064#line 3
15065allow hal_audio_client hal_audio_server:binder transfer;
15066#line 3
15067# Receive and use open files from the server.
15068#line 3
15069allow hal_audio_server hal_audio_client:fd use;
15070#line 3
15071
15072
15073
15074#line 5
15075  allow hal_audio_client hal_audio_hwservice:hwservice_manager find;
15076#line 5
15077
15078#line 5
15079  allow hal_audio_server hal_audio_hwservice:hwservice_manager { add find };
15080#line 5
15081  allow hal_audio_server hidl_base_hwservice:hwservice_manager add;
15082#line 5
15083  neverallow { domain -hal_audio_server } hal_audio_hwservice:hwservice_manager add;
15084#line 5
15085
15086#line 5
15087
15088#line 5
15089
15090#line 5
15091    neverallow { domain -hal_audio_client -hal_audio_server } hal_audio_hwservice:hwservice_manager find;
15092#line 5
15093
15094#line 5
15095
15096
15097allow hal_audio ion_device:chr_file { getattr open read ioctl lock map };
15098
15099
15100#line 9
15101allow hal_audio proc:dir { open getattr read search ioctl lock };
15102#line 9
15103allow hal_audio proc:{ file lnk_file } { getattr open read ioctl lock map };
15104#line 9
15105
15106
15107#line 10
15108allow hal_audio proc_asound:dir { open getattr read search ioctl lock };
15109#line 10
15110allow hal_audio proc_asound:{ file lnk_file } { getattr open read ioctl lock map };
15111#line 10
15112
15113allow hal_audio_server audio_device:dir { open getattr read search ioctl lock };
15114allow hal_audio_server audio_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15115
15116# Needed to provide debug dump output via dumpsys' pipes.
15117allow hal_audio shell:fd use;
15118allow hal_audio shell:fifo_file write;
15119allow hal_audio dumpstate:fd use;
15120allow hal_audio dumpstate:fifo_file write;
15121
15122# allow hal audio to use vnbinder
15123
15124#line 21
15125# Talk to the vndbinder device node
15126#line 21
15127allow hal_audio vndbinder_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15128#line 21
15129# Call the vndservicemanager and transfer references to it.
15130#line 21
15131allow hal_audio vndservicemanager:binder { call transfer };
15132#line 21
15133# vndservicemanager performs getpidcon on clients.
15134#line 21
15135allow vndservicemanager hal_audio:dir search;
15136#line 21
15137allow vndservicemanager hal_audio:file { read open map };
15138#line 21
15139allow vndservicemanager hal_audio:process getattr;
15140#line 21
15141
15142
15143###
15144### neverallow rules
15145###
15146
15147# Should never execute any executable without a domain transition
15148neverallow hal_audio_server { file_type fs_type }:file execute_no_trans;
15149
15150# Should never need network access.
15151# Disallow network sockets.
15152neverallow hal_audio_server domain:{ tcp_socket udp_socket rawip_socket } *;
15153
15154# Only audio HAL may directly access the audio hardware
15155neverallow { halserverdomain -hal_audio_server -hal_omx_server } audio_device:chr_file *;
15156
15157
15158#line 37
15159allow hal_audio bluetooth_a2dp_offload_prop:file { getattr open read map };
15160#line 37
15161
15162
15163#line 38
15164allow hal_audio bluetooth_audio_hal_prop:file { getattr open read map };
15165#line 38
15166
15167#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_audiocontrol.te"
15168# HwBinder IPC from client to server, and callbacks
15169
15170#line 2
15171# Call the server domain and optionally transfer references to it.
15172#line 2
15173allow hal_audiocontrol_client hal_audiocontrol_server:binder { call transfer };
15174#line 2
15175# Allow the serverdomain to transfer references to the client on the reply.
15176#line 2
15177allow hal_audiocontrol_server hal_audiocontrol_client:binder transfer;
15178#line 2
15179# Receive and use open files from the server.
15180#line 2
15181allow hal_audiocontrol_client hal_audiocontrol_server:fd use;
15182#line 2
15183
15184
15185#line 3
15186# Call the server domain and optionally transfer references to it.
15187#line 3
15188allow hal_audiocontrol_server hal_audiocontrol_client:binder { call transfer };
15189#line 3
15190# Allow the serverdomain to transfer references to the client on the reply.
15191#line 3
15192allow hal_audiocontrol_client hal_audiocontrol_server:binder transfer;
15193#line 3
15194# Receive and use open files from the server.
15195#line 3
15196allow hal_audiocontrol_server hal_audiocontrol_client:fd use;
15197#line 3
15198
15199
15200
15201#line 5
15202  allow hal_audiocontrol_client hal_audiocontrol_hwservice:hwservice_manager find;
15203#line 5
15204
15205#line 5
15206  allow hal_audiocontrol_server hal_audiocontrol_hwservice:hwservice_manager { add find };
15207#line 5
15208  allow hal_audiocontrol_server hidl_base_hwservice:hwservice_manager add;
15209#line 5
15210  neverallow { domain -hal_audiocontrol_server } hal_audiocontrol_hwservice:hwservice_manager add;
15211#line 5
15212
15213#line 5
15214
15215#line 5
15216
15217#line 5
15218    neverallow { domain -hal_audiocontrol_client -hal_audiocontrol_server } hal_audiocontrol_hwservice:hwservice_manager find;
15219#line 5
15220
15221#line 5
15222
15223#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_authsecret.te"
15224# HwBinder IPC from client to server
15225
15226#line 2
15227# Call the server domain and optionally transfer references to it.
15228#line 2
15229allow hal_authsecret_client hal_authsecret_server:binder { call transfer };
15230#line 2
15231# Allow the serverdomain to transfer references to the client on the reply.
15232#line 2
15233allow hal_authsecret_server hal_authsecret_client:binder transfer;
15234#line 2
15235# Receive and use open files from the server.
15236#line 2
15237allow hal_authsecret_client hal_authsecret_server:fd use;
15238#line 2
15239
15240
15241
15242#line 4
15243  allow hal_authsecret_client hal_authsecret_hwservice:hwservice_manager find;
15244#line 4
15245
15246#line 4
15247  allow hal_authsecret_server hal_authsecret_hwservice:hwservice_manager { add find };
15248#line 4
15249  allow hal_authsecret_server hidl_base_hwservice:hwservice_manager add;
15250#line 4
15251  neverallow { domain -hal_authsecret_server } hal_authsecret_hwservice:hwservice_manager add;
15252#line 4
15253
15254#line 4
15255
15256#line 4
15257
15258#line 4
15259    neverallow { domain -hal_authsecret_client -hal_authsecret_server } hal_authsecret_hwservice:hwservice_manager find;
15260#line 4
15261
15262#line 4
15263
15264#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_bluetooth.te"
15265# HwBinder IPC from clients into server, and callbacks
15266
15267#line 2
15268# Call the server domain and optionally transfer references to it.
15269#line 2
15270allow hal_bluetooth_client hal_bluetooth_server:binder { call transfer };
15271#line 2
15272# Allow the serverdomain to transfer references to the client on the reply.
15273#line 2
15274allow hal_bluetooth_server hal_bluetooth_client:binder transfer;
15275#line 2
15276# Receive and use open files from the server.
15277#line 2
15278allow hal_bluetooth_client hal_bluetooth_server:fd use;
15279#line 2
15280
15281
15282#line 3
15283# Call the server domain and optionally transfer references to it.
15284#line 3
15285allow hal_bluetooth_server hal_bluetooth_client:binder { call transfer };
15286#line 3
15287# Allow the serverdomain to transfer references to the client on the reply.
15288#line 3
15289allow hal_bluetooth_client hal_bluetooth_server:binder transfer;
15290#line 3
15291# Receive and use open files from the server.
15292#line 3
15293allow hal_bluetooth_server hal_bluetooth_client:fd use;
15294#line 3
15295
15296
15297
15298#line 5
15299  allow hal_bluetooth_client hal_bluetooth_hwservice:hwservice_manager find;
15300#line 5
15301
15302#line 5
15303  allow hal_bluetooth_server hal_bluetooth_hwservice:hwservice_manager { add find };
15304#line 5
15305  allow hal_bluetooth_server hidl_base_hwservice:hwservice_manager add;
15306#line 5
15307  neverallow { domain -hal_bluetooth_server } hal_bluetooth_hwservice:hwservice_manager add;
15308#line 5
15309
15310#line 5
15311
15312#line 5
15313
15314#line 5
15315    neverallow { domain -hal_bluetooth_client -hal_bluetooth_server } hal_bluetooth_hwservice:hwservice_manager find;
15316#line 5
15317
15318#line 5
15319
15320
15321
15322#line 7
15323# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
15324#line 7
15325# deprecated.
15326#line 7
15327# Access /sys/power/wake_lock and /sys/power/wake_unlock
15328#line 7
15329allow hal_bluetooth sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
15330#line 7
15331# Accessing these files requires CAP_BLOCK_SUSPEND
15332#line 7
15333allow hal_bluetooth self:{ capability2 cap2_userns } block_suspend;
15334#line 7
15335# system_suspend permissions
15336#line 7
15337
15338#line 7
15339# Call the server domain and optionally transfer references to it.
15340#line 7
15341allow hal_bluetooth system_suspend_server:binder { call transfer };
15342#line 7
15343# Allow the serverdomain to transfer references to the client on the reply.
15344#line 7
15345allow system_suspend_server hal_bluetooth:binder transfer;
15346#line 7
15347# Receive and use open files from the server.
15348#line 7
15349allow hal_bluetooth system_suspend_server:fd use;
15350#line 7
15351
15352#line 7
15353allow hal_bluetooth system_suspend_hwservice:hwservice_manager find;
15354#line 7
15355# halclientdomain permissions
15356#line 7
15357
15358#line 7
15359# Call the hwservicemanager and transfer references to it.
15360#line 7
15361allow hal_bluetooth hwservicemanager:binder { call transfer };
15362#line 7
15363# Allow hwservicemanager to send out callbacks
15364#line 7
15365allow hwservicemanager hal_bluetooth:binder { call transfer };
15366#line 7
15367# hwservicemanager performs getpidcon on clients.
15368#line 7
15369allow hwservicemanager hal_bluetooth:dir search;
15370#line 7
15371allow hwservicemanager hal_bluetooth:file { read open map };
15372#line 7
15373allow hwservicemanager hal_bluetooth:process getattr;
15374#line 7
15375# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
15376#line 7
15377# all domains in domain.te.
15378#line 7
15379
15380#line 7
15381
15382#line 7
15383allow hal_bluetooth hwservicemanager_prop:file { getattr open read map };
15384#line 7
15385
15386#line 7
15387allow hal_bluetooth hidl_manager_hwservice:hwservice_manager find;
15388#line 7
15389;
15390
15391# The HAL toggles rfkill to power the chip off/on.
15392allow hal_bluetooth self:{ capability cap_userns } net_admin;
15393
15394# bluetooth factory file accesses.
15395
15396#line 13
15397allow hal_bluetooth bluetooth_efs_file:dir { open getattr read search ioctl lock };
15398#line 13
15399allow hal_bluetooth bluetooth_efs_file:{ file lnk_file } { getattr open read ioctl lock map };
15400#line 13
15401
15402
15403allow hal_bluetooth { uhid_device hci_attach_dev }:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15404
15405# sysfs access.
15406
15407#line 18
15408allow hal_bluetooth sysfs_type:dir { open getattr read search ioctl lock };
15409#line 18
15410allow hal_bluetooth sysfs_type:{ file lnk_file } { getattr open read ioctl lock map };
15411#line 18
15412
15413allow hal_bluetooth sysfs_bluetooth_writable:file { { getattr open read ioctl lock map } { open append write lock map } };
15414allow hal_bluetooth self:{ capability2 cap2_userns } wake_alarm;
15415
15416# Allow write access to bluetooth-specific properties
15417
15418#line 23
15419
15420#line 23
15421allow hal_bluetooth property_socket:sock_file write;
15422#line 23
15423allow hal_bluetooth init:unix_stream_socket connectto;
15424#line 23
15425
15426#line 23
15427allow hal_bluetooth bluetooth_a2dp_offload_prop:property_service set;
15428#line 23
15429
15430#line 23
15431allow hal_bluetooth bluetooth_a2dp_offload_prop:file { getattr open read map };
15432#line 23
15433
15434#line 23
15435
15436
15437#line 24
15438
15439#line 24
15440allow hal_bluetooth property_socket:sock_file write;
15441#line 24
15442allow hal_bluetooth init:unix_stream_socket connectto;
15443#line 24
15444
15445#line 24
15446allow hal_bluetooth bluetooth_audio_hal_prop:property_service set;
15447#line 24
15448
15449#line 24
15450allow hal_bluetooth bluetooth_audio_hal_prop:file { getattr open read map };
15451#line 24
15452
15453#line 24
15454
15455
15456#line 25
15457
15458#line 25
15459allow hal_bluetooth property_socket:sock_file write;
15460#line 25
15461allow hal_bluetooth init:unix_stream_socket connectto;
15462#line 25
15463
15464#line 25
15465allow hal_bluetooth bluetooth_prop:property_service set;
15466#line 25
15467
15468#line 25
15469allow hal_bluetooth bluetooth_prop:file { getattr open read map };
15470#line 25
15471
15472#line 25
15473
15474
15475#line 26
15476
15477#line 26
15478allow hal_bluetooth property_socket:sock_file write;
15479#line 26
15480allow hal_bluetooth init:unix_stream_socket connectto;
15481#line 26
15482
15483#line 26
15484allow hal_bluetooth exported_bluetooth_prop:property_service set;
15485#line 26
15486
15487#line 26
15488allow hal_bluetooth exported_bluetooth_prop:file { getattr open read map };
15489#line 26
15490
15491#line 26
15492
15493
15494# /proc access (bluesleep etc.).
15495allow hal_bluetooth proc_bluetooth_writable:file { { getattr open read ioctl lock map } { open append write lock map } };
15496
15497# allow to run with real-time scheduling policy
15498allow hal_bluetooth self:{ capability cap_userns } sys_nice;
15499#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_bootctl.te"
15500# HwBinder IPC from client to server, and callbacks
15501
15502#line 2
15503# Call the server domain and optionally transfer references to it.
15504#line 2
15505allow hal_bootctl_client hal_bootctl_server:binder { call transfer };
15506#line 2
15507# Allow the serverdomain to transfer references to the client on the reply.
15508#line 2
15509allow hal_bootctl_server hal_bootctl_client:binder transfer;
15510#line 2
15511# Receive and use open files from the server.
15512#line 2
15513allow hal_bootctl_client hal_bootctl_server:fd use;
15514#line 2
15515
15516
15517#line 3
15518# Call the server domain and optionally transfer references to it.
15519#line 3
15520allow hal_bootctl_server hal_bootctl_client:binder { call transfer };
15521#line 3
15522# Allow the serverdomain to transfer references to the client on the reply.
15523#line 3
15524allow hal_bootctl_client hal_bootctl_server:binder transfer;
15525#line 3
15526# Receive and use open files from the server.
15527#line 3
15528allow hal_bootctl_server hal_bootctl_client:fd use;
15529#line 3
15530
15531
15532
15533#line 5
15534  allow hal_bootctl_client hal_bootctl_hwservice:hwservice_manager find;
15535#line 5
15536
15537#line 5
15538  allow hal_bootctl_server hal_bootctl_hwservice:hwservice_manager { add find };
15539#line 5
15540  allow hal_bootctl_server hidl_base_hwservice:hwservice_manager add;
15541#line 5
15542  neverallow { domain -hal_bootctl_server } hal_bootctl_hwservice:hwservice_manager add;
15543#line 5
15544
15545#line 5
15546
15547#line 5
15548
15549#line 5
15550    neverallow { domain -hal_bootctl_client -hal_bootctl_server } hal_bootctl_hwservice:hwservice_manager find;
15551#line 5
15552
15553#line 5
15554
15555#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_broadcastradio.te"
15556
15557#line 1
15558# Call the server domain and optionally transfer references to it.
15559#line 1
15560allow hal_broadcastradio_client hal_broadcastradio_server:binder { call transfer };
15561#line 1
15562# Allow the serverdomain to transfer references to the client on the reply.
15563#line 1
15564allow hal_broadcastradio_server hal_broadcastradio_client:binder transfer;
15565#line 1
15566# Receive and use open files from the server.
15567#line 1
15568allow hal_broadcastradio_client hal_broadcastradio_server:fd use;
15569#line 1
15570
15571
15572#line 2
15573# Call the server domain and optionally transfer references to it.
15574#line 2
15575allow hal_broadcastradio_server hal_broadcastradio_client:binder { call transfer };
15576#line 2
15577# Allow the serverdomain to transfer references to the client on the reply.
15578#line 2
15579allow hal_broadcastradio_client hal_broadcastradio_server:binder transfer;
15580#line 2
15581# Receive and use open files from the server.
15582#line 2
15583allow hal_broadcastradio_server hal_broadcastradio_client:fd use;
15584#line 2
15585
15586
15587
15588#line 4
15589  allow hal_broadcastradio_client hal_broadcastradio_hwservice:hwservice_manager find;
15590#line 4
15591
15592#line 4
15593  allow hal_broadcastradio_server hal_broadcastradio_hwservice:hwservice_manager { add find };
15594#line 4
15595  allow hal_broadcastradio_server hidl_base_hwservice:hwservice_manager add;
15596#line 4
15597  neverallow { domain -hal_broadcastradio_server } hal_broadcastradio_hwservice:hwservice_manager add;
15598#line 4
15599
15600#line 4
15601
15602#line 4
15603
15604#line 4
15605    neverallow { domain -hal_broadcastradio_client -hal_broadcastradio_server } hal_broadcastradio_hwservice:hwservice_manager find;
15606#line 4
15607
15608#line 4
15609
15610#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_camera.te"
15611# HwBinder IPC from clients to server and callbacks
15612
15613#line 2
15614# Call the server domain and optionally transfer references to it.
15615#line 2
15616allow hal_camera_client hal_camera_server:binder { call transfer };
15617#line 2
15618# Allow the serverdomain to transfer references to the client on the reply.
15619#line 2
15620allow hal_camera_server hal_camera_client:binder transfer;
15621#line 2
15622# Receive and use open files from the server.
15623#line 2
15624allow hal_camera_client hal_camera_server:fd use;
15625#line 2
15626
15627
15628#line 3
15629# Call the server domain and optionally transfer references to it.
15630#line 3
15631allow hal_camera_server hal_camera_client:binder { call transfer };
15632#line 3
15633# Allow the serverdomain to transfer references to the client on the reply.
15634#line 3
15635allow hal_camera_client hal_camera_server:binder transfer;
15636#line 3
15637# Receive and use open files from the server.
15638#line 3
15639allow hal_camera_server hal_camera_client:fd use;
15640#line 3
15641
15642
15643
15644#line 5
15645  allow hal_camera_client hal_camera_hwservice:hwservice_manager find;
15646#line 5
15647
15648#line 5
15649  allow hal_camera_server hal_camera_hwservice:hwservice_manager { add find };
15650#line 5
15651  allow hal_camera_server hidl_base_hwservice:hwservice_manager add;
15652#line 5
15653  neverallow { domain -hal_camera_server } hal_camera_hwservice:hwservice_manager add;
15654#line 5
15655
15656#line 5
15657
15658#line 5
15659
15660#line 5
15661    neverallow { domain -hal_camera_client -hal_camera_server } hal_camera_hwservice:hwservice_manager find;
15662#line 5
15663
15664#line 5
15665
15666
15667allow hal_camera device:dir { open getattr read search ioctl lock };
15668allow hal_camera video_device:dir { open getattr read search ioctl lock };
15669allow hal_camera video_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15670allow hal_camera camera_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15671allow hal_camera ion_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15672# Both the client and the server need to use the graphics allocator
15673allow { hal_camera_client hal_camera_server } hal_graphics_allocator:fd use;
15674
15675# Allow hal_camera to use fd from app,gralloc,and ashmem HAL
15676allow hal_camera { appdomain -isolated_app }:fd use;
15677allow hal_camera surfaceflinger:fd use;
15678allow hal_camera hal_allocator_server:fd use;
15679
15680# Needed to provide debug dump output via dumpsys' pipes.
15681allow hal_camera shell:fd use;
15682allow hal_camera shell:fifo_file write;
15683
15684###
15685### neverallow rules
15686###
15687
15688# hal_camera should never execute any executable without a
15689# domain transition
15690neverallow hal_camera_server { file_type fs_type }:file execute_no_trans;
15691
15692# hal_camera should never need network access. Disallow network sockets.
15693neverallow hal_camera_server domain:{ tcp_socket udp_socket rawip_socket } *;
15694
15695# Only camera HAL may directly access the camera hardware
15696neverallow { halserverdomain -hal_camera_server } camera_device:chr_file *;
15697#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_cas.te"
15698# HwBinder IPC from client to server, and callbacks
15699
15700#line 2
15701# Call the server domain and optionally transfer references to it.
15702#line 2
15703allow hal_cas_client hal_cas_server:binder { call transfer };
15704#line 2
15705# Allow the serverdomain to transfer references to the client on the reply.
15706#line 2
15707allow hal_cas_server hal_cas_client:binder transfer;
15708#line 2
15709# Receive and use open files from the server.
15710#line 2
15711allow hal_cas_client hal_cas_server:fd use;
15712#line 2
15713
15714
15715#line 3
15716# Call the server domain and optionally transfer references to it.
15717#line 3
15718allow hal_cas_server hal_cas_client:binder { call transfer };
15719#line 3
15720# Allow the serverdomain to transfer references to the client on the reply.
15721#line 3
15722allow hal_cas_client hal_cas_server:binder transfer;
15723#line 3
15724# Receive and use open files from the server.
15725#line 3
15726allow hal_cas_server hal_cas_client:fd use;
15727#line 3
15728
15729
15730
15731#line 5
15732  allow hal_cas_client hal_cas_hwservice:hwservice_manager find;
15733#line 5
15734
15735#line 5
15736  allow hal_cas_server hal_cas_hwservice:hwservice_manager { add find };
15737#line 5
15738  allow hal_cas_server hidl_base_hwservice:hwservice_manager add;
15739#line 5
15740  neverallow { domain -hal_cas_server } hal_cas_hwservice:hwservice_manager add;
15741#line 5
15742
15743#line 5
15744
15745#line 5
15746
15747#line 5
15748    neverallow { domain -hal_cas_client -hal_cas_server } hal_cas_hwservice:hwservice_manager find;
15749#line 5
15750
15751#line 5
15752
15753allow hal_cas_server hidl_memory_hwservice:hwservice_manager find;
15754
15755# Permit reading device's serial number from system properties
15756
15757#line 9
15758allow hal_cas_server serialno_prop:file { getattr open read map };
15759#line 9
15760
15761
15762# Read files already opened under /data
15763allow hal_cas system_data_file:file { getattr read };
15764
15765# Read access to pseudo filesystems
15766
15767#line 15
15768allow hal_cas cgroup:dir { open getattr read search ioctl lock };
15769#line 15
15770allow hal_cas cgroup:{ file lnk_file } { getattr open read ioctl lock map };
15771#line 15
15772
15773allow hal_cas cgroup:dir { search write };
15774allow hal_cas cgroup:file { open append write lock map };
15775
15776# Allow access to ion memory allocation device
15777allow hal_cas ion_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15778allow hal_cas hal_graphics_allocator:fd use;
15779
15780allow hal_cas tee_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
15781
15782###
15783### neverallow rules
15784###
15785
15786# hal_cas should never execute any executable without a
15787# domain transition
15788neverallow hal_cas_server { file_type fs_type }:file execute_no_trans;
15789
15790# do not allow privileged socket ioctl commands
15791neverallowxperm hal_cas_server domain:{ rawip_socket tcp_socket udp_socket } ioctl
15792#line 34
15793{
15794#line 34
15795# qualcomm rmnet ioctls
15796#line 34
157970x00006900 0x00006902
15798#line 34
15799# socket ioctls
15800#line 34
158010x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
15802#line 34
158030x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
15804#line 34
158050x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
15806#line 34
158070x00008927 0x00008929 0x00008930 0x00008931 0x00008932
15808#line 34
158090x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
15810#line 34
158110x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
15812#line 34
158130x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
15814#line 34
158150x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
15816#line 34
158170x00008991 0x00008992 0x00008993 0x00008994
15818#line 34
158190x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
15820#line 34
15821# device and protocol specific ioctls
15822#line 34
158230x000089f0-0x000089ff
15824#line 34
158250x000089e0-0x000089ef
15826#line 34
15827# Wireless extension ioctls
15828#line 34
158290x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
15830#line 34
158310x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
15832#line 34
158330x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
15834#line 34
158350x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
15836#line 34
158370x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
15838#line 34
158390x00008b34 0x00008b35 0x00008b36
15840#line 34
15841# Dev private ioctl i.e. hardware specific ioctls
15842#line 34
158430x00008be0-0x00008bff
15844#line 34
15845};
15846#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_codec2.te"
15847
15848#line 1
15849# Call the server domain and optionally transfer references to it.
15850#line 1
15851allow hal_codec2_client hal_codec2_server:binder { call transfer };
15852#line 1
15853# Allow the serverdomain to transfer references to the client on the reply.
15854#line 1
15855allow hal_codec2_server hal_codec2_client:binder transfer;
15856#line 1
15857# Receive and use open files from the server.
15858#line 1
15859allow hal_codec2_client hal_codec2_server:fd use;
15860#line 1
15861
15862
15863#line 2
15864# Call the server domain and optionally transfer references to it.
15865#line 2
15866allow hal_codec2_server hal_codec2_client:binder { call transfer };
15867#line 2
15868# Allow the serverdomain to transfer references to the client on the reply.
15869#line 2
15870allow hal_codec2_client hal_codec2_server:binder transfer;
15871#line 2
15872# Receive and use open files from the server.
15873#line 2
15874allow hal_codec2_server hal_codec2_client:fd use;
15875#line 2
15876
15877
15878
15879#line 4
15880  allow hal_codec2_client hal_codec2_hwservice:hwservice_manager find;
15881#line 4
15882
15883#line 4
15884  allow hal_codec2_server hal_codec2_hwservice:hwservice_manager { add find };
15885#line 4
15886  allow hal_codec2_server hidl_base_hwservice:hwservice_manager add;
15887#line 4
15888  neverallow { domain -hal_codec2_server } hal_codec2_hwservice:hwservice_manager add;
15889#line 4
15890
15891#line 4
15892
15893#line 4
15894
15895#line 4
15896    neverallow { domain -hal_codec2_client -hal_codec2_server } hal_codec2_hwservice:hwservice_manager find;
15897#line 4
15898
15899#line 4
15900
15901
15902# The following permissions are added to hal_codec2_server because vendor and
15903# vndk libraries provided for Codec2 implementation need them.
15904
15905# Allow server access to composer sync fences
15906allow hal_codec2_server hal_graphics_composer:fd use;
15907
15908# Allow both server and client access to ion
15909allow hal_codec2_server ion_device:chr_file { getattr open read ioctl lock map };
15910
15911# Allow server access to camera HAL's fences
15912allow hal_codec2_server hal_camera:fd use;
15913
15914# Receive gralloc buffer FDs from bufferhubd.
15915allow hal_codec2_server bufferhubd:fd use;
15916
15917allow hal_codec2_client ion_device:chr_file { getattr open read ioctl lock map };
15918
15919#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_configstore.te"
15920# HwBinder IPC from client to server
15921
15922#line 2
15923# Call the server domain and optionally transfer references to it.
15924#line 2
15925allow hal_configstore_client hal_configstore_server:binder { call transfer };
15926#line 2
15927# Allow the serverdomain to transfer references to the client on the reply.
15928#line 2
15929allow hal_configstore_server hal_configstore_client:binder transfer;
15930#line 2
15931# Receive and use open files from the server.
15932#line 2
15933allow hal_configstore_client hal_configstore_server:fd use;
15934#line 2
15935
15936
15937
15938#line 4
15939  allow hal_configstore_client hal_configstore_ISurfaceFlingerConfigs:hwservice_manager find;
15940#line 4
15941
15942#line 4
15943  allow hal_configstore_server hal_configstore_ISurfaceFlingerConfigs:hwservice_manager { add find };
15944#line 4
15945  allow hal_configstore_server hidl_base_hwservice:hwservice_manager add;
15946#line 4
15947  neverallow { domain -hal_configstore_server } hal_configstore_ISurfaceFlingerConfigs:hwservice_manager add;
15948#line 4
15949
15950#line 4
15951
15952#line 4
15953
15954#line 4
15955    neverallow { domain -hal_configstore_client -hal_configstore_server } hal_configstore_ISurfaceFlingerConfigs:hwservice_manager find;
15956#line 4
15957
15958#line 4
15959
15960
15961# hal_configstore runs with a strict seccomp filter. Use crash_dump's
15962# fallback path to collect crash data.
15963
15964#line 8
15965
15966#line 8
15967allow hal_configstore_server anr_data_file:file append;
15968#line 8
15969allow hal_configstore_server dumpstate:fd use;
15970#line 8
15971allow hal_configstore_server incidentd:fd use;
15972#line 8
15973# TODO: Figure out why write is needed.
15974#line 8
15975allow hal_configstore_server dumpstate:fifo_file { append write };
15976#line 8
15977allow hal_configstore_server incidentd:fifo_file { append write };
15978#line 8
15979allow hal_configstore_server system_server:fifo_file { append write };
15980#line 8
15981allow hal_configstore_server tombstoned:unix_stream_socket connectto;
15982#line 8
15983allow hal_configstore_server tombstoned:fd use;
15984#line 8
15985allow hal_configstore_server tombstoned_crash_socket:sock_file write;
15986#line 8
15987allow hal_configstore_server tombstone_data_file:file append;
15988#line 8
15989
15990
15991###
15992### neverallow rules
15993###
15994
15995# Should never execute an executable without a domain transition
15996neverallow hal_configstore_server { file_type fs_type }:file execute_no_trans;
15997
15998# Should never need network access. Disallow sockets except for
15999# for unix stream/dgram sockets used for logging/debugging.
16000neverallow hal_configstore_server domain:{
16001  rawip_socket tcp_socket udp_socket
16002  netlink_route_socket netlink_selinux_socket
16003  socket netlink_socket packet_socket key_socket appletalk_socket
16004  netlink_tcpdiag_socket netlink_nflog_socket
16005  netlink_xfrm_socket netlink_audit_socket
16006  netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket
16007  netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket
16008  netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket
16009  netlink_rdma_socket netlink_crypto_socket
16010} *;
16011neverallow hal_configstore_server {
16012  domain
16013  -hal_configstore_server
16014  -logd
16015
16016  -tombstoned
16017
16018}:{ unix_dgram_socket unix_stream_socket } *;
16019
16020# Should never need access to anything on /data
16021neverallow hal_configstore_server {
16022  data_file_type
16023  -anr_data_file # for crash dump collection
16024  -tombstone_data_file # for crash dump collection
16025  -zoneinfo_data_file # granted to domain
16026
16027}:{ file fifo_file sock_file } *;
16028
16029# Should never need sdcard access
16030neverallow hal_configstore_server {
16031    sdcard_type
16032    fuse sdcardfs vfat exfat        # manual expansion for completeness
16033}:dir ~getattr;
16034neverallow hal_configstore_server {
16035    sdcard_type
16036    fuse sdcardfs vfat exfat        # manual expansion for completeness
16037}:file *;
16038
16039# Do not permit access to service_manager and vndservice_manager
16040neverallow hal_configstore_server *:service_manager *;
16041
16042# No privileged capabilities
16043neverallow hal_configstore_server self:{ capability capability2 cap_userns cap2_userns } *;
16044
16045# No ptracing other processes
16046neverallow hal_configstore_server *:process ptrace;
16047
16048# no relabeling
16049neverallow hal_configstore_server *:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } { relabelfrom relabelto };
16050#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_confirmationui.te"
16051# HwBinder IPC from client to server
16052
16053#line 2
16054# Call the server domain and optionally transfer references to it.
16055#line 2
16056allow hal_confirmationui_client hal_confirmationui_server:binder { call transfer };
16057#line 2
16058# Allow the serverdomain to transfer references to the client on the reply.
16059#line 2
16060allow hal_confirmationui_server hal_confirmationui_client:binder transfer;
16061#line 2
16062# Receive and use open files from the server.
16063#line 2
16064allow hal_confirmationui_client hal_confirmationui_server:fd use;
16065#line 2
16066
16067
16068
16069#line 4
16070  allow hal_confirmationui_client hal_confirmationui_hwservice:hwservice_manager find;
16071#line 4
16072
16073#line 4
16074  allow hal_confirmationui_server hal_confirmationui_hwservice:hwservice_manager { add find };
16075#line 4
16076  allow hal_confirmationui_server hidl_base_hwservice:hwservice_manager add;
16077#line 4
16078  neverallow { domain -hal_confirmationui_server } hal_confirmationui_hwservice:hwservice_manager add;
16079#line 4
16080
16081#line 4
16082
16083#line 4
16084
16085#line 4
16086    neverallow { domain -hal_confirmationui_client -hal_confirmationui_server } hal_confirmationui_hwservice:hwservice_manager find;
16087#line 4
16088
16089#line 4
16090
16091#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_contexthub.te"
16092# HwBinder IPC from client to server, and callbacks
16093
16094#line 2
16095# Call the server domain and optionally transfer references to it.
16096#line 2
16097allow hal_contexthub_client hal_contexthub_server:binder { call transfer };
16098#line 2
16099# Allow the serverdomain to transfer references to the client on the reply.
16100#line 2
16101allow hal_contexthub_server hal_contexthub_client:binder transfer;
16102#line 2
16103# Receive and use open files from the server.
16104#line 2
16105allow hal_contexthub_client hal_contexthub_server:fd use;
16106#line 2
16107
16108
16109#line 3
16110# Call the server domain and optionally transfer references to it.
16111#line 3
16112allow hal_contexthub_server hal_contexthub_client:binder { call transfer };
16113#line 3
16114# Allow the serverdomain to transfer references to the client on the reply.
16115#line 3
16116allow hal_contexthub_client hal_contexthub_server:binder transfer;
16117#line 3
16118# Receive and use open files from the server.
16119#line 3
16120allow hal_contexthub_server hal_contexthub_client:fd use;
16121#line 3
16122
16123
16124
16125#line 5
16126  allow hal_contexthub_client hal_contexthub_hwservice:hwservice_manager find;
16127#line 5
16128
16129#line 5
16130  allow hal_contexthub_server hal_contexthub_hwservice:hwservice_manager { add find };
16131#line 5
16132  allow hal_contexthub_server hidl_base_hwservice:hwservice_manager add;
16133#line 5
16134  neverallow { domain -hal_contexthub_server } hal_contexthub_hwservice:hwservice_manager add;
16135#line 5
16136
16137#line 5
16138
16139#line 5
16140
16141#line 5
16142    neverallow { domain -hal_contexthub_client -hal_contexthub_server } hal_contexthub_hwservice:hwservice_manager find;
16143#line 5
16144
16145#line 5
16146
16147#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_drm.te"
16148# HwBinder IPC from client to server, and callbacks
16149
16150#line 2
16151# Call the server domain and optionally transfer references to it.
16152#line 2
16153allow hal_drm_client hal_drm_server:binder { call transfer };
16154#line 2
16155# Allow the serverdomain to transfer references to the client on the reply.
16156#line 2
16157allow hal_drm_server hal_drm_client:binder transfer;
16158#line 2
16159# Receive and use open files from the server.
16160#line 2
16161allow hal_drm_client hal_drm_server:fd use;
16162#line 2
16163
16164
16165#line 3
16166# Call the server domain and optionally transfer references to it.
16167#line 3
16168allow hal_drm_server hal_drm_client:binder { call transfer };
16169#line 3
16170# Allow the serverdomain to transfer references to the client on the reply.
16171#line 3
16172allow hal_drm_client hal_drm_server:binder transfer;
16173#line 3
16174# Receive and use open files from the server.
16175#line 3
16176allow hal_drm_server hal_drm_client:fd use;
16177#line 3
16178
16179
16180
16181#line 5
16182  allow hal_drm_client hal_drm_hwservice:hwservice_manager find;
16183#line 5
16184
16185#line 5
16186  allow hal_drm_server hal_drm_hwservice:hwservice_manager { add find };
16187#line 5
16188  allow hal_drm_server hidl_base_hwservice:hwservice_manager add;
16189#line 5
16190  neverallow { domain -hal_drm_server } hal_drm_hwservice:hwservice_manager add;
16191#line 5
16192
16193#line 5
16194
16195#line 5
16196
16197#line 5
16198    neverallow { domain -hal_drm_client -hal_drm_server } hal_drm_hwservice:hwservice_manager find;
16199#line 5
16200
16201#line 5
16202
16203
16204allow hal_drm hidl_memory_hwservice:hwservice_manager find;
16205
16206# Required by Widevine DRM (b/22990512)
16207allow hal_drm self:process execmem;
16208
16209# Permit reading device's serial number from system properties
16210
16211#line 13
16212allow hal_drm serialno_prop:file { getattr open read map };
16213#line 13
16214
16215
16216# Read files already opened under /data
16217allow hal_drm system_data_file:file { getattr read };
16218
16219# Read access to pseudo filesystems
16220
16221#line 19
16222allow hal_drm cgroup:dir { open getattr read search ioctl lock };
16223#line 19
16224allow hal_drm cgroup:{ file lnk_file } { getattr open read ioctl lock map };
16225#line 19
16226
16227allow hal_drm cgroup:dir { search write };
16228allow hal_drm cgroup:file { open append write lock map };
16229
16230# Allow access to ion memory allocation device
16231allow hal_drm ion_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
16232allow hal_drm hal_graphics_allocator:fd use;
16233
16234# Allow access to fds allocated by mediaserver
16235allow hal_drm mediaserver:fd use;
16236
16237allow hal_drm sysfs:file { getattr open read ioctl lock map };
16238
16239allow hal_drm tee_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
16240
16241# only allow unprivileged socket ioctl commands
16242allowxperm hal_drm self:{ rawip_socket tcp_socket udp_socket }
16243  ioctl {
16244#line 36
16245{
16246#line 36
16247# Socket ioctls for gathering information about the interface
16248#line 36
162490x00008906 0x00008907
16250#line 36
162510x00008910 0x00008912 0x00008913 0x00008915 0x00008917 0x00008919
16252#line 36
162530x0000891b 0x00008921 0x00008933 0x00008938 0x00008942
16254#line 36
16255# Wireless extension ioctls. Primarily get functions.
16256#line 36
162570x00008b01 0x00008b05 0x00008b07 0x00008b09 0x00008b0b 0x00008b0d
16258#line 36
162590x00008b0f 0x00008b11 0x00008b12 0x00008b13 0x00008b21 0x00008b23
16260#line 36
162610x00008b25 0x00008b27 0x00008b29 0x00008b2d
16262#line 36
16263} {
16264#line 36
16265  0x00005411 0x00005451 0x00005450 0x00005401 0x00005402 0x00005413 0x00005414 0x0000540e
16266#line 36
16267  0x00005403 0x0000540b 0x00005410 0x0000540f
16268#line 36
16269} };
16270
16271###
16272### neverallow rules
16273###
16274
16275# hal_drm should never execute any executable without a
16276# domain transition
16277neverallow hal_drm_server { file_type fs_type }:file execute_no_trans;
16278
16279# do not allow privileged socket ioctl commands
16280neverallowxperm hal_drm_server domain:{ rawip_socket tcp_socket udp_socket } ioctl
16281#line 47
16282{
16283#line 47
16284# qualcomm rmnet ioctls
16285#line 47
162860x00006900 0x00006902
16287#line 47
16288# socket ioctls
16289#line 47
162900x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
16291#line 47
162920x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
16293#line 47
162940x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
16295#line 47
162960x00008927 0x00008929 0x00008930 0x00008931 0x00008932
16297#line 47
162980x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
16299#line 47
163000x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
16301#line 47
163020x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
16303#line 47
163040x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
16305#line 47
163060x00008991 0x00008992 0x00008993 0x00008994
16307#line 47
163080x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
16309#line 47
16310# device and protocol specific ioctls
16311#line 47
163120x000089f0-0x000089ff
16313#line 47
163140x000089e0-0x000089ef
16315#line 47
16316# Wireless extension ioctls
16317#line 47
163180x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
16319#line 47
163200x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
16321#line 47
163220x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
16323#line 47
163240x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
16325#line 47
163260x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
16327#line 47
163280x00008b34 0x00008b35 0x00008b36
16329#line 47
16330# Dev private ioctl i.e. hardware specific ioctls
16331#line 47
163320x00008be0-0x00008bff
16333#line 47
16334};
16335#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_dumpstate.te"
16336# HwBinder IPC from client to server, and callbacks
16337
16338#line 2
16339# Call the server domain and optionally transfer references to it.
16340#line 2
16341allow hal_dumpstate_client hal_dumpstate_server:binder { call transfer };
16342#line 2
16343# Allow the serverdomain to transfer references to the client on the reply.
16344#line 2
16345allow hal_dumpstate_server hal_dumpstate_client:binder transfer;
16346#line 2
16347# Receive and use open files from the server.
16348#line 2
16349allow hal_dumpstate_client hal_dumpstate_server:fd use;
16350#line 2
16351
16352
16353#line 3
16354# Call the server domain and optionally transfer references to it.
16355#line 3
16356allow hal_dumpstate_server hal_dumpstate_client:binder { call transfer };
16357#line 3
16358# Allow the serverdomain to transfer references to the client on the reply.
16359#line 3
16360allow hal_dumpstate_client hal_dumpstate_server:binder transfer;
16361#line 3
16362# Receive and use open files from the server.
16363#line 3
16364allow hal_dumpstate_server hal_dumpstate_client:fd use;
16365#line 3
16366
16367
16368
16369#line 5
16370  allow hal_dumpstate_client hal_dumpstate_hwservice:hwservice_manager find;
16371#line 5
16372
16373#line 5
16374  allow hal_dumpstate_server hal_dumpstate_hwservice:hwservice_manager { add find };
16375#line 5
16376  allow hal_dumpstate_server hidl_base_hwservice:hwservice_manager add;
16377#line 5
16378  neverallow { domain -hal_dumpstate_server } hal_dumpstate_hwservice:hwservice_manager add;
16379#line 5
16380
16381#line 5
16382
16383#line 5
16384
16385#line 5
16386    neverallow { domain -hal_dumpstate_client -hal_dumpstate_server } hal_dumpstate_hwservice:hwservice_manager find;
16387#line 5
16388
16389#line 5
16390
16391
16392# write bug reports in /data/data/com.android.shell/files/bugreports/bugreport
16393allow hal_dumpstate shell_data_file:file write;
16394# allow reading /proc/interrupts for all hal impls
16395allow hal_dumpstate proc_interrupts:file { getattr open read ioctl lock map };
16396#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_evs.te"
16397
16398#line 1
16399# Call the hwservicemanager and transfer references to it.
16400#line 1
16401allow hal_evs_client hwservicemanager:binder { call transfer };
16402#line 1
16403# Allow hwservicemanager to send out callbacks
16404#line 1
16405allow hwservicemanager hal_evs_client:binder { call transfer };
16406#line 1
16407# hwservicemanager performs getpidcon on clients.
16408#line 1
16409allow hwservicemanager hal_evs_client:dir search;
16410#line 1
16411allow hwservicemanager hal_evs_client:file { read open map };
16412#line 1
16413allow hwservicemanager hal_evs_client:process getattr;
16414#line 1
16415# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
16416#line 1
16417# all domains in domain.te.
16418#line 1
16419
16420
16421#line 2
16422# Call the hwservicemanager and transfer references to it.
16423#line 2
16424allow hal_evs_server hwservicemanager:binder { call transfer };
16425#line 2
16426# Allow hwservicemanager to send out callbacks
16427#line 2
16428allow hwservicemanager hal_evs_server:binder { call transfer };
16429#line 2
16430# hwservicemanager performs getpidcon on clients.
16431#line 2
16432allow hwservicemanager hal_evs_server:dir search;
16433#line 2
16434allow hwservicemanager hal_evs_server:file { read open map };
16435#line 2
16436allow hwservicemanager hal_evs_server:process getattr;
16437#line 2
16438# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
16439#line 2
16440# all domains in domain.te.
16441#line 2
16442
16443
16444#line 3
16445# Call the server domain and optionally transfer references to it.
16446#line 3
16447allow hal_evs_client hal_evs_server:binder { call transfer };
16448#line 3
16449# Allow the serverdomain to transfer references to the client on the reply.
16450#line 3
16451allow hal_evs_server hal_evs_client:binder transfer;
16452#line 3
16453# Receive and use open files from the server.
16454#line 3
16455allow hal_evs_client hal_evs_server:fd use;
16456#line 3
16457
16458
16459#line 4
16460# Call the server domain and optionally transfer references to it.
16461#line 4
16462allow hal_evs_server hal_evs_client:binder { call transfer };
16463#line 4
16464# Allow the serverdomain to transfer references to the client on the reply.
16465#line 4
16466allow hal_evs_client hal_evs_server:binder transfer;
16467#line 4
16468# Receive and use open files from the server.
16469#line 4
16470allow hal_evs_server hal_evs_client:fd use;
16471#line 4
16472
16473allow hal_evs_client hal_evs_hwservice:hwservice_manager find;
16474#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_face.te"
16475# Allow HwBinder IPC from client to server, and vice versa for callbacks.
16476
16477#line 2
16478# Call the server domain and optionally transfer references to it.
16479#line 2
16480allow hal_face_client hal_face_server:binder { call transfer };
16481#line 2
16482# Allow the serverdomain to transfer references to the client on the reply.
16483#line 2
16484allow hal_face_server hal_face_client:binder transfer;
16485#line 2
16486# Receive and use open files from the server.
16487#line 2
16488allow hal_face_client hal_face_server:fd use;
16489#line 2
16490
16491
16492#line 3
16493# Call the server domain and optionally transfer references to it.
16494#line 3
16495allow hal_face_server hal_face_client:binder { call transfer };
16496#line 3
16497# Allow the serverdomain to transfer references to the client on the reply.
16498#line 3
16499allow hal_face_client hal_face_server:binder transfer;
16500#line 3
16501# Receive and use open files from the server.
16502#line 3
16503allow hal_face_server hal_face_client:fd use;
16504#line 3
16505
16506
16507
16508#line 5
16509  allow hal_face_client hal_face_hwservice:hwservice_manager find;
16510#line 5
16511
16512#line 5
16513  allow hal_face_server hal_face_hwservice:hwservice_manager { add find };
16514#line 5
16515  allow hal_face_server hidl_base_hwservice:hwservice_manager add;
16516#line 5
16517  neverallow { domain -hal_face_server } hal_face_hwservice:hwservice_manager add;
16518#line 5
16519
16520#line 5
16521
16522#line 5
16523
16524#line 5
16525    neverallow { domain -hal_face_client -hal_face_server } hal_face_hwservice:hwservice_manager find;
16526#line 5
16527
16528#line 5
16529
16530
16531# Allow access to the ion memory allocation device.
16532allow hal_face ion_device:chr_file { getattr open read ioctl lock map };
16533
16534# Allow read/write access to the face template directory.
16535allow hal_face face_vendor_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
16536allow hal_face face_vendor_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
16537#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_fingerprint.te"
16538# HwBinder IPC from client to server, and callbacks
16539
16540#line 2
16541# Call the server domain and optionally transfer references to it.
16542#line 2
16543allow hal_fingerprint_client hal_fingerprint_server:binder { call transfer };
16544#line 2
16545# Allow the serverdomain to transfer references to the client on the reply.
16546#line 2
16547allow hal_fingerprint_server hal_fingerprint_client:binder transfer;
16548#line 2
16549# Receive and use open files from the server.
16550#line 2
16551allow hal_fingerprint_client hal_fingerprint_server:fd use;
16552#line 2
16553
16554
16555#line 3
16556# Call the server domain and optionally transfer references to it.
16557#line 3
16558allow hal_fingerprint_server hal_fingerprint_client:binder { call transfer };
16559#line 3
16560# Allow the serverdomain to transfer references to the client on the reply.
16561#line 3
16562allow hal_fingerprint_client hal_fingerprint_server:binder transfer;
16563#line 3
16564# Receive and use open files from the server.
16565#line 3
16566allow hal_fingerprint_server hal_fingerprint_client:fd use;
16567#line 3
16568
16569
16570
16571#line 5
16572  allow hal_fingerprint_client hal_fingerprint_hwservice:hwservice_manager find;
16573#line 5
16574
16575#line 5
16576  allow hal_fingerprint_server hal_fingerprint_hwservice:hwservice_manager { add find };
16577#line 5
16578  allow hal_fingerprint_server hidl_base_hwservice:hwservice_manager add;
16579#line 5
16580  neverallow { domain -hal_fingerprint_server } hal_fingerprint_hwservice:hwservice_manager add;
16581#line 5
16582
16583#line 5
16584
16585#line 5
16586
16587#line 5
16588    neverallow { domain -hal_fingerprint_client -hal_fingerprint_server } hal_fingerprint_hwservice:hwservice_manager find;
16589#line 5
16590
16591#line 5
16592
16593
16594# For memory allocation
16595allow hal_fingerprint ion_device:chr_file { getattr open read ioctl lock map };
16596
16597allow hal_fingerprint fingerprint_vendor_data_file:file { { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } } };
16598allow hal_fingerprint fingerprint_vendor_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
16599
16600
16601#line 13
16602allow hal_fingerprint cgroup:dir { open getattr read search ioctl lock };
16603#line 13
16604allow hal_fingerprint cgroup:{ file lnk_file } { getattr open read ioctl lock map };
16605#line 13
16606
16607
16608#line 14
16609allow hal_fingerprint sysfs:dir { open getattr read search ioctl lock };
16610#line 14
16611allow hal_fingerprint sysfs:{ file lnk_file } { getattr open read ioctl lock map };
16612#line 14
16613
16614
16615
16616#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_gatekeeper.te"
16617
16618#line 1
16619# Call the server domain and optionally transfer references to it.
16620#line 1
16621allow hal_gatekeeper_client hal_gatekeeper_server:binder { call transfer };
16622#line 1
16623# Allow the serverdomain to transfer references to the client on the reply.
16624#line 1
16625allow hal_gatekeeper_server hal_gatekeeper_client:binder transfer;
16626#line 1
16627# Receive and use open files from the server.
16628#line 1
16629allow hal_gatekeeper_client hal_gatekeeper_server:fd use;
16630#line 1
16631
16632
16633
16634#line 3
16635  allow hal_gatekeeper_client hal_gatekeeper_hwservice:hwservice_manager find;
16636#line 3
16637
16638#line 3
16639  allow hal_gatekeeper_server hal_gatekeeper_hwservice:hwservice_manager { add find };
16640#line 3
16641  allow hal_gatekeeper_server hidl_base_hwservice:hwservice_manager add;
16642#line 3
16643  neverallow { domain -hal_gatekeeper_server } hal_gatekeeper_hwservice:hwservice_manager add;
16644#line 3
16645
16646#line 3
16647
16648#line 3
16649
16650#line 3
16651    neverallow { domain -hal_gatekeeper_client -hal_gatekeeper_server } hal_gatekeeper_hwservice:hwservice_manager find;
16652#line 3
16653
16654#line 3
16655
16656
16657# TEE access.
16658allow hal_gatekeeper tee_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
16659allow hal_gatekeeper ion_device:chr_file { getattr open read ioctl lock map };
16660#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_gnss.te"
16661# HwBinder IPC from client to server, and callbacks
16662
16663#line 2
16664# Call the server domain and optionally transfer references to it.
16665#line 2
16666allow hal_gnss_client hal_gnss_server:binder { call transfer };
16667#line 2
16668# Allow the serverdomain to transfer references to the client on the reply.
16669#line 2
16670allow hal_gnss_server hal_gnss_client:binder transfer;
16671#line 2
16672# Receive and use open files from the server.
16673#line 2
16674allow hal_gnss_client hal_gnss_server:fd use;
16675#line 2
16676
16677
16678#line 3
16679# Call the server domain and optionally transfer references to it.
16680#line 3
16681allow hal_gnss_server hal_gnss_client:binder { call transfer };
16682#line 3
16683# Allow the serverdomain to transfer references to the client on the reply.
16684#line 3
16685allow hal_gnss_client hal_gnss_server:binder transfer;
16686#line 3
16687# Receive and use open files from the server.
16688#line 3
16689allow hal_gnss_server hal_gnss_client:fd use;
16690#line 3
16691
16692
16693
16694#line 5
16695  allow hal_gnss_client hal_gnss_hwservice:hwservice_manager find;
16696#line 5
16697
16698#line 5
16699  allow hal_gnss_server hal_gnss_hwservice:hwservice_manager { add find };
16700#line 5
16701  allow hal_gnss_server hidl_base_hwservice:hwservice_manager add;
16702#line 5
16703  neverallow { domain -hal_gnss_server } hal_gnss_hwservice:hwservice_manager add;
16704#line 5
16705
16706#line 5
16707
16708#line 5
16709
16710#line 5
16711    neverallow { domain -hal_gnss_client -hal_gnss_server } hal_gnss_hwservice:hwservice_manager find;
16712#line 5
16713
16714#line 5
16715
16716#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_graphics_allocator.te"
16717# HwBinder IPC from client to server
16718
16719#line 2
16720# Call the server domain and optionally transfer references to it.
16721#line 2
16722allow hal_graphics_allocator_client hal_graphics_allocator_server:binder { call transfer };
16723#line 2
16724# Allow the serverdomain to transfer references to the client on the reply.
16725#line 2
16726allow hal_graphics_allocator_server hal_graphics_allocator_client:binder transfer;
16727#line 2
16728# Receive and use open files from the server.
16729#line 2
16730allow hal_graphics_allocator_client hal_graphics_allocator_server:fd use;
16731#line 2
16732
16733
16734
16735#line 4
16736  allow hal_graphics_allocator_client hal_graphics_allocator_hwservice:hwservice_manager find;
16737#line 4
16738
16739#line 4
16740  allow hal_graphics_allocator_server hal_graphics_allocator_hwservice:hwservice_manager { add find };
16741#line 4
16742  allow hal_graphics_allocator_server hidl_base_hwservice:hwservice_manager add;
16743#line 4
16744  neverallow { domain -hal_graphics_allocator_server } hal_graphics_allocator_hwservice:hwservice_manager add;
16745#line 4
16746
16747#line 4
16748
16749#line 4
16750
16751#line 4
16752    neverallow { domain -hal_graphics_allocator_client -hal_graphics_allocator_server } hal_graphics_allocator_hwservice:hwservice_manager find;
16753#line 4
16754
16755#line 4
16756
16757allow hal_graphics_allocator_client hal_graphics_mapper_hwservice:hwservice_manager find;
16758allow hal_graphics_allocator_client same_process_hal_file:file { execute read open getattr map };
16759
16760# GPU device access
16761allow hal_graphics_allocator gpu_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
16762allow hal_graphics_allocator ion_device:chr_file { getattr open read ioctl lock map };
16763
16764# allow to run with real-time scheduling policy
16765allow hal_graphics_allocator self:{ capability cap_userns } sys_nice;
16766#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_graphics_composer.te"
16767type hal_graphics_composer_server_tmpfs, file_type;
16768attribute hal_graphics_composer_client_tmpfs;
16769expandattribute hal_graphics_composer_client_tmpfs true;
16770
16771# HwBinder IPC from client to server, and callbacks
16772
16773#line 6
16774# Call the server domain and optionally transfer references to it.
16775#line 6
16776allow hal_graphics_composer_client hal_graphics_composer_server:binder { call transfer };
16777#line 6
16778# Allow the serverdomain to transfer references to the client on the reply.
16779#line 6
16780allow hal_graphics_composer_server hal_graphics_composer_client:binder transfer;
16781#line 6
16782# Receive and use open files from the server.
16783#line 6
16784allow hal_graphics_composer_client hal_graphics_composer_server:fd use;
16785#line 6
16786
16787
16788#line 7
16789# Call the server domain and optionally transfer references to it.
16790#line 7
16791allow hal_graphics_composer_server hal_graphics_composer_client:binder { call transfer };
16792#line 7
16793# Allow the serverdomain to transfer references to the client on the reply.
16794#line 7
16795allow hal_graphics_composer_client hal_graphics_composer_server:binder transfer;
16796#line 7
16797# Receive and use open files from the server.
16798#line 7
16799allow hal_graphics_composer_server hal_graphics_composer_client:fd use;
16800#line 7
16801
16802allow hal_graphics_composer_client hal_graphics_composer_server_tmpfs:file { getattr map read write };
16803allow hal_graphics_composer_server hal_graphics_composer_client_tmpfs:file { getattr map read write };
16804
16805
16806#line 11
16807  allow hal_graphics_composer_client hal_graphics_composer_hwservice:hwservice_manager find;
16808#line 11
16809
16810#line 11
16811  allow hal_graphics_composer_server hal_graphics_composer_hwservice:hwservice_manager { add find };
16812#line 11
16813  allow hal_graphics_composer_server hidl_base_hwservice:hwservice_manager add;
16814#line 11
16815  neverallow { domain -hal_graphics_composer_server } hal_graphics_composer_hwservice:hwservice_manager add;
16816#line 11
16817
16818#line 11
16819
16820#line 11
16821
16822#line 11
16823    neverallow { domain -hal_graphics_composer_client -hal_graphics_composer_server } hal_graphics_composer_hwservice:hwservice_manager find;
16824#line 11
16825
16826#line 11
16827
16828
16829# Coordinate with hal_graphics_mapper
16830allow hal_graphics_composer_server hal_graphics_mapper_hwservice:hwservice_manager find;
16831
16832# GPU device access
16833allow hal_graphics_composer gpu_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
16834allow hal_graphics_composer ion_device:chr_file { getattr open read ioctl lock map };
16835allow hal_graphics_composer hal_graphics_allocator:fd use;
16836
16837# Access /dev/graphics/fb0.
16838allow hal_graphics_composer graphics_device:dir search;
16839allow hal_graphics_composer graphics_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
16840
16841# Fences
16842allow hal_graphics_composer system_server:fd use;
16843allow hal_graphics_composer bootanim:fd use;
16844allow hal_graphics_composer appdomain:fd use;
16845
16846# allow self to set SCHED_FIFO
16847allow hal_graphics_composer self:{ capability cap_userns } sys_nice;
16848#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_health.te"
16849# HwBinder IPC from client to server, and callbacks
16850
16851#line 2
16852# Call the server domain and optionally transfer references to it.
16853#line 2
16854allow hal_health_client hal_health_server:binder { call transfer };
16855#line 2
16856# Allow the serverdomain to transfer references to the client on the reply.
16857#line 2
16858allow hal_health_server hal_health_client:binder transfer;
16859#line 2
16860# Receive and use open files from the server.
16861#line 2
16862allow hal_health_client hal_health_server:fd use;
16863#line 2
16864
16865
16866#line 3
16867# Call the server domain and optionally transfer references to it.
16868#line 3
16869allow hal_health_server hal_health_client:binder { call transfer };
16870#line 3
16871# Allow the serverdomain to transfer references to the client on the reply.
16872#line 3
16873allow hal_health_client hal_health_server:binder transfer;
16874#line 3
16875# Receive and use open files from the server.
16876#line 3
16877allow hal_health_server hal_health_client:fd use;
16878#line 3
16879
16880
16881
16882#line 5
16883  allow hal_health_client hal_health_hwservice:hwservice_manager find;
16884#line 5
16885
16886#line 5
16887  allow hal_health_server hal_health_hwservice:hwservice_manager { add find };
16888#line 5
16889  allow hal_health_server hidl_base_hwservice:hwservice_manager add;
16890#line 5
16891  neverallow { domain -hal_health_server } hal_health_hwservice:hwservice_manager add;
16892#line 5
16893
16894#line 5
16895
16896#line 5
16897
16898#line 5
16899    neverallow { domain -hal_health_client -hal_health_server } hal_health_hwservice:hwservice_manager find;
16900#line 5
16901
16902#line 5
16903
16904
16905# Common rules for a health service.
16906
16907# Allow to listen to uevents for updates
16908allow hal_health_server self:netlink_kobject_uevent_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
16909
16910# Allow to read /sys/class/power_supply directory
16911allow hal_health_server sysfs:dir { open getattr read search ioctl lock };
16912
16913# Allow to read files under /sys/class/power_supply. Implementations typically have symlinks
16914# to vendor specific files. Vendors should mark sysfs_batteryinfo on all files read by health
16915# HAL service.
16916
16917#line 18
16918allow hal_health_server sysfs_batteryinfo:dir { open getattr read search ioctl lock };
16919#line 18
16920allow hal_health_server sysfs_batteryinfo:{ file lnk_file } { getattr open read ioctl lock map };
16921#line 18
16922
16923
16924# Allow to wake up to send periodic events
16925
16926#line 21
16927# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
16928#line 21
16929# deprecated.
16930#line 21
16931# Access /sys/power/wake_lock and /sys/power/wake_unlock
16932#line 21
16933allow hal_health_server sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
16934#line 21
16935# Accessing these files requires CAP_BLOCK_SUSPEND
16936#line 21
16937allow hal_health_server self:{ capability2 cap2_userns } block_suspend;
16938#line 21
16939# system_suspend permissions
16940#line 21
16941
16942#line 21
16943# Call the server domain and optionally transfer references to it.
16944#line 21
16945allow hal_health_server system_suspend_server:binder { call transfer };
16946#line 21
16947# Allow the serverdomain to transfer references to the client on the reply.
16948#line 21
16949allow system_suspend_server hal_health_server:binder transfer;
16950#line 21
16951# Receive and use open files from the server.
16952#line 21
16953allow hal_health_server system_suspend_server:fd use;
16954#line 21
16955
16956#line 21
16957allow hal_health_server system_suspend_hwservice:hwservice_manager find;
16958#line 21
16959# halclientdomain permissions
16960#line 21
16961
16962#line 21
16963# Call the hwservicemanager and transfer references to it.
16964#line 21
16965allow hal_health_server hwservicemanager:binder { call transfer };
16966#line 21
16967# Allow hwservicemanager to send out callbacks
16968#line 21
16969allow hwservicemanager hal_health_server:binder { call transfer };
16970#line 21
16971# hwservicemanager performs getpidcon on clients.
16972#line 21
16973allow hwservicemanager hal_health_server:dir search;
16974#line 21
16975allow hwservicemanager hal_health_server:file { read open map };
16976#line 21
16977allow hwservicemanager hal_health_server:process getattr;
16978#line 21
16979# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
16980#line 21
16981# all domains in domain.te.
16982#line 21
16983
16984#line 21
16985
16986#line 21
16987allow hal_health_server hwservicemanager_prop:file { getattr open read map };
16988#line 21
16989
16990#line 21
16991allow hal_health_server hidl_manager_hwservice:hwservice_manager find;
16992#line 21
16993
16994
16995# Write to /dev/kmsg
16996allow hal_health_server kmsg_device:chr_file { getattr { open append write lock map } };
16997
16998# Allow to use timerfd to wake itself up periodically to send health info.
16999allow hal_health_server self:capability2 wake_alarm;
17000#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_health_storage.te"
17001# HwBinder IPC from client to server, and callbacks
17002
17003#line 2
17004# Call the server domain and optionally transfer references to it.
17005#line 2
17006allow hal_health_storage_client hal_health_storage_server:binder { call transfer };
17007#line 2
17008# Allow the serverdomain to transfer references to the client on the reply.
17009#line 2
17010allow hal_health_storage_server hal_health_storage_client:binder transfer;
17011#line 2
17012# Receive and use open files from the server.
17013#line 2
17014allow hal_health_storage_client hal_health_storage_server:fd use;
17015#line 2
17016
17017
17018#line 3
17019# Call the server domain and optionally transfer references to it.
17020#line 3
17021allow hal_health_storage_server hal_health_storage_client:binder { call transfer };
17022#line 3
17023# Allow the serverdomain to transfer references to the client on the reply.
17024#line 3
17025allow hal_health_storage_client hal_health_storage_server:binder transfer;
17026#line 3
17027# Receive and use open files from the server.
17028#line 3
17029allow hal_health_storage_server hal_health_storage_client:fd use;
17030#line 3
17031
17032
17033
17034#line 5
17035  allow hal_health_storage_client hal_health_storage_hwservice:hwservice_manager find;
17036#line 5
17037
17038#line 5
17039  allow hal_health_storage_server hal_health_storage_hwservice:hwservice_manager { add find };
17040#line 5
17041  allow hal_health_storage_server hidl_base_hwservice:hwservice_manager add;
17042#line 5
17043  neverallow { domain -hal_health_storage_server } hal_health_storage_hwservice:hwservice_manager add;
17044#line 5
17045
17046#line 5
17047
17048#line 5
17049
17050#line 5
17051    neverallow { domain -hal_health_storage_client -hal_health_storage_server } hal_health_storage_hwservice:hwservice_manager find;
17052#line 5
17053
17054#line 5
17055
17056#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_input_classifier.te"
17057# HwBinder IPC from client to server
17058
17059#line 2
17060# Call the server domain and optionally transfer references to it.
17061#line 2
17062allow hal_input_classifier_client hal_input_classifier_server:binder { call transfer };
17063#line 2
17064# Allow the serverdomain to transfer references to the client on the reply.
17065#line 2
17066allow hal_input_classifier_server hal_input_classifier_client:binder transfer;
17067#line 2
17068# Receive and use open files from the server.
17069#line 2
17070allow hal_input_classifier_client hal_input_classifier_server:fd use;
17071#line 2
17072
17073
17074
17075#line 4
17076  allow hal_input_classifier_client hal_input_classifier_hwservice:hwservice_manager find;
17077#line 4
17078
17079#line 4
17080  allow hal_input_classifier_server hal_input_classifier_hwservice:hwservice_manager { add find };
17081#line 4
17082  allow hal_input_classifier_server hidl_base_hwservice:hwservice_manager add;
17083#line 4
17084  neverallow { domain -hal_input_classifier_server } hal_input_classifier_hwservice:hwservice_manager add;
17085#line 4
17086
17087#line 4
17088
17089#line 4
17090
17091#line 4
17092    neverallow { domain -hal_input_classifier_client -hal_input_classifier_server } hal_input_classifier_hwservice:hwservice_manager find;
17093#line 4
17094
17095#line 4
17096
17097#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_ir.te"
17098# HwBinder IPC from client to server, and callbacks
17099
17100#line 2
17101# Call the server domain and optionally transfer references to it.
17102#line 2
17103allow hal_ir_client hal_ir_server:binder { call transfer };
17104#line 2
17105# Allow the serverdomain to transfer references to the client on the reply.
17106#line 2
17107allow hal_ir_server hal_ir_client:binder transfer;
17108#line 2
17109# Receive and use open files from the server.
17110#line 2
17111allow hal_ir_client hal_ir_server:fd use;
17112#line 2
17113
17114
17115#line 3
17116# Call the server domain and optionally transfer references to it.
17117#line 3
17118allow hal_ir_server hal_ir_client:binder { call transfer };
17119#line 3
17120# Allow the serverdomain to transfer references to the client on the reply.
17121#line 3
17122allow hal_ir_client hal_ir_server:binder transfer;
17123#line 3
17124# Receive and use open files from the server.
17125#line 3
17126allow hal_ir_server hal_ir_client:fd use;
17127#line 3
17128
17129
17130
17131#line 5
17132  allow hal_ir_client hal_ir_hwservice:hwservice_manager find;
17133#line 5
17134
17135#line 5
17136  allow hal_ir_server hal_ir_hwservice:hwservice_manager { add find };
17137#line 5
17138  allow hal_ir_server hidl_base_hwservice:hwservice_manager add;
17139#line 5
17140  neverallow { domain -hal_ir_server } hal_ir_hwservice:hwservice_manager add;
17141#line 5
17142
17143#line 5
17144
17145#line 5
17146
17147#line 5
17148    neverallow { domain -hal_ir_client -hal_ir_server } hal_ir_hwservice:hwservice_manager find;
17149#line 5
17150
17151#line 5
17152
17153#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_keymaster.te"
17154# HwBinder IPC from client to server
17155
17156#line 2
17157# Call the server domain and optionally transfer references to it.
17158#line 2
17159allow hal_keymaster_client hal_keymaster_server:binder { call transfer };
17160#line 2
17161# Allow the serverdomain to transfer references to the client on the reply.
17162#line 2
17163allow hal_keymaster_server hal_keymaster_client:binder transfer;
17164#line 2
17165# Receive and use open files from the server.
17166#line 2
17167allow hal_keymaster_client hal_keymaster_server:fd use;
17168#line 2
17169
17170
17171
17172#line 4
17173  allow hal_keymaster_client hal_keymaster_hwservice:hwservice_manager find;
17174#line 4
17175
17176#line 4
17177  allow hal_keymaster_server hal_keymaster_hwservice:hwservice_manager { add find };
17178#line 4
17179  allow hal_keymaster_server hidl_base_hwservice:hwservice_manager add;
17180#line 4
17181  neverallow { domain -hal_keymaster_server } hal_keymaster_hwservice:hwservice_manager add;
17182#line 4
17183
17184#line 4
17185
17186#line 4
17187
17188#line 4
17189    neverallow { domain -hal_keymaster_client -hal_keymaster_server } hal_keymaster_hwservice:hwservice_manager find;
17190#line 4
17191
17192#line 4
17193
17194
17195allow hal_keymaster tee_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
17196allow hal_keymaster ion_device:chr_file { getattr open read ioctl lock map };
17197#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_light.te"
17198# HwBinder IPC from client to server, and callbacks
17199
17200#line 2
17201# Call the server domain and optionally transfer references to it.
17202#line 2
17203allow hal_light_client hal_light_server:binder { call transfer };
17204#line 2
17205# Allow the serverdomain to transfer references to the client on the reply.
17206#line 2
17207allow hal_light_server hal_light_client:binder transfer;
17208#line 2
17209# Receive and use open files from the server.
17210#line 2
17211allow hal_light_client hal_light_server:fd use;
17212#line 2
17213
17214
17215#line 3
17216# Call the server domain and optionally transfer references to it.
17217#line 3
17218allow hal_light_server hal_light_client:binder { call transfer };
17219#line 3
17220# Allow the serverdomain to transfer references to the client on the reply.
17221#line 3
17222allow hal_light_client hal_light_server:binder transfer;
17223#line 3
17224# Receive and use open files from the server.
17225#line 3
17226allow hal_light_server hal_light_client:fd use;
17227#line 3
17228
17229
17230
17231#line 5
17232  allow hal_light_client hal_light_hwservice:hwservice_manager find;
17233#line 5
17234
17235#line 5
17236  allow hal_light_server hal_light_hwservice:hwservice_manager { add find };
17237#line 5
17238  allow hal_light_server hidl_base_hwservice:hwservice_manager add;
17239#line 5
17240  neverallow { domain -hal_light_server } hal_light_hwservice:hwservice_manager add;
17241#line 5
17242
17243#line 5
17244
17245#line 5
17246
17247#line 5
17248    neverallow { domain -hal_light_client -hal_light_server } hal_light_hwservice:hwservice_manager find;
17249#line 5
17250
17251#line 5
17252
17253
17254allow hal_light sysfs_leds:lnk_file read;
17255allow hal_light sysfs_leds:file { { getattr open read ioctl lock map } { open append write lock map } };
17256allow hal_light sysfs_leds:dir { open getattr read search ioctl lock };
17257#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_lowpan.te"
17258# HwBinder IPC from client to server, and callbacks
17259
17260#line 2
17261# Call the server domain and optionally transfer references to it.
17262#line 2
17263allow hal_lowpan_client hal_lowpan_server:binder { call transfer };
17264#line 2
17265# Allow the serverdomain to transfer references to the client on the reply.
17266#line 2
17267allow hal_lowpan_server hal_lowpan_client:binder transfer;
17268#line 2
17269# Receive and use open files from the server.
17270#line 2
17271allow hal_lowpan_client hal_lowpan_server:fd use;
17272#line 2
17273
17274
17275#line 3
17276# Call the server domain and optionally transfer references to it.
17277#line 3
17278allow hal_lowpan_server hal_lowpan_client:binder { call transfer };
17279#line 3
17280# Allow the serverdomain to transfer references to the client on the reply.
17281#line 3
17282allow hal_lowpan_client hal_lowpan_server:binder transfer;
17283#line 3
17284# Receive and use open files from the server.
17285#line 3
17286allow hal_lowpan_server hal_lowpan_client:fd use;
17287#line 3
17288
17289
17290
17291# Allow hal_lowpan_client to be able to find the hal_lowpan_server
17292
17293#line 7
17294  allow hal_lowpan_client hal_lowpan_hwservice:hwservice_manager find;
17295#line 7
17296
17297#line 7
17298  allow hal_lowpan_server hal_lowpan_hwservice:hwservice_manager { add find };
17299#line 7
17300  allow hal_lowpan_server hidl_base_hwservice:hwservice_manager add;
17301#line 7
17302  neverallow { domain -hal_lowpan_server } hal_lowpan_hwservice:hwservice_manager add;
17303#line 7
17304
17305#line 7
17306
17307#line 7
17308
17309#line 7
17310    neverallow { domain -hal_lowpan_client -hal_lowpan_server } hal_lowpan_hwservice:hwservice_manager find;
17311#line 7
17312
17313#line 7
17314
17315
17316# hal_lowpan domain can write/read to/from lowpan_prop
17317
17318#line 10
17319
17320#line 10
17321allow hal_lowpan_server property_socket:sock_file write;
17322#line 10
17323allow hal_lowpan_server init:unix_stream_socket connectto;
17324#line 10
17325
17326#line 10
17327allow hal_lowpan_server lowpan_prop:property_service set;
17328#line 10
17329
17330#line 10
17331allow hal_lowpan_server lowpan_prop:file { getattr open read map };
17332#line 10
17333
17334#line 10
17335
17336
17337# Allow hal_lowpan_server to open lowpan_devices
17338allow hal_lowpan_server lowpan_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
17339
17340###
17341### neverallow rules
17342###
17343
17344# Only LoWPAN HAL may directly access LoWPAN hardware
17345neverallow { domain -hal_lowpan_server -init -ueventd } lowpan_device:chr_file ~getattr;
17346#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_memtrack.te"
17347# HwBinder IPC from client to server
17348
17349#line 2
17350# Call the server domain and optionally transfer references to it.
17351#line 2
17352allow hal_memtrack_client hal_memtrack_server:binder { call transfer };
17353#line 2
17354# Allow the serverdomain to transfer references to the client on the reply.
17355#line 2
17356allow hal_memtrack_server hal_memtrack_client:binder transfer;
17357#line 2
17358# Receive and use open files from the server.
17359#line 2
17360allow hal_memtrack_client hal_memtrack_server:fd use;
17361#line 2
17362
17363
17364
17365#line 4
17366  allow hal_memtrack_client hal_memtrack_hwservice:hwservice_manager find;
17367#line 4
17368
17369#line 4
17370  allow hal_memtrack_server hal_memtrack_hwservice:hwservice_manager { add find };
17371#line 4
17372  allow hal_memtrack_server hidl_base_hwservice:hwservice_manager add;
17373#line 4
17374  neverallow { domain -hal_memtrack_server } hal_memtrack_hwservice:hwservice_manager add;
17375#line 4
17376
17377#line 4
17378
17379#line 4
17380
17381#line 4
17382    neverallow { domain -hal_memtrack_client -hal_memtrack_server } hal_memtrack_hwservice:hwservice_manager find;
17383#line 4
17384
17385#line 4
17386
17387#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_neuralnetworks.te"
17388# HwBinder IPC from client to server, and callbacks
17389
17390#line 2
17391# Call the server domain and optionally transfer references to it.
17392#line 2
17393allow hal_neuralnetworks_client hal_neuralnetworks_server:binder { call transfer };
17394#line 2
17395# Allow the serverdomain to transfer references to the client on the reply.
17396#line 2
17397allow hal_neuralnetworks_server hal_neuralnetworks_client:binder transfer;
17398#line 2
17399# Receive and use open files from the server.
17400#line 2
17401allow hal_neuralnetworks_client hal_neuralnetworks_server:fd use;
17402#line 2
17403
17404
17405#line 3
17406# Call the server domain and optionally transfer references to it.
17407#line 3
17408allow hal_neuralnetworks_server hal_neuralnetworks_client:binder { call transfer };
17409#line 3
17410# Allow the serverdomain to transfer references to the client on the reply.
17411#line 3
17412allow hal_neuralnetworks_client hal_neuralnetworks_server:binder transfer;
17413#line 3
17414# Receive and use open files from the server.
17415#line 3
17416allow hal_neuralnetworks_server hal_neuralnetworks_client:fd use;
17417#line 3
17418
17419
17420
17421#line 5
17422  allow hal_neuralnetworks_client hal_neuralnetworks_hwservice:hwservice_manager find;
17423#line 5
17424
17425#line 5
17426  allow hal_neuralnetworks_server hal_neuralnetworks_hwservice:hwservice_manager { add find };
17427#line 5
17428  allow hal_neuralnetworks_server hidl_base_hwservice:hwservice_manager add;
17429#line 5
17430  neverallow { domain -hal_neuralnetworks_server } hal_neuralnetworks_hwservice:hwservice_manager add;
17431#line 5
17432
17433#line 5
17434
17435#line 5
17436
17437#line 5
17438    neverallow { domain -hal_neuralnetworks_client -hal_neuralnetworks_server } hal_neuralnetworks_hwservice:hwservice_manager find;
17439#line 5
17440
17441#line 5
17442
17443allow hal_neuralnetworks hidl_memory_hwservice:hwservice_manager find;
17444allow hal_neuralnetworks hal_allocator:fd use;
17445
17446# Allow NN HAL service to use a client-provided fd residing in /data/data/.
17447allow hal_neuralnetworks_server app_data_file:file { read write getattr map };
17448allow hal_neuralnetworks_server privapp_data_file:file { read write getattr map };
17449
17450# Allow NN HAL service to use a client-provided fd residing in /data/local/tmp/.
17451allow hal_neuralnetworks_server shell_data_file:file { read write getattr map };
17452
17453# Allow NN HAL client to check the ro.nnapi.extensions.deny_on_product
17454# property to determine whether to deny NNAPI extensions use for apps
17455# on product partition (apps in GSI are not allowed to use NNAPI extensions).
17456
17457#line 19
17458allow hal_neuralnetworks_client nnapi_ext_deny_product_prop:file { getattr open read map };
17459#line 19
17460;
17461# This property is only expected to be found in /product/build.prop,
17462# allow to be set only by init.
17463neverallow { domain -init } nnapi_ext_deny_product_prop:property_service set;
17464#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_neverallows.te"
17465# only HALs responsible for network hardware should have privileged
17466# network capabilities
17467neverallow {
17468  halserverdomain
17469  -hal_bluetooth_server
17470  -hal_wifi_server
17471  -hal_wifi_hostapd_server
17472  -hal_wifi_supplicant_server
17473  -hal_telephony_server
17474} self:{ capability cap_userns } { net_admin net_raw };
17475
17476# Unless a HAL's job is to communicate over the network, or control network
17477# hardware, it should not be using network sockets.
17478# NOTE: HALs for automotive devices have an exemption from this rule because in
17479# a car it is common to have external modules and HALs need to communicate to
17480# those modules using network.  Using this exemption for non-automotive builds
17481# will result in CTS failure.
17482neverallow {
17483  halserverdomain
17484  -hal_automotive_socket_exemption
17485  -hal_tetheroffload_server
17486  -hal_wifi_server
17487  -hal_wifi_hostapd_server
17488  -hal_wifi_supplicant_server
17489  -hal_telephony_server
17490} domain:{ tcp_socket udp_socket rawip_socket } *;
17491
17492###
17493# HALs are defined as an attribute and so a given domain could hypothetically
17494# have multiple HALs in it (or even all of them) with the subsequent policy of
17495# the domain comprised of the union of all the HALs.
17496#
17497# This is a problem because
17498# 1) Security sensitive components should only be accessed by specific HALs.
17499# 2) hwbinder_call and the restrictions it provides cannot be reasoned about in
17500#    the platform.
17501# 3) The platform cannot reason about defense in depth if there are
17502#    monolithic domains etc.
17503#
17504# As an example, hal_keymaster and hal_gatekeeper can access the TEE and while
17505# its OK for them to share a process its not OK with them to share processes
17506# with other hals.
17507#
17508# The following neverallow rules, in conjuntion with CTS tests, assert that
17509# these security principles are adhered to.
17510#
17511# Do not allow a hal to exec another process without a domain transition.
17512# TODO remove exemptions.
17513neverallow {
17514  halserverdomain
17515  -hal_dumpstate_server
17516  -hal_telephony_server
17517} { file_type fs_type }:file execute_no_trans;
17518# Do not allow a process other than init to transition into a HAL domain.
17519neverallow { domain -init } halserverdomain:process transition;
17520# Only allow transitioning to a domain by running its executable. Do not
17521# allow transitioning into a HAL domain by use of seclabel in an
17522# init.*.rc script.
17523neverallow * halserverdomain:process dyntransition;
17524#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_nfc.te"
17525# HwBinder IPC from client to server, and callbacks
17526
17527#line 2
17528# Call the server domain and optionally transfer references to it.
17529#line 2
17530allow hal_nfc_client hal_nfc_server:binder { call transfer };
17531#line 2
17532# Allow the serverdomain to transfer references to the client on the reply.
17533#line 2
17534allow hal_nfc_server hal_nfc_client:binder transfer;
17535#line 2
17536# Receive and use open files from the server.
17537#line 2
17538allow hal_nfc_client hal_nfc_server:fd use;
17539#line 2
17540
17541
17542#line 3
17543# Call the server domain and optionally transfer references to it.
17544#line 3
17545allow hal_nfc_server hal_nfc_client:binder { call transfer };
17546#line 3
17547# Allow the serverdomain to transfer references to the client on the reply.
17548#line 3
17549allow hal_nfc_client hal_nfc_server:binder transfer;
17550#line 3
17551# Receive and use open files from the server.
17552#line 3
17553allow hal_nfc_server hal_nfc_client:fd use;
17554#line 3
17555
17556
17557
17558#line 5
17559  allow hal_nfc_client hal_nfc_hwservice:hwservice_manager find;
17560#line 5
17561
17562#line 5
17563  allow hal_nfc_server hal_nfc_hwservice:hwservice_manager { add find };
17564#line 5
17565  allow hal_nfc_server hidl_base_hwservice:hwservice_manager add;
17566#line 5
17567  neverallow { domain -hal_nfc_server } hal_nfc_hwservice:hwservice_manager add;
17568#line 5
17569
17570#line 5
17571
17572#line 5
17573
17574#line 5
17575    neverallow { domain -hal_nfc_client -hal_nfc_server } hal_nfc_hwservice:hwservice_manager find;
17576#line 5
17577
17578#line 5
17579
17580
17581# Set NFC properties (used by bcm2079x HAL).
17582
17583#line 8
17584
17585#line 8
17586allow hal_nfc property_socket:sock_file write;
17587#line 8
17588allow hal_nfc init:unix_stream_socket connectto;
17589#line 8
17590
17591#line 8
17592allow hal_nfc nfc_prop:property_service set;
17593#line 8
17594
17595#line 8
17596allow hal_nfc nfc_prop:file { getattr open read map };
17597#line 8
17598
17599#line 8
17600
17601
17602# NFC device access.
17603allow hal_nfc nfc_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
17604#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_oemlock.te"
17605# HwBinder IPC from client to server
17606
17607#line 2
17608# Call the server domain and optionally transfer references to it.
17609#line 2
17610allow hal_oemlock_client hal_oemlock_server:binder { call transfer };
17611#line 2
17612# Allow the serverdomain to transfer references to the client on the reply.
17613#line 2
17614allow hal_oemlock_server hal_oemlock_client:binder transfer;
17615#line 2
17616# Receive and use open files from the server.
17617#line 2
17618allow hal_oemlock_client hal_oemlock_server:fd use;
17619#line 2
17620
17621
17622
17623#line 4
17624  allow hal_oemlock_client hal_oemlock_hwservice:hwservice_manager find;
17625#line 4
17626
17627#line 4
17628  allow hal_oemlock_server hal_oemlock_hwservice:hwservice_manager { add find };
17629#line 4
17630  allow hal_oemlock_server hidl_base_hwservice:hwservice_manager add;
17631#line 4
17632  neverallow { domain -hal_oemlock_server } hal_oemlock_hwservice:hwservice_manager add;
17633#line 4
17634
17635#line 4
17636
17637#line 4
17638
17639#line 4
17640    neverallow { domain -hal_oemlock_client -hal_oemlock_server } hal_oemlock_hwservice:hwservice_manager find;
17641#line 4
17642
17643#line 4
17644
17645#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_omx.te"
17646# applies all permissions to hal_omx NOT hal_omx_server
17647# since OMX must always be in its own process.
17648
17649
17650#line 4
17651# Call the server domain and optionally transfer references to it.
17652#line 4
17653allow hal_omx_server binderservicedomain:binder { call transfer };
17654#line 4
17655# Allow the serverdomain to transfer references to the client on the reply.
17656#line 4
17657allow binderservicedomain hal_omx_server:binder transfer;
17658#line 4
17659# Receive and use open files from the server.
17660#line 4
17661allow hal_omx_server binderservicedomain:fd use;
17662#line 4
17663
17664
17665#line 5
17666# Call the server domain and optionally transfer references to it.
17667#line 5
17668allow hal_omx_server { appdomain -isolated_app }:binder { call transfer };
17669#line 5
17670# Allow the serverdomain to transfer references to the client on the reply.
17671#line 5
17672allow { appdomain -isolated_app } hal_omx_server:binder transfer;
17673#line 5
17674# Receive and use open files from the server.
17675#line 5
17676allow hal_omx_server { appdomain -isolated_app }:fd use;
17677#line 5
17678
17679
17680# Allow hal_omx_server access to composer sync fences
17681allow hal_omx_server hal_graphics_composer:fd use;
17682
17683allow hal_omx_server ion_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
17684allow hal_omx_server hal_camera:fd use;
17685
17686
17687#line 13
17688
17689#line 13
17690allow hal_omx_server anr_data_file:file append;
17691#line 13
17692allow hal_omx_server dumpstate:fd use;
17693#line 13
17694allow hal_omx_server incidentd:fd use;
17695#line 13
17696# TODO: Figure out why write is needed.
17697#line 13
17698allow hal_omx_server dumpstate:fifo_file { append write };
17699#line 13
17700allow hal_omx_server incidentd:fifo_file { append write };
17701#line 13
17702allow hal_omx_server system_server:fifo_file { append write };
17703#line 13
17704allow hal_omx_server tombstoned:unix_stream_socket connectto;
17705#line 13
17706allow hal_omx_server tombstoned:fd use;
17707#line 13
17708allow hal_omx_server tombstoned_crash_socket:sock_file write;
17709#line 13
17710allow hal_omx_server tombstone_data_file:file append;
17711#line 13
17712
17713
17714# Recieve gralloc buffer FDs from bufferhubd. Note that hal_omx_server never
17715# directly connects to bufferhubd via PDX. Instead, a VR app acts as a bridge
17716# between those two: it talks to hal_omx_server via Binder and talks to bufferhubd
17717# via PDX. Thus, there is no need to use pdx_client macro.
17718allow hal_omx_server bufferhubd:fd use;
17719
17720
17721#line 21
17722  allow hal_omx_client hal_omx_hwservice:hwservice_manager find;
17723#line 21
17724
17725#line 21
17726  allow hal_omx_server hal_omx_hwservice:hwservice_manager { add find };
17727#line 21
17728  allow hal_omx_server hidl_base_hwservice:hwservice_manager add;
17729#line 21
17730  neverallow { domain -hal_omx_server } hal_omx_hwservice:hwservice_manager add;
17731#line 21
17732
17733#line 21
17734
17735#line 21
17736
17737#line 21
17738    neverallow { domain -hal_omx_client -hal_omx_server } hal_omx_hwservice:hwservice_manager find;
17739#line 21
17740
17741#line 21
17742
17743
17744allow hal_omx_client hidl_token_hwservice:hwservice_manager find;
17745
17746
17747#line 25
17748# Call the server domain and optionally transfer references to it.
17749#line 25
17750allow hal_omx_client hal_omx_server:binder { call transfer };
17751#line 25
17752# Allow the serverdomain to transfer references to the client on the reply.
17753#line 25
17754allow hal_omx_server hal_omx_client:binder transfer;
17755#line 25
17756# Receive and use open files from the server.
17757#line 25
17758allow hal_omx_client hal_omx_server:fd use;
17759#line 25
17760
17761
17762#line 26
17763# Call the server domain and optionally transfer references to it.
17764#line 26
17765allow hal_omx_server hal_omx_client:binder { call transfer };
17766#line 26
17767# Allow the serverdomain to transfer references to the client on the reply.
17768#line 26
17769allow hal_omx_client hal_omx_server:binder transfer;
17770#line 26
17771# Receive and use open files from the server.
17772#line 26
17773allow hal_omx_server hal_omx_client:fd use;
17774#line 26
17775
17776
17777###
17778### neverallow rules
17779###
17780
17781# hal_omx_server should never execute any executable without a
17782# domain transition
17783neverallow hal_omx_server { file_type fs_type }:file execute_no_trans;
17784
17785# The goal of the mediaserver split is to place media processing code into
17786# restrictive sandboxes with limited responsibilities and thus limited
17787# permissions. Example: Audioserver is only responsible for controlling audio
17788# hardware and processing audio content. Cameraserver does the same for camera
17789# hardware/content. Etc.
17790#
17791# Media processing code is inherently risky and thus should have limited
17792# permissions and be isolated from the rest of the system and network.
17793# Lengthier explanation here:
17794# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
17795neverallow hal_omx_server domain:{ tcp_socket udp_socket rawip_socket } *;
17796#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_power.te"
17797# HwBinder IPC from client to server, and callbacks
17798
17799#line 2
17800# Call the server domain and optionally transfer references to it.
17801#line 2
17802allow hal_power_client hal_power_server:binder { call transfer };
17803#line 2
17804# Allow the serverdomain to transfer references to the client on the reply.
17805#line 2
17806allow hal_power_server hal_power_client:binder transfer;
17807#line 2
17808# Receive and use open files from the server.
17809#line 2
17810allow hal_power_client hal_power_server:fd use;
17811#line 2
17812
17813
17814#line 3
17815# Call the server domain and optionally transfer references to it.
17816#line 3
17817allow hal_power_server hal_power_client:binder { call transfer };
17818#line 3
17819# Allow the serverdomain to transfer references to the client on the reply.
17820#line 3
17821allow hal_power_client hal_power_server:binder transfer;
17822#line 3
17823# Receive and use open files from the server.
17824#line 3
17825allow hal_power_server hal_power_client:fd use;
17826#line 3
17827
17828
17829
17830#line 5
17831  allow hal_power_client hal_power_hwservice:hwservice_manager find;
17832#line 5
17833
17834#line 5
17835  allow hal_power_server hal_power_hwservice:hwservice_manager { add find };
17836#line 5
17837  allow hal_power_server hidl_base_hwservice:hwservice_manager add;
17838#line 5
17839  neverallow { domain -hal_power_server } hal_power_hwservice:hwservice_manager add;
17840#line 5
17841
17842#line 5
17843
17844#line 5
17845
17846#line 5
17847    neverallow { domain -hal_power_client -hal_power_server } hal_power_hwservice:hwservice_manager find;
17848#line 5
17849
17850#line 5
17851
17852#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_power_stats.te"
17853# HwBinder IPC from client to server, and callbacks
17854
17855#line 2
17856# Call the server domain and optionally transfer references to it.
17857#line 2
17858allow hal_power_stats_client hal_power_stats_server:binder { call transfer };
17859#line 2
17860# Allow the serverdomain to transfer references to the client on the reply.
17861#line 2
17862allow hal_power_stats_server hal_power_stats_client:binder transfer;
17863#line 2
17864# Receive and use open files from the server.
17865#line 2
17866allow hal_power_stats_client hal_power_stats_server:fd use;
17867#line 2
17868
17869
17870#line 3
17871# Call the server domain and optionally transfer references to it.
17872#line 3
17873allow hal_power_stats_server hal_power_stats_client:binder { call transfer };
17874#line 3
17875# Allow the serverdomain to transfer references to the client on the reply.
17876#line 3
17877allow hal_power_stats_client hal_power_stats_server:binder transfer;
17878#line 3
17879# Receive and use open files from the server.
17880#line 3
17881allow hal_power_stats_server hal_power_stats_client:fd use;
17882#line 3
17883
17884
17885
17886#line 5
17887  allow hal_power_stats_client hal_power_stats_hwservice:hwservice_manager find;
17888#line 5
17889
17890#line 5
17891  allow hal_power_stats_server hal_power_stats_hwservice:hwservice_manager { add find };
17892#line 5
17893  allow hal_power_stats_server hidl_base_hwservice:hwservice_manager add;
17894#line 5
17895  neverallow { domain -hal_power_stats_server } hal_power_stats_hwservice:hwservice_manager add;
17896#line 5
17897
17898#line 5
17899
17900#line 5
17901
17902#line 5
17903    neverallow { domain -hal_power_stats_client -hal_power_stats_server } hal_power_stats_hwservice:hwservice_manager find;
17904#line 5
17905
17906#line 5
17907
17908#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_secure_element.te"
17909# HwBinder IPC from client to server, and callbacks
17910
17911#line 2
17912# Call the server domain and optionally transfer references to it.
17913#line 2
17914allow hal_secure_element_client hal_secure_element_server:binder { call transfer };
17915#line 2
17916# Allow the serverdomain to transfer references to the client on the reply.
17917#line 2
17918allow hal_secure_element_server hal_secure_element_client:binder transfer;
17919#line 2
17920# Receive and use open files from the server.
17921#line 2
17922allow hal_secure_element_client hal_secure_element_server:fd use;
17923#line 2
17924
17925
17926#line 3
17927# Call the server domain and optionally transfer references to it.
17928#line 3
17929allow hal_secure_element_server hal_secure_element_client:binder { call transfer };
17930#line 3
17931# Allow the serverdomain to transfer references to the client on the reply.
17932#line 3
17933allow hal_secure_element_client hal_secure_element_server:binder transfer;
17934#line 3
17935# Receive and use open files from the server.
17936#line 3
17937allow hal_secure_element_server hal_secure_element_client:fd use;
17938#line 3
17939
17940
17941
17942#line 5
17943  allow hal_secure_element_client hal_secure_element_hwservice:hwservice_manager find;
17944#line 5
17945
17946#line 5
17947  allow hal_secure_element_server hal_secure_element_hwservice:hwservice_manager { add find };
17948#line 5
17949  allow hal_secure_element_server hidl_base_hwservice:hwservice_manager add;
17950#line 5
17951  neverallow { domain -hal_secure_element_server } hal_secure_element_hwservice:hwservice_manager add;
17952#line 5
17953
17954#line 5
17955
17956#line 5
17957
17958#line 5
17959    neverallow { domain -hal_secure_element_client -hal_secure_element_server } hal_secure_element_hwservice:hwservice_manager find;
17960#line 5
17961
17962#line 5
17963
17964#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_sensors.te"
17965# HwBinder IPC from client to server
17966
17967#line 2
17968# Call the server domain and optionally transfer references to it.
17969#line 2
17970allow hal_sensors_client hal_sensors_server:binder { call transfer };
17971#line 2
17972# Allow the serverdomain to transfer references to the client on the reply.
17973#line 2
17974allow hal_sensors_server hal_sensors_client:binder transfer;
17975#line 2
17976# Receive and use open files from the server.
17977#line 2
17978allow hal_sensors_client hal_sensors_server:fd use;
17979#line 2
17980
17981
17982
17983#line 4
17984  allow hal_sensors_client hal_sensors_hwservice:hwservice_manager find;
17985#line 4
17986
17987#line 4
17988  allow hal_sensors_server hal_sensors_hwservice:hwservice_manager { add find };
17989#line 4
17990  allow hal_sensors_server hidl_base_hwservice:hwservice_manager add;
17991#line 4
17992  neverallow { domain -hal_sensors_server } hal_sensors_hwservice:hwservice_manager add;
17993#line 4
17994
17995#line 4
17996
17997#line 4
17998
17999#line 4
18000    neverallow { domain -hal_sensors_client -hal_sensors_server } hal_sensors_hwservice:hwservice_manager find;
18001#line 4
18002
18003#line 4
18004
18005
18006# Allow sensor hals to access ashmem memory allocated by apps
18007allow hal_sensors { appdomain -isolated_app }:fd use;
18008
18009# Allow sensor hals to access ashmem memory allocated by android.hidl.allocator
18010# fd is passed in from framework sensorservice HAL.
18011allow hal_sensors hal_allocator:fd use;
18012
18013# allow to run with real-time scheduling policy
18014allow hal_sensors self:{ capability cap_userns } sys_nice;
18015#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_telephony.te"
18016# HwBinder IPC from client to server, and callbacks
18017
18018#line 2
18019# Call the server domain and optionally transfer references to it.
18020#line 2
18021allow hal_telephony_client hal_telephony_server:binder { call transfer };
18022#line 2
18023# Allow the serverdomain to transfer references to the client on the reply.
18024#line 2
18025allow hal_telephony_server hal_telephony_client:binder transfer;
18026#line 2
18027# Receive and use open files from the server.
18028#line 2
18029allow hal_telephony_client hal_telephony_server:fd use;
18030#line 2
18031
18032
18033#line 3
18034# Call the server domain and optionally transfer references to it.
18035#line 3
18036allow hal_telephony_server hal_telephony_client:binder { call transfer };
18037#line 3
18038# Allow the serverdomain to transfer references to the client on the reply.
18039#line 3
18040allow hal_telephony_client hal_telephony_server:binder transfer;
18041#line 3
18042# Receive and use open files from the server.
18043#line 3
18044allow hal_telephony_server hal_telephony_client:fd use;
18045#line 3
18046
18047
18048
18049#line 5
18050  allow hal_telephony_client hal_telephony_hwservice:hwservice_manager find;
18051#line 5
18052
18053#line 5
18054  allow hal_telephony_server hal_telephony_hwservice:hwservice_manager { add find };
18055#line 5
18056  allow hal_telephony_server hidl_base_hwservice:hwservice_manager add;
18057#line 5
18058  neverallow { domain -hal_telephony_server } hal_telephony_hwservice:hwservice_manager add;
18059#line 5
18060
18061#line 5
18062
18063#line 5
18064
18065#line 5
18066    neverallow { domain -hal_telephony_client -hal_telephony_server } hal_telephony_hwservice:hwservice_manager find;
18067#line 5
18068
18069#line 5
18070
18071
18072allowxperm hal_telephony_server self:udp_socket ioctl
18073#line 7
18074{
18075#line 7
18076# qualcomm rmnet ioctls
18077#line 7
180780x00006900 0x00006902
18079#line 7
18080# socket ioctls
18081#line 7
180820x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
18083#line 7
180840x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
18085#line 7
180860x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
18087#line 7
180880x00008927 0x00008929 0x00008930 0x00008931 0x00008932
18089#line 7
180900x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
18091#line 7
180920x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
18093#line 7
180940x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
18095#line 7
180960x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
18097#line 7
180980x00008991 0x00008992 0x00008993 0x00008994
18099#line 7
181000x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
18101#line 7
18102# device and protocol specific ioctls
18103#line 7
181040x000089f0-0x000089ff
18105#line 7
181060x000089e0-0x000089ef
18107#line 7
18108# Wireless extension ioctls
18109#line 7
181100x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
18111#line 7
181120x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
18113#line 7
181140x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
18115#line 7
181160x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
18117#line 7
181180x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
18119#line 7
181200x00008b34 0x00008b35 0x00008b36
18121#line 7
18122# Dev private ioctl i.e. hardware specific ioctls
18123#line 7
181240x00008be0-0x00008bff
18125#line 7
18126};
18127
18128allow hal_telephony_server self:netlink_route_socket nlmsg_write;
18129allow hal_telephony_server kernel:system module_request;
18130allow hal_telephony_server self:{ capability cap_userns } { setpcap setgid setuid net_admin net_raw };
18131allow hal_telephony_server cgroup:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
18132allow hal_telephony_server cgroup:{ file lnk_file } { getattr open read ioctl lock map };
18133allow hal_telephony_server radio_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
18134allow hal_telephony_server radio_device:blk_file { getattr open read ioctl lock map };
18135allow hal_telephony_server efs_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
18136allow hal_telephony_server efs_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
18137allow hal_telephony_server vendor_shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
18138allow hal_telephony_server bluetooth_efs_file:file { getattr open read ioctl lock map };
18139allow hal_telephony_server bluetooth_efs_file:dir { open getattr read search ioctl lock };
18140
18141# property service
18142
18143#line 23
18144
18145#line 23
18146allow hal_telephony_server property_socket:sock_file write;
18147#line 23
18148allow hal_telephony_server init:unix_stream_socket connectto;
18149#line 23
18150
18151#line 23
18152allow hal_telephony_server radio_prop:property_service set;
18153#line 23
18154
18155#line 23
18156allow hal_telephony_server radio_prop:file { getattr open read map };
18157#line 23
18158
18159#line 23
18160
18161
18162#line 24
18163
18164#line 24
18165allow hal_telephony_server property_socket:sock_file write;
18166#line 24
18167allow hal_telephony_server init:unix_stream_socket connectto;
18168#line 24
18169
18170#line 24
18171allow hal_telephony_server exported_radio_prop:property_service set;
18172#line 24
18173
18174#line 24
18175allow hal_telephony_server exported_radio_prop:file { getattr open read map };
18176#line 24
18177
18178#line 24
18179
18180
18181#line 25
18182
18183#line 25
18184allow hal_telephony_server property_socket:sock_file write;
18185#line 25
18186allow hal_telephony_server init:unix_stream_socket connectto;
18187#line 25
18188
18189#line 25
18190allow hal_telephony_server exported2_radio_prop:property_service set;
18191#line 25
18192
18193#line 25
18194allow hal_telephony_server exported2_radio_prop:file { getattr open read map };
18195#line 25
18196
18197#line 25
18198
18199
18200#line 26
18201
18202#line 26
18203allow hal_telephony_server property_socket:sock_file write;
18204#line 26
18205allow hal_telephony_server init:unix_stream_socket connectto;
18206#line 26
18207
18208#line 26
18209allow hal_telephony_server exported3_radio_prop:property_service set;
18210#line 26
18211
18212#line 26
18213allow hal_telephony_server exported3_radio_prop:file { getattr open read map };
18214#line 26
18215
18216#line 26
18217
18218
18219allow hal_telephony_server tty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
18220
18221# Allow hal_telephony_server to create and use netlink sockets.
18222allow hal_telephony_server self:netlink_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
18223allow hal_telephony_server self:netlink_generic_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
18224allow hal_telephony_server self:netlink_kobject_uevent_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
18225
18226# Access to wake locks
18227
18228#line 36
18229# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
18230#line 36
18231# deprecated.
18232#line 36
18233# Access /sys/power/wake_lock and /sys/power/wake_unlock
18234#line 36
18235allow hal_telephony_server sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
18236#line 36
18237# Accessing these files requires CAP_BLOCK_SUSPEND
18238#line 36
18239allow hal_telephony_server self:{ capability2 cap2_userns } block_suspend;
18240#line 36
18241# system_suspend permissions
18242#line 36
18243
18244#line 36
18245# Call the server domain and optionally transfer references to it.
18246#line 36
18247allow hal_telephony_server system_suspend_server:binder { call transfer };
18248#line 36
18249# Allow the serverdomain to transfer references to the client on the reply.
18250#line 36
18251allow system_suspend_server hal_telephony_server:binder transfer;
18252#line 36
18253# Receive and use open files from the server.
18254#line 36
18255allow hal_telephony_server system_suspend_server:fd use;
18256#line 36
18257
18258#line 36
18259allow hal_telephony_server system_suspend_hwservice:hwservice_manager find;
18260#line 36
18261# halclientdomain permissions
18262#line 36
18263
18264#line 36
18265# Call the hwservicemanager and transfer references to it.
18266#line 36
18267allow hal_telephony_server hwservicemanager:binder { call transfer };
18268#line 36
18269# Allow hwservicemanager to send out callbacks
18270#line 36
18271allow hwservicemanager hal_telephony_server:binder { call transfer };
18272#line 36
18273# hwservicemanager performs getpidcon on clients.
18274#line 36
18275allow hwservicemanager hal_telephony_server:dir search;
18276#line 36
18277allow hwservicemanager hal_telephony_server:file { read open map };
18278#line 36
18279allow hwservicemanager hal_telephony_server:process getattr;
18280#line 36
18281# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
18282#line 36
18283# all domains in domain.te.
18284#line 36
18285
18286#line 36
18287
18288#line 36
18289allow hal_telephony_server hwservicemanager_prop:file { getattr open read map };
18290#line 36
18291
18292#line 36
18293allow hal_telephony_server hidl_manager_hwservice:hwservice_manager find;
18294#line 36
18295
18296
18297
18298#line 38
18299allow hal_telephony_server proc_net_type:dir { open getattr read search ioctl lock };
18300#line 38
18301allow hal_telephony_server proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
18302#line 38
18303
18304
18305#line 39
18306allow hal_telephony_server sysfs_type:dir { open getattr read search ioctl lock };
18307#line 39
18308allow hal_telephony_server sysfs_type:{ file lnk_file } { getattr open read ioctl lock map };
18309#line 39
18310
18311
18312# granting the ioctl permission for hal_telephony_server should be device specific
18313allow hal_telephony_server self:socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
18314#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_tetheroffload.te"
18315## HwBinder IPC from client to server, and callbacks
18316
18317#line 2
18318# Call the server domain and optionally transfer references to it.
18319#line 2
18320allow hal_tetheroffload_client hal_tetheroffload_server:binder { call transfer };
18321#line 2
18322# Allow the serverdomain to transfer references to the client on the reply.
18323#line 2
18324allow hal_tetheroffload_server hal_tetheroffload_client:binder transfer;
18325#line 2
18326# Receive and use open files from the server.
18327#line 2
18328allow hal_tetheroffload_client hal_tetheroffload_server:fd use;
18329#line 2
18330
18331
18332#line 3
18333# Call the server domain and optionally transfer references to it.
18334#line 3
18335allow hal_tetheroffload_server hal_tetheroffload_client:binder { call transfer };
18336#line 3
18337# Allow the serverdomain to transfer references to the client on the reply.
18338#line 3
18339allow hal_tetheroffload_client hal_tetheroffload_server:binder transfer;
18340#line 3
18341# Receive and use open files from the server.
18342#line 3
18343allow hal_tetheroffload_server hal_tetheroffload_client:fd use;
18344#line 3
18345
18346
18347
18348#line 5
18349  allow hal_tetheroffload_client hal_tetheroffload_hwservice:hwservice_manager find;
18350#line 5
18351
18352#line 5
18353  allow hal_tetheroffload_server hal_tetheroffload_hwservice:hwservice_manager { add find };
18354#line 5
18355  allow hal_tetheroffload_server hidl_base_hwservice:hwservice_manager add;
18356#line 5
18357  neverallow { domain -hal_tetheroffload_server } hal_tetheroffload_hwservice:hwservice_manager add;
18358#line 5
18359
18360#line 5
18361
18362#line 5
18363
18364#line 5
18365    neverallow { domain -hal_tetheroffload_client -hal_tetheroffload_server } hal_tetheroffload_hwservice:hwservice_manager find;
18366#line 5
18367
18368#line 5
18369
18370
18371# allow the client to pass the server already open netlink sockets
18372allow hal_tetheroffload_server hal_tetheroffload_client:netlink_netfilter_socket { getattr read setopt write };
18373#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_thermal.te"
18374# HwBinder IPC from client to server, and callbacks
18375
18376#line 2
18377# Call the server domain and optionally transfer references to it.
18378#line 2
18379allow hal_thermal_client hal_thermal_server:binder { call transfer };
18380#line 2
18381# Allow the serverdomain to transfer references to the client on the reply.
18382#line 2
18383allow hal_thermal_server hal_thermal_client:binder transfer;
18384#line 2
18385# Receive and use open files from the server.
18386#line 2
18387allow hal_thermal_client hal_thermal_server:fd use;
18388#line 2
18389
18390
18391#line 3
18392# Call the server domain and optionally transfer references to it.
18393#line 3
18394allow hal_thermal_server hal_thermal_client:binder { call transfer };
18395#line 3
18396# Allow the serverdomain to transfer references to the client on the reply.
18397#line 3
18398allow hal_thermal_client hal_thermal_server:binder transfer;
18399#line 3
18400# Receive and use open files from the server.
18401#line 3
18402allow hal_thermal_server hal_thermal_client:fd use;
18403#line 3
18404
18405
18406
18407#line 5
18408  allow hal_thermal_client hal_thermal_hwservice:hwservice_manager find;
18409#line 5
18410
18411#line 5
18412  allow hal_thermal_server hal_thermal_hwservice:hwservice_manager { add find };
18413#line 5
18414  allow hal_thermal_server hidl_base_hwservice:hwservice_manager add;
18415#line 5
18416  neverallow { domain -hal_thermal_server } hal_thermal_hwservice:hwservice_manager add;
18417#line 5
18418
18419#line 5
18420
18421#line 5
18422
18423#line 5
18424    neverallow { domain -hal_thermal_client -hal_thermal_server } hal_thermal_hwservice:hwservice_manager find;
18425#line 5
18426
18427#line 5
18428
18429#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_tv_cec.te"
18430# HwBinder IPC from clients into server, and callbacks
18431
18432#line 2
18433# Call the server domain and optionally transfer references to it.
18434#line 2
18435allow hal_tv_cec_client hal_tv_cec_server:binder { call transfer };
18436#line 2
18437# Allow the serverdomain to transfer references to the client on the reply.
18438#line 2
18439allow hal_tv_cec_server hal_tv_cec_client:binder transfer;
18440#line 2
18441# Receive and use open files from the server.
18442#line 2
18443allow hal_tv_cec_client hal_tv_cec_server:fd use;
18444#line 2
18445
18446
18447#line 3
18448# Call the server domain and optionally transfer references to it.
18449#line 3
18450allow hal_tv_cec_server hal_tv_cec_client:binder { call transfer };
18451#line 3
18452# Allow the serverdomain to transfer references to the client on the reply.
18453#line 3
18454allow hal_tv_cec_client hal_tv_cec_server:binder transfer;
18455#line 3
18456# Receive and use open files from the server.
18457#line 3
18458allow hal_tv_cec_server hal_tv_cec_client:fd use;
18459#line 3
18460
18461
18462
18463#line 5
18464  allow hal_tv_cec_client hal_tv_cec_hwservice:hwservice_manager find;
18465#line 5
18466
18467#line 5
18468  allow hal_tv_cec_server hal_tv_cec_hwservice:hwservice_manager { add find };
18469#line 5
18470  allow hal_tv_cec_server hidl_base_hwservice:hwservice_manager add;
18471#line 5
18472  neverallow { domain -hal_tv_cec_server } hal_tv_cec_hwservice:hwservice_manager add;
18473#line 5
18474
18475#line 5
18476
18477#line 5
18478
18479#line 5
18480    neverallow { domain -hal_tv_cec_client -hal_tv_cec_server } hal_tv_cec_hwservice:hwservice_manager find;
18481#line 5
18482
18483#line 5
18484
18485#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_tv_input.te"
18486# HwBinder IPC from clients into server, and callbacks
18487
18488#line 2
18489# Call the server domain and optionally transfer references to it.
18490#line 2
18491allow hal_tv_input_client hal_tv_input_server:binder { call transfer };
18492#line 2
18493# Allow the serverdomain to transfer references to the client on the reply.
18494#line 2
18495allow hal_tv_input_server hal_tv_input_client:binder transfer;
18496#line 2
18497# Receive and use open files from the server.
18498#line 2
18499allow hal_tv_input_client hal_tv_input_server:fd use;
18500#line 2
18501
18502
18503#line 3
18504# Call the server domain and optionally transfer references to it.
18505#line 3
18506allow hal_tv_input_server hal_tv_input_client:binder { call transfer };
18507#line 3
18508# Allow the serverdomain to transfer references to the client on the reply.
18509#line 3
18510allow hal_tv_input_client hal_tv_input_server:binder transfer;
18511#line 3
18512# Receive and use open files from the server.
18513#line 3
18514allow hal_tv_input_server hal_tv_input_client:fd use;
18515#line 3
18516
18517
18518
18519#line 5
18520  allow hal_tv_input_client hal_tv_input_hwservice:hwservice_manager find;
18521#line 5
18522
18523#line 5
18524  allow hal_tv_input_server hal_tv_input_hwservice:hwservice_manager { add find };
18525#line 5
18526  allow hal_tv_input_server hidl_base_hwservice:hwservice_manager add;
18527#line 5
18528  neverallow { domain -hal_tv_input_server } hal_tv_input_hwservice:hwservice_manager add;
18529#line 5
18530
18531#line 5
18532
18533#line 5
18534
18535#line 5
18536    neverallow { domain -hal_tv_input_client -hal_tv_input_server } hal_tv_input_hwservice:hwservice_manager find;
18537#line 5
18538
18539#line 5
18540
18541#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_usb.te"
18542# HwBinder IPC from client to server, and callbacks
18543
18544#line 2
18545# Call the server domain and optionally transfer references to it.
18546#line 2
18547allow hal_usb_client hal_usb_server:binder { call transfer };
18548#line 2
18549# Allow the serverdomain to transfer references to the client on the reply.
18550#line 2
18551allow hal_usb_server hal_usb_client:binder transfer;
18552#line 2
18553# Receive and use open files from the server.
18554#line 2
18555allow hal_usb_client hal_usb_server:fd use;
18556#line 2
18557
18558
18559#line 3
18560# Call the server domain and optionally transfer references to it.
18561#line 3
18562allow hal_usb_server hal_usb_client:binder { call transfer };
18563#line 3
18564# Allow the serverdomain to transfer references to the client on the reply.
18565#line 3
18566allow hal_usb_client hal_usb_server:binder transfer;
18567#line 3
18568# Receive and use open files from the server.
18569#line 3
18570allow hal_usb_server hal_usb_client:fd use;
18571#line 3
18572
18573
18574
18575#line 5
18576  allow hal_usb_client hal_usb_hwservice:hwservice_manager find;
18577#line 5
18578
18579#line 5
18580  allow hal_usb_server hal_usb_hwservice:hwservice_manager { add find };
18581#line 5
18582  allow hal_usb_server hidl_base_hwservice:hwservice_manager add;
18583#line 5
18584  neverallow { domain -hal_usb_server } hal_usb_hwservice:hwservice_manager add;
18585#line 5
18586
18587#line 5
18588
18589#line 5
18590
18591#line 5
18592    neverallow { domain -hal_usb_client -hal_usb_server } hal_usb_hwservice:hwservice_manager find;
18593#line 5
18594
18595#line 5
18596
18597
18598allow hal_usb self:netlink_kobject_uevent_socket create;
18599allow hal_usb self:netlink_kobject_uevent_socket setopt;
18600allow hal_usb self:netlink_kobject_uevent_socket getopt;
18601allow hal_usb self:netlink_kobject_uevent_socket bind;
18602allow hal_usb self:netlink_kobject_uevent_socket read;
18603allow hal_usb sysfs:dir open;
18604allow hal_usb sysfs:dir read;
18605allow hal_usb sysfs:file read;
18606allow hal_usb sysfs:file open;
18607allow hal_usb sysfs:file write;
18608allow hal_usb sysfs:file getattr;
18609
18610#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_usb_gadget.te"
18611# HwBinder IPC from client to server, and callbacks
18612
18613#line 2
18614# Call the server domain and optionally transfer references to it.
18615#line 2
18616allow hal_usb_gadget_client hal_usb_gadget_server:binder { call transfer };
18617#line 2
18618# Allow the serverdomain to transfer references to the client on the reply.
18619#line 2
18620allow hal_usb_gadget_server hal_usb_gadget_client:binder transfer;
18621#line 2
18622# Receive and use open files from the server.
18623#line 2
18624allow hal_usb_gadget_client hal_usb_gadget_server:fd use;
18625#line 2
18626
18627
18628#line 3
18629# Call the server domain and optionally transfer references to it.
18630#line 3
18631allow hal_usb_gadget_server hal_usb_gadget_client:binder { call transfer };
18632#line 3
18633# Allow the serverdomain to transfer references to the client on the reply.
18634#line 3
18635allow hal_usb_gadget_client hal_usb_gadget_server:binder transfer;
18636#line 3
18637# Receive and use open files from the server.
18638#line 3
18639allow hal_usb_gadget_server hal_usb_gadget_client:fd use;
18640#line 3
18641
18642
18643
18644#line 5
18645  allow hal_usb_gadget_client hal_usb_gadget_hwservice:hwservice_manager find;
18646#line 5
18647
18648#line 5
18649  allow hal_usb_gadget_server hal_usb_gadget_hwservice:hwservice_manager { add find };
18650#line 5
18651  allow hal_usb_gadget_server hidl_base_hwservice:hwservice_manager add;
18652#line 5
18653  neverallow { domain -hal_usb_gadget_server } hal_usb_gadget_hwservice:hwservice_manager add;
18654#line 5
18655
18656#line 5
18657
18658#line 5
18659
18660#line 5
18661    neverallow { domain -hal_usb_gadget_client -hal_usb_gadget_server } hal_usb_gadget_hwservice:hwservice_manager find;
18662#line 5
18663
18664#line 5
18665
18666
18667# Configuring usb gadget functions
18668allow hal_usb_gadget_server configfs:lnk_file { read create unlink};
18669allow hal_usb_gadget_server configfs:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
18670allow hal_usb_gadget_server configfs:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
18671allow hal_usb_gadget_server functionfs:dir { read search };
18672allow hal_usb_gadget_server functionfs:file read;
18673
18674#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_vehicle.te"
18675# HwBinder IPC from client to server, and callbacks
18676
18677#line 2
18678# Call the server domain and optionally transfer references to it.
18679#line 2
18680allow hal_vehicle_client hal_vehicle_server:binder { call transfer };
18681#line 2
18682# Allow the serverdomain to transfer references to the client on the reply.
18683#line 2
18684allow hal_vehicle_server hal_vehicle_client:binder transfer;
18685#line 2
18686# Receive and use open files from the server.
18687#line 2
18688allow hal_vehicle_client hal_vehicle_server:fd use;
18689#line 2
18690
18691
18692#line 3
18693# Call the server domain and optionally transfer references to it.
18694#line 3
18695allow hal_vehicle_server hal_vehicle_client:binder { call transfer };
18696#line 3
18697# Allow the serverdomain to transfer references to the client on the reply.
18698#line 3
18699allow hal_vehicle_client hal_vehicle_server:binder transfer;
18700#line 3
18701# Receive and use open files from the server.
18702#line 3
18703allow hal_vehicle_server hal_vehicle_client:fd use;
18704#line 3
18705
18706
18707
18708
18709#line 6
18710  allow hal_vehicle_client hal_vehicle_hwservice:hwservice_manager find;
18711#line 6
18712
18713#line 6
18714  allow hal_vehicle_server hal_vehicle_hwservice:hwservice_manager { add find };
18715#line 6
18716  allow hal_vehicle_server hidl_base_hwservice:hwservice_manager add;
18717#line 6
18718  neverallow { domain -hal_vehicle_server } hal_vehicle_hwservice:hwservice_manager add;
18719#line 6
18720
18721#line 6
18722
18723#line 6
18724
18725#line 6
18726    neverallow { domain -hal_vehicle_client -hal_vehicle_server } hal_vehicle_hwservice:hwservice_manager find;
18727#line 6
18728
18729#line 6
18730
18731#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_vibrator.te"
18732# HwBinder IPC from client to server
18733
18734#line 2
18735# Call the server domain and optionally transfer references to it.
18736#line 2
18737allow hal_vibrator_client hal_vibrator_server:binder { call transfer };
18738#line 2
18739# Allow the serverdomain to transfer references to the client on the reply.
18740#line 2
18741allow hal_vibrator_server hal_vibrator_client:binder transfer;
18742#line 2
18743# Receive and use open files from the server.
18744#line 2
18745allow hal_vibrator_client hal_vibrator_server:fd use;
18746#line 2
18747
18748
18749
18750#line 4
18751  allow hal_vibrator_client hal_vibrator_hwservice:hwservice_manager find;
18752#line 4
18753
18754#line 4
18755  allow hal_vibrator_server hal_vibrator_hwservice:hwservice_manager { add find };
18756#line 4
18757  allow hal_vibrator_server hidl_base_hwservice:hwservice_manager add;
18758#line 4
18759  neverallow { domain -hal_vibrator_server } hal_vibrator_hwservice:hwservice_manager add;
18760#line 4
18761
18762#line 4
18763
18764#line 4
18765
18766#line 4
18767    neverallow { domain -hal_vibrator_client -hal_vibrator_server } hal_vibrator_hwservice:hwservice_manager find;
18768#line 4
18769
18770#line 4
18771
18772
18773# vibrator sysfs rw access
18774allow hal_vibrator sysfs_vibrator:file { { getattr open read ioctl lock map } { open append write lock map } };
18775allow hal_vibrator sysfs_vibrator:dir search;
18776#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_vr.te"
18777# HwBinder IPC from client to server, and callbacks
18778
18779#line 2
18780# Call the server domain and optionally transfer references to it.
18781#line 2
18782allow hal_vr_client hal_vr_server:binder { call transfer };
18783#line 2
18784# Allow the serverdomain to transfer references to the client on the reply.
18785#line 2
18786allow hal_vr_server hal_vr_client:binder transfer;
18787#line 2
18788# Receive and use open files from the server.
18789#line 2
18790allow hal_vr_client hal_vr_server:fd use;
18791#line 2
18792
18793
18794#line 3
18795# Call the server domain and optionally transfer references to it.
18796#line 3
18797allow hal_vr_server hal_vr_client:binder { call transfer };
18798#line 3
18799# Allow the serverdomain to transfer references to the client on the reply.
18800#line 3
18801allow hal_vr_client hal_vr_server:binder transfer;
18802#line 3
18803# Receive and use open files from the server.
18804#line 3
18805allow hal_vr_server hal_vr_client:fd use;
18806#line 3
18807
18808
18809
18810#line 5
18811  allow hal_vr_client hal_vr_hwservice:hwservice_manager find;
18812#line 5
18813
18814#line 5
18815  allow hal_vr_server hal_vr_hwservice:hwservice_manager { add find };
18816#line 5
18817  allow hal_vr_server hidl_base_hwservice:hwservice_manager add;
18818#line 5
18819  neverallow { domain -hal_vr_server } hal_vr_hwservice:hwservice_manager add;
18820#line 5
18821
18822#line 5
18823
18824#line 5
18825
18826#line 5
18827    neverallow { domain -hal_vr_client -hal_vr_server } hal_vr_hwservice:hwservice_manager find;
18828#line 5
18829
18830#line 5
18831
18832#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_weaver.te"
18833# HwBinder IPC from client to server
18834
18835#line 2
18836# Call the server domain and optionally transfer references to it.
18837#line 2
18838allow hal_weaver_client hal_weaver_server:binder { call transfer };
18839#line 2
18840# Allow the serverdomain to transfer references to the client on the reply.
18841#line 2
18842allow hal_weaver_server hal_weaver_client:binder transfer;
18843#line 2
18844# Receive and use open files from the server.
18845#line 2
18846allow hal_weaver_client hal_weaver_server:fd use;
18847#line 2
18848
18849
18850
18851#line 4
18852  allow hal_weaver_client hal_weaver_hwservice:hwservice_manager find;
18853#line 4
18854
18855#line 4
18856  allow hal_weaver_server hal_weaver_hwservice:hwservice_manager { add find };
18857#line 4
18858  allow hal_weaver_server hidl_base_hwservice:hwservice_manager add;
18859#line 4
18860  neverallow { domain -hal_weaver_server } hal_weaver_hwservice:hwservice_manager add;
18861#line 4
18862
18863#line 4
18864
18865#line 4
18866
18867#line 4
18868    neverallow { domain -hal_weaver_client -hal_weaver_server } hal_weaver_hwservice:hwservice_manager find;
18869#line 4
18870
18871#line 4
18872
18873#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_wifi.te"
18874# HwBinder IPC from client to server, and callbacks
18875
18876#line 2
18877# Call the server domain and optionally transfer references to it.
18878#line 2
18879allow hal_wifi_client hal_wifi_server:binder { call transfer };
18880#line 2
18881# Allow the serverdomain to transfer references to the client on the reply.
18882#line 2
18883allow hal_wifi_server hal_wifi_client:binder transfer;
18884#line 2
18885# Receive and use open files from the server.
18886#line 2
18887allow hal_wifi_client hal_wifi_server:fd use;
18888#line 2
18889
18890
18891#line 3
18892# Call the server domain and optionally transfer references to it.
18893#line 3
18894allow hal_wifi_server hal_wifi_client:binder { call transfer };
18895#line 3
18896# Allow the serverdomain to transfer references to the client on the reply.
18897#line 3
18898allow hal_wifi_client hal_wifi_server:binder transfer;
18899#line 3
18900# Receive and use open files from the server.
18901#line 3
18902allow hal_wifi_server hal_wifi_client:fd use;
18903#line 3
18904
18905
18906
18907#line 5
18908  allow hal_wifi_client hal_wifi_hwservice:hwservice_manager find;
18909#line 5
18910
18911#line 5
18912  allow hal_wifi_server hal_wifi_hwservice:hwservice_manager { add find };
18913#line 5
18914  allow hal_wifi_server hidl_base_hwservice:hwservice_manager add;
18915#line 5
18916  neverallow { domain -hal_wifi_server } hal_wifi_hwservice:hwservice_manager add;
18917#line 5
18918
18919#line 5
18920
18921#line 5
18922
18923#line 5
18924    neverallow { domain -hal_wifi_client -hal_wifi_server } hal_wifi_hwservice:hwservice_manager find;
18925#line 5
18926
18927#line 5
18928
18929
18930
18931#line 7
18932allow hal_wifi proc_net_type:dir { open getattr read search ioctl lock };
18933#line 7
18934allow hal_wifi proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
18935#line 7
18936
18937
18938#line 8
18939allow hal_wifi sysfs_type:dir { open getattr read search ioctl lock };
18940#line 8
18941allow hal_wifi sysfs_type:{ file lnk_file } { getattr open read ioctl lock map };
18942#line 8
18943
18944
18945
18946#line 10
18947
18948#line 10
18949allow hal_wifi property_socket:sock_file write;
18950#line 10
18951allow hal_wifi init:unix_stream_socket connectto;
18952#line 10
18953
18954#line 10
18955allow hal_wifi exported_wifi_prop:property_service set;
18956#line 10
18957
18958#line 10
18959allow hal_wifi exported_wifi_prop:file { getattr open read map };
18960#line 10
18961
18962#line 10
18963
18964
18965#line 11
18966
18967#line 11
18968allow hal_wifi property_socket:sock_file write;
18969#line 11
18970allow hal_wifi init:unix_stream_socket connectto;
18971#line 11
18972
18973#line 11
18974allow hal_wifi wifi_prop:property_service set;
18975#line 11
18976
18977#line 11
18978allow hal_wifi wifi_prop:file { getattr open read map };
18979#line 11
18980
18981#line 11
18982
18983
18984# allow hal wifi set interfaces up and down and get the factory MAC
18985allow hal_wifi self:udp_socket { create { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } };
18986allowxperm hal_wifi self:udp_socket ioctl { 0x00008914 0x00008924 0x00008946 };
18987
18988allow hal_wifi self:{ capability cap_userns } { net_admin net_raw };
18989# allow hal_wifi to speak to nl80211 in the kernel
18990allow hal_wifi self:netlink_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
18991# newer kernels (e.g. 4.4 but not 4.1) have a new class for sockets
18992allow hal_wifi self:netlink_generic_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
18993# hal_wifi writes firmware paths to this file.
18994allow hal_wifi sysfs_wlan_fwpath:file { { open append write lock map } };
18995# allow hal_wifi to access /proc/modules to check if Wi-Fi driver is loaded
18996allow hal_wifi proc_modules:file { getattr open read };
18997# Allow hal_wifi to send dump info to dumpstate
18998allow hal_wifi dumpstate:fifo_file write;
18999
19000# allow hal_wifi to write into /data/vendor/tombstones/wifi
19001allow hal_wifi_server tombstone_wifi_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
19002allow hal_wifi_server tombstone_wifi_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
19003#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_wifi_hostapd.te"
19004# HwBinder IPC from client to server
19005
19006#line 2
19007# Call the server domain and optionally transfer references to it.
19008#line 2
19009allow hal_wifi_hostapd_client hal_wifi_hostapd_server:binder { call transfer };
19010#line 2
19011# Allow the serverdomain to transfer references to the client on the reply.
19012#line 2
19013allow hal_wifi_hostapd_server hal_wifi_hostapd_client:binder transfer;
19014#line 2
19015# Receive and use open files from the server.
19016#line 2
19017allow hal_wifi_hostapd_client hal_wifi_hostapd_server:fd use;
19018#line 2
19019
19020
19021#line 3
19022# Call the server domain and optionally transfer references to it.
19023#line 3
19024allow hal_wifi_hostapd_server hal_wifi_hostapd_client:binder { call transfer };
19025#line 3
19026# Allow the serverdomain to transfer references to the client on the reply.
19027#line 3
19028allow hal_wifi_hostapd_client hal_wifi_hostapd_server:binder transfer;
19029#line 3
19030# Receive and use open files from the server.
19031#line 3
19032allow hal_wifi_hostapd_server hal_wifi_hostapd_client:fd use;
19033#line 3
19034
19035
19036
19037#line 5
19038  allow hal_wifi_hostapd_client hal_wifi_hostapd_hwservice:hwservice_manager find;
19039#line 5
19040
19041#line 5
19042  allow hal_wifi_hostapd_server hal_wifi_hostapd_hwservice:hwservice_manager { add find };
19043#line 5
19044  allow hal_wifi_hostapd_server hidl_base_hwservice:hwservice_manager add;
19045#line 5
19046  neverallow { domain -hal_wifi_hostapd_server } hal_wifi_hostapd_hwservice:hwservice_manager add;
19047#line 5
19048
19049#line 5
19050
19051#line 5
19052
19053#line 5
19054    neverallow { domain -hal_wifi_hostapd_client -hal_wifi_hostapd_server } hal_wifi_hostapd_hwservice:hwservice_manager find;
19055#line 5
19056
19057#line 5
19058
19059
19060allow hal_wifi_hostapd_server self:{ capability cap_userns } { net_admin net_raw };
19061
19062allow hal_wifi_hostapd_server sysfs_net:dir search;
19063
19064# Allow hal_wifi_hostapd to access /proc/net/psched
19065allow hal_wifi_hostapd_server proc_net_type:file { getattr open read };
19066
19067# Various socket permissions.
19068allowxperm hal_wifi_hostapd_server self:udp_socket ioctl
19069#line 15
19070{
19071#line 15
19072# qualcomm rmnet ioctls
19073#line 15
190740x00006900 0x00006902
19075#line 15
19076# socket ioctls
19077#line 15
190780x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
19079#line 15
190800x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
19081#line 15
190820x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
19083#line 15
190840x00008927 0x00008929 0x00008930 0x00008931 0x00008932
19085#line 15
190860x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
19087#line 15
190880x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
19089#line 15
190900x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
19091#line 15
190920x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
19093#line 15
190940x00008991 0x00008992 0x00008993 0x00008994
19095#line 15
190960x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
19097#line 15
19098# device and protocol specific ioctls
19099#line 15
191000x000089f0-0x000089ff
19101#line 15
191020x000089e0-0x000089ef
19103#line 15
19104# Wireless extension ioctls
19105#line 15
191060x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
19107#line 15
191080x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
19109#line 15
191100x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
19111#line 15
191120x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
19113#line 15
191140x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
19115#line 15
191160x00008b34 0x00008b35 0x00008b36
19117#line 15
19118# Dev private ioctl i.e. hardware specific ioctls
19119#line 15
191200x00008be0-0x00008bff
19121#line 15
19122};
19123allow hal_wifi_hostapd_server self:netlink_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
19124allow hal_wifi_hostapd_server self:netlink_generic_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
19125allow hal_wifi_hostapd_server self:packet_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
19126allow hal_wifi_hostapd_server self:netlink_route_socket nlmsg_write;
19127
19128###
19129### neverallow rules
19130###
19131
19132# hal_wifi_hostapd should not trust any data from sdcards
19133neverallow hal_wifi_hostapd_server sdcard_type:dir ~getattr;
19134neverallow hal_wifi_hostapd_server sdcard_type:file *;
19135#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_wifi_offload.te"
19136## HwBinder IPC from client to server, and callbacks
19137
19138#line 2
19139# Call the server domain and optionally transfer references to it.
19140#line 2
19141allow hal_wifi_offload_client hal_wifi_offload_server:binder { call transfer };
19142#line 2
19143# Allow the serverdomain to transfer references to the client on the reply.
19144#line 2
19145allow hal_wifi_offload_server hal_wifi_offload_client:binder transfer;
19146#line 2
19147# Receive and use open files from the server.
19148#line 2
19149allow hal_wifi_offload_client hal_wifi_offload_server:fd use;
19150#line 2
19151
19152
19153#line 3
19154# Call the server domain and optionally transfer references to it.
19155#line 3
19156allow hal_wifi_offload_server hal_wifi_offload_client:binder { call transfer };
19157#line 3
19158# Allow the serverdomain to transfer references to the client on the reply.
19159#line 3
19160allow hal_wifi_offload_client hal_wifi_offload_server:binder transfer;
19161#line 3
19162# Receive and use open files from the server.
19163#line 3
19164allow hal_wifi_offload_server hal_wifi_offload_client:fd use;
19165#line 3
19166
19167
19168
19169#line 5
19170  allow hal_wifi_offload_client hal_wifi_offload_hwservice:hwservice_manager find;
19171#line 5
19172
19173#line 5
19174  allow hal_wifi_offload_server hal_wifi_offload_hwservice:hwservice_manager { add find };
19175#line 5
19176  allow hal_wifi_offload_server hidl_base_hwservice:hwservice_manager add;
19177#line 5
19178  neverallow { domain -hal_wifi_offload_server } hal_wifi_offload_hwservice:hwservice_manager add;
19179#line 5
19180
19181#line 5
19182
19183#line 5
19184
19185#line 5
19186    neverallow { domain -hal_wifi_offload_client -hal_wifi_offload_server } hal_wifi_offload_hwservice:hwservice_manager find;
19187#line 5
19188
19189#line 5
19190
19191
19192
19193#line 7
19194allow hal_wifi_offload proc_net_type:dir { open getattr read search ioctl lock };
19195#line 7
19196allow hal_wifi_offload proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
19197#line 7
19198
19199
19200#line 8
19201allow hal_wifi_offload sysfs_type:dir { open getattr read search ioctl lock };
19202#line 8
19203allow hal_wifi_offload sysfs_type:{ file lnk_file } { getattr open read ioctl lock map };
19204#line 8
19205
19206#line 1 "system/sepolicy/prebuilts/api/29.0/public/hal_wifi_supplicant.te"
19207# HwBinder IPC from client to server
19208
19209#line 2
19210# Call the server domain and optionally transfer references to it.
19211#line 2
19212allow hal_wifi_supplicant_client hal_wifi_supplicant_server:binder { call transfer };
19213#line 2
19214# Allow the serverdomain to transfer references to the client on the reply.
19215#line 2
19216allow hal_wifi_supplicant_server hal_wifi_supplicant_client:binder transfer;
19217#line 2
19218# Receive and use open files from the server.
19219#line 2
19220allow hal_wifi_supplicant_client hal_wifi_supplicant_server:fd use;
19221#line 2
19222
19223
19224#line 3
19225# Call the server domain and optionally transfer references to it.
19226#line 3
19227allow hal_wifi_supplicant_server hal_wifi_supplicant_client:binder { call transfer };
19228#line 3
19229# Allow the serverdomain to transfer references to the client on the reply.
19230#line 3
19231allow hal_wifi_supplicant_client hal_wifi_supplicant_server:binder transfer;
19232#line 3
19233# Receive and use open files from the server.
19234#line 3
19235allow hal_wifi_supplicant_server hal_wifi_supplicant_client:fd use;
19236#line 3
19237
19238
19239
19240#line 5
19241  allow hal_wifi_supplicant_client hal_wifi_supplicant_hwservice:hwservice_manager find;
19242#line 5
19243
19244#line 5
19245  allow hal_wifi_supplicant_server hal_wifi_supplicant_hwservice:hwservice_manager { add find };
19246#line 5
19247  allow hal_wifi_supplicant_server hidl_base_hwservice:hwservice_manager add;
19248#line 5
19249  neverallow { domain -hal_wifi_supplicant_server } hal_wifi_supplicant_hwservice:hwservice_manager add;
19250#line 5
19251
19252#line 5
19253
19254#line 5
19255
19256#line 5
19257    neverallow { domain -hal_wifi_supplicant_client -hal_wifi_supplicant_server } hal_wifi_supplicant_hwservice:hwservice_manager find;
19258#line 5
19259
19260#line 5
19261
19262
19263# in addition to ioctls allowlisted for all domains, grant hal_wifi_supplicant priv_sock_ioctls.
19264allowxperm hal_wifi_supplicant self:udp_socket ioctl
19265#line 8
19266{
19267#line 8
19268# qualcomm rmnet ioctls
19269#line 8
192700x00006900 0x00006902
19271#line 8
19272# socket ioctls
19273#line 8
192740x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
19275#line 8
192760x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
19277#line 8
192780x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
19279#line 8
192800x00008927 0x00008929 0x00008930 0x00008931 0x00008932
19281#line 8
192820x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
19283#line 8
192840x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
19285#line 8
192860x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
19287#line 8
192880x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
19289#line 8
192900x00008991 0x00008992 0x00008993 0x00008994
19291#line 8
192920x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
19293#line 8
19294# device and protocol specific ioctls
19295#line 8
192960x000089f0-0x000089ff
19297#line 8
192980x000089e0-0x000089ef
19299#line 8
19300# Wireless extension ioctls
19301#line 8
193020x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
19303#line 8
193040x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
19305#line 8
193060x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
19307#line 8
193080x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
19309#line 8
193100x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
19311#line 8
193120x00008b34 0x00008b35 0x00008b36
19313#line 8
19314# Dev private ioctl i.e. hardware specific ioctls
19315#line 8
193160x00008be0-0x00008bff
19317#line 8
19318};
19319
19320
19321#line 10
19322allow hal_wifi_supplicant sysfs_type:dir { open getattr read search ioctl lock };
19323#line 10
19324allow hal_wifi_supplicant sysfs_type:{ file lnk_file } { getattr open read ioctl lock map };
19325#line 10
19326
19327
19328#line 11
19329allow hal_wifi_supplicant proc_net_type:dir { open getattr read search ioctl lock };
19330#line 11
19331allow hal_wifi_supplicant proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
19332#line 11
19333
19334
19335allow hal_wifi_supplicant kernel:system module_request;
19336allow hal_wifi_supplicant self:{ capability cap_userns } { setuid net_admin setgid net_raw };
19337allow hal_wifi_supplicant cgroup:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
19338allow hal_wifi_supplicant self:netlink_route_socket nlmsg_write;
19339allow hal_wifi_supplicant self:netlink_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
19340allow hal_wifi_supplicant self:netlink_generic_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
19341allow hal_wifi_supplicant self:packet_socket { create { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } };
19342allowxperm hal_wifi_supplicant self:packet_socket ioctl {
19343#line 20
19344{
19345#line 20
19346# Socket ioctls for gathering information about the interface
19347#line 20
193480x00008906 0x00008907
19349#line 20
193500x00008910 0x00008912 0x00008913 0x00008915 0x00008917 0x00008919
19351#line 20
193520x0000891b 0x00008921 0x00008933 0x00008938 0x00008942
19353#line 20
19354# Wireless extension ioctls. Primarily get functions.
19355#line 20
193560x00008b01 0x00008b05 0x00008b07 0x00008b09 0x00008b0b 0x00008b0d
19357#line 20
193580x00008b0f 0x00008b11 0x00008b12 0x00008b13 0x00008b21 0x00008b23
19359#line 20
193600x00008b25 0x00008b27 0x00008b29 0x00008b2d
19361#line 20
19362}
19363#line 20
19364{
19365#line 20
19366# qualcomm rmnet ioctls
19367#line 20
193680x00006900 0x00006902
19369#line 20
19370# socket ioctls
19371#line 20
193720x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
19373#line 20
193740x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
19375#line 20
193760x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
19377#line 20
193780x00008927 0x00008929 0x00008930 0x00008931 0x00008932
19379#line 20
193800x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
19381#line 20
193820x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
19383#line 20
193840x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
19385#line 20
193860x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
19387#line 20
193880x00008991 0x00008992 0x00008993 0x00008994
19389#line 20
193900x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
19391#line 20
19392# device and protocol specific ioctls
19393#line 20
193940x000089f0-0x000089ff
19395#line 20
193960x000089e0-0x000089ef
19397#line 20
19398# Wireless extension ioctls
19399#line 20
194000x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
19401#line 20
194020x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
19403#line 20
194040x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
19405#line 20
194060x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
19407#line 20
194080x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
19409#line 20
194100x00008b34 0x00008b35 0x00008b36
19411#line 20
19412# Dev private ioctl i.e. hardware specific ioctls
19413#line 20
194140x00008be0-0x00008bff
19415#line 20
19416} {
19417#line 20
19418  0x00005411 0x00005451 0x00005450 0x00005401 0x00005402 0x00005413 0x00005414 0x0000540e
19419#line 20
19420  0x00005403 0x0000540b 0x00005410 0x0000540f
19421#line 20
19422} };
19423
19424###
19425### neverallow rules
19426###
19427
19428# wpa_supplicant should not trust any data from sdcards
19429neverallow hal_wifi_supplicant_server sdcard_type:dir ~getattr;
19430neverallow hal_wifi_supplicant_server sdcard_type:file *;
19431#line 1 "system/sepolicy/prebuilts/api/29.0/public/healthd.te"
19432# healthd - battery/charger monitoring service daemon
19433type healthd, domain;
19434type healthd_exec, system_file_type, exec_type, file_type;
19435
19436# Write to /dev/kmsg
19437allow healthd kmsg_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
19438
19439# Read access to pseudo filesystems.
19440allow healthd sysfs_type:dir search;
19441# Allow to read /sys/class/power_supply directory.
19442allow healthd sysfs:dir { open getattr read search ioctl lock };
19443
19444#line 12
19445allow healthd rootfs:dir { open getattr read search ioctl lock };
19446#line 12
19447allow healthd rootfs:{ file lnk_file } { getattr open read ioctl lock map };
19448#line 12
19449
19450
19451#line 13
19452allow healthd cgroup:dir { open getattr read search ioctl lock };
19453#line 13
19454allow healthd cgroup:{ file lnk_file } { getattr open read ioctl lock map };
19455#line 13
19456
19457
19458allow healthd self:{ capability cap_userns } { sys_tty_config };
19459allow healthd self:{ capability cap_userns } sys_boot;
19460dontaudit healthd self:{ capability cap_userns } sys_resource;
19461
19462allow healthd self:netlink_kobject_uevent_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
19463
19464
19465#line 21
19466# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
19467#line 21
19468# deprecated.
19469#line 21
19470# Access /sys/power/wake_lock and /sys/power/wake_unlock
19471#line 21
19472allow healthd sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
19473#line 21
19474# Accessing these files requires CAP_BLOCK_SUSPEND
19475#line 21
19476allow healthd self:{ capability2 cap2_userns } block_suspend;
19477#line 21
19478# system_suspend permissions
19479#line 21
19480
19481#line 21
19482# Call the server domain and optionally transfer references to it.
19483#line 21
19484allow healthd system_suspend_server:binder { call transfer };
19485#line 21
19486# Allow the serverdomain to transfer references to the client on the reply.
19487#line 21
19488allow system_suspend_server healthd:binder transfer;
19489#line 21
19490# Receive and use open files from the server.
19491#line 21
19492allow healthd system_suspend_server:fd use;
19493#line 21
19494
19495#line 21
19496allow healthd system_suspend_hwservice:hwservice_manager find;
19497#line 21
19498# halclientdomain permissions
19499#line 21
19500
19501#line 21
19502# Call the hwservicemanager and transfer references to it.
19503#line 21
19504allow healthd hwservicemanager:binder { call transfer };
19505#line 21
19506# Allow hwservicemanager to send out callbacks
19507#line 21
19508allow hwservicemanager healthd:binder { call transfer };
19509#line 21
19510# hwservicemanager performs getpidcon on clients.
19511#line 21
19512allow hwservicemanager healthd:dir search;
19513#line 21
19514allow hwservicemanager healthd:file { read open map };
19515#line 21
19516allow hwservicemanager healthd:process getattr;
19517#line 21
19518# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
19519#line 21
19520# all domains in domain.te.
19521#line 21
19522
19523#line 21
19524
19525#line 21
19526allow healthd hwservicemanager_prop:file { getattr open read map };
19527#line 21
19528
19529#line 21
19530allow healthd hidl_manager_hwservice:hwservice_manager find;
19531#line 21
19532
19533
19534
19535#line 23
19536typeattribute healthd halclientdomain;
19537#line 23
19538typeattribute healthd hal_health_client;
19539#line 23
19540
19541#line 23
19542# TODO(b/34170079): Make the inclusion of the rules below conditional also on
19543#line 23
19544# non-Treble devices. For now, on non-Treble device, always grant clients of a
19545#line 23
19546# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
19547#line 23
19548
19549#line 23
19550
19551
19552# Read/write to /sys/power/state
19553allow healthd sysfs_power:file { { getattr open read ioctl lock map } { open append write lock map } };
19554
19555# TODO: added to match above sysfs rule. Remove me?
19556allow healthd sysfs_usb:file write;
19557
19558
19559#line 31
19560allow healthd sysfs_batteryinfo:dir { open getattr read search ioctl lock };
19561#line 31
19562allow healthd sysfs_batteryinfo:{ file lnk_file } { getattr open read ioctl lock map };
19563#line 31
19564
19565
19566###
19567### healthd: charger mode
19568###
19569
19570# Read /sys/fs/pstore/console-ramoops
19571# Don't worry about overly broad permissions for now, as there's
19572# only one file in /sys/fs/pstore
19573allow healthd pstorefs:dir { open getattr read search ioctl lock };
19574allow healthd pstorefs:file { getattr open read ioctl lock map };
19575
19576allow healthd graphics_device:dir { open getattr read search ioctl lock };
19577allow healthd graphics_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
19578allow healthd input_device:dir { open getattr read search ioctl lock };
19579allow healthd input_device:chr_file { getattr open read ioctl lock map };
19580allow healthd tty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
19581allow healthd ashmem_device:chr_file execute;
19582allow healthd self:process execmem;
19583allow healthd proc_sysrq:file { { getattr open read ioctl lock map } { open append write lock map } };
19584
19585# Healthd needs to tell init to continue the boot
19586# process when running in charger mode.
19587
19588#line 54
19589
19590#line 54
19591allow healthd property_socket:sock_file write;
19592#line 54
19593allow healthd init:unix_stream_socket connectto;
19594#line 54
19595
19596#line 54
19597allow healthd system_prop:property_service set;
19598#line 54
19599
19600#line 54
19601allow healthd system_prop:file { getattr open read map };
19602#line 54
19603
19604#line 54
19605
19606
19607#line 55
19608
19609#line 55
19610allow healthd property_socket:sock_file write;
19611#line 55
19612allow healthd init:unix_stream_socket connectto;
19613#line 55
19614
19615#line 55
19616allow healthd exported_system_prop:property_service set;
19617#line 55
19618
19619#line 55
19620allow healthd exported_system_prop:file { getattr open read map };
19621#line 55
19622
19623#line 55
19624
19625
19626#line 56
19627
19628#line 56
19629allow healthd property_socket:sock_file write;
19630#line 56
19631allow healthd init:unix_stream_socket connectto;
19632#line 56
19633
19634#line 56
19635allow healthd exported2_system_prop:property_service set;
19636#line 56
19637
19638#line 56
19639allow healthd exported2_system_prop:file { getattr open read map };
19640#line 56
19641
19642#line 56
19643
19644
19645#line 57
19646
19647#line 57
19648allow healthd property_socket:sock_file write;
19649#line 57
19650allow healthd init:unix_stream_socket connectto;
19651#line 57
19652
19653#line 57
19654allow healthd exported3_system_prop:property_service set;
19655#line 57
19656
19657#line 57
19658allow healthd exported3_system_prop:file { getattr open read map };
19659#line 57
19660
19661#line 57
19662
19663#line 1 "system/sepolicy/prebuilts/api/29.0/public/heapprofd.te"
19664type heapprofd, domain, coredomain;
19665#line 1 "system/sepolicy/prebuilts/api/29.0/public/hwservice.te"
19666type default_android_hwservice, hwservice_manager_type;
19667type fwk_bufferhub_hwservice, hwservice_manager_type, coredomain_hwservice;
19668type fwk_camera_hwservice, hwservice_manager_type, coredomain_hwservice;
19669type fwk_display_hwservice, hwservice_manager_type, coredomain_hwservice;
19670type fwk_scheduler_hwservice, hwservice_manager_type, coredomain_hwservice;
19671type fwk_sensor_hwservice, hwservice_manager_type, coredomain_hwservice;
19672type fwk_stats_hwservice, hwservice_manager_type, coredomain_hwservice;
19673type hal_atrace_hwservice, hwservice_manager_type;
19674type hal_audiocontrol_hwservice, hwservice_manager_type;
19675type hal_audio_hwservice, hwservice_manager_type;
19676type hal_authsecret_hwservice, hwservice_manager_type;
19677type hal_bluetooth_hwservice, hwservice_manager_type;
19678type hal_bootctl_hwservice, hwservice_manager_type;
19679type hal_broadcastradio_hwservice, hwservice_manager_type;
19680type hal_camera_hwservice, hwservice_manager_type;
19681type hal_codec2_hwservice, hwservice_manager_type;
19682type hal_configstore_ISurfaceFlingerConfigs, hwservice_manager_type;
19683type hal_confirmationui_hwservice, hwservice_manager_type;
19684type hal_contexthub_hwservice, hwservice_manager_type;
19685type hal_drm_hwservice, hwservice_manager_type;
19686type hal_cas_hwservice, hwservice_manager_type;
19687type hal_dumpstate_hwservice, hwservice_manager_type;
19688type hal_evs_hwservice, hwservice_manager_type;
19689type hal_face_hwservice, hwservice_manager_type;
19690type hal_fingerprint_hwservice, hwservice_manager_type;
19691type hal_gatekeeper_hwservice, hwservice_manager_type;
19692type hal_gnss_hwservice, hwservice_manager_type;
19693type hal_graphics_allocator_hwservice, hwservice_manager_type;
19694type hal_graphics_composer_hwservice, hwservice_manager_type;
19695type hal_graphics_mapper_hwservice, hwservice_manager_type, same_process_hwservice;
19696type hal_health_hwservice, hwservice_manager_type;
19697type hal_health_storage_hwservice, hwservice_manager_type;
19698type hal_input_classifier_hwservice, hwservice_manager_type;
19699type hal_ir_hwservice, hwservice_manager_type;
19700type hal_keymaster_hwservice, hwservice_manager_type;
19701type hal_light_hwservice, hwservice_manager_type;
19702type hal_lowpan_hwservice, hwservice_manager_type;
19703type hal_memtrack_hwservice, hwservice_manager_type;
19704type hal_neuralnetworks_hwservice, hwservice_manager_type;
19705type hal_nfc_hwservice, hwservice_manager_type;
19706type hal_oemlock_hwservice, hwservice_manager_type;
19707type hal_omx_hwservice, hwservice_manager_type;
19708type hal_power_hwservice, hwservice_manager_type;
19709type hal_power_stats_hwservice, hwservice_manager_type;
19710type hal_renderscript_hwservice, hwservice_manager_type, same_process_hwservice;
19711type hal_secure_element_hwservice, hwservice_manager_type;
19712type hal_sensors_hwservice, hwservice_manager_type;
19713type hal_telephony_hwservice, hwservice_manager_type;
19714type hal_tetheroffload_hwservice, hwservice_manager_type;
19715type hal_thermal_hwservice, hwservice_manager_type;
19716type hal_tv_cec_hwservice, hwservice_manager_type;
19717type hal_tv_input_hwservice, hwservice_manager_type;
19718type hal_usb_hwservice, hwservice_manager_type;
19719type hal_usb_gadget_hwservice, hwservice_manager_type;
19720type hal_vehicle_hwservice, hwservice_manager_type;
19721type hal_vibrator_hwservice, hwservice_manager_type;
19722type hal_vr_hwservice, hwservice_manager_type;
19723type hal_weaver_hwservice, hwservice_manager_type;
19724type hal_wifi_hwservice, hwservice_manager_type;
19725type hal_wifi_hostapd_hwservice, hwservice_manager_type;
19726type hal_wifi_offload_hwservice, hwservice_manager_type;
19727type hal_wifi_supplicant_hwservice, hwservice_manager_type;
19728type hidl_allocator_hwservice, hwservice_manager_type, coredomain_hwservice;
19729type hidl_base_hwservice, hwservice_manager_type;
19730type hidl_manager_hwservice, hwservice_manager_type, coredomain_hwservice;
19731type hidl_memory_hwservice, hwservice_manager_type, coredomain_hwservice;
19732type hidl_token_hwservice, hwservice_manager_type, coredomain_hwservice;
19733type system_net_netd_hwservice, hwservice_manager_type, coredomain_hwservice;
19734type system_suspend_hwservice, hwservice_manager_type, coredomain_hwservice;
19735type system_wifi_keystore_hwservice, hwservice_manager_type, coredomain_hwservice;
19736type thermalcallback_hwservice, hwservice_manager_type;
19737
19738###
19739### Neverallow rules
19740###
19741
19742# hwservicemanager handles registering or looking up named services.
19743# It does not make sense to register or lookup something which is not a
19744# hwservice. Trigger a compile error if this occurs.
19745neverallow domain ~hwservice_manager_type:hwservice_manager { add find };
19746#line 1 "system/sepolicy/prebuilts/api/29.0/public/hwservicemanager.te"
19747# hwservicemanager - the Binder context manager for HAL services
19748type hwservicemanager, domain, mlstrustedsubject;
19749type hwservicemanager_exec, system_file_type, exec_type, file_type;
19750
19751# Note that we do not use the binder_* macros here.
19752# hwservicemanager provides name service (aka context manager)
19753# for hwbinder.
19754# Additionally, it initiates binder IPC calls to
19755# clients who request service notifications. The permission
19756# to do this is granted in the hwbinder_use macro.
19757allow hwservicemanager self:binder set_context_mgr;
19758
19759
19760#line 13
19761
19762#line 13
19763allow hwservicemanager property_socket:sock_file write;
19764#line 13
19765allow hwservicemanager init:unix_stream_socket connectto;
19766#line 13
19767
19768#line 13
19769allow hwservicemanager hwservicemanager_prop:property_service set;
19770#line 13
19771
19772#line 13
19773allow hwservicemanager hwservicemanager_prop:file { getattr open read map };
19774#line 13
19775
19776#line 13
19777
19778
19779# Scan through /system/lib64/hw looking for installed HALs
19780allow hwservicemanager system_file:dir { open getattr read search ioctl lock };
19781
19782# Read hwservice_contexts
19783allow hwservicemanager hwservice_contexts_file:file { getattr open read ioctl lock map };
19784
19785# Check SELinux permissions.
19786
19787#line 22
19788
19789#line 22
19790allow hwservicemanager selinuxfs:dir { open getattr read search ioctl lock };
19791#line 22
19792allow hwservicemanager selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
19793#line 22
19794
19795#line 22
19796allow hwservicemanager selinuxfs:file { open append write lock map };
19797#line 22
19798allow hwservicemanager kernel:security compute_av;
19799#line 22
19800allow hwservicemanager self:netlink_selinux_socket { read write create getattr setattr lock relabelfrom relabelto append bind connect listen accept getopt setopt shutdown recvfrom sendto name_bind };
19801#line 22
19802
19803#line 1 "system/sepolicy/prebuilts/api/29.0/public/idmap.te"
19804# idmap, when executed by installd
19805type idmap, domain;
19806type idmap_exec, system_file_type, exec_type, file_type;
19807
19808# TODO remove /system/bin/idmap and the link between idmap and installd (b/118711077)
19809# Use open file to /data/resource-cache file inherited from installd.
19810allow idmap installd:fd use;
19811allow idmap resourcecache_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
19812allow idmap resourcecache_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
19813
19814# Ignore reading /proc/<pid>/maps after a fork.
19815dontaudit idmap installd:file read;
19816
19817# Open and read from target and overlay apk files passed by argument.
19818allow idmap apk_data_file:file { getattr open read ioctl lock map };
19819allow idmap apk_data_file:dir search;
19820
19821# Allow /data/app/vmdl*.tmp, /data/app-private/vmdl*.tmp files
19822allow idmap { apk_tmp_file apk_private_tmp_file }:file { getattr open read ioctl lock map };
19823allow idmap { apk_tmp_file apk_private_tmp_file }:dir search;
19824
19825# Allow apps access to /vendor/app
19826
19827#line 23
19828allow idmap vendor_app_file:dir { open getattr read search ioctl lock };
19829#line 23
19830allow idmap vendor_app_file:{ file lnk_file } { getattr open read ioctl lock map };
19831#line 23
19832
19833
19834# Allow apps access to /vendor/overlay
19835
19836#line 26
19837allow idmap vendor_overlay_file:dir { open getattr read search ioctl lock };
19838#line 26
19839allow idmap vendor_overlay_file:{ file lnk_file } { getattr open read ioctl lock map };
19840#line 26
19841
19842
19843# Allow the idmap2d binary to register as a service and communicate via AIDL
19844
19845#line 29
19846# Call the servicemanager and transfer references to it.
19847#line 29
19848allow idmap servicemanager:binder { call transfer };
19849#line 29
19850# servicemanager performs getpidcon on clients.
19851#line 29
19852allow servicemanager idmap:dir search;
19853#line 29
19854allow servicemanager idmap:file { read open };
19855#line 29
19856allow servicemanager idmap:process getattr;
19857#line 29
19858# rw access to /dev/binder and /dev/ashmem is presently granted to
19859#line 29
19860# all domains in domain.te.
19861#line 29
19862
19863
19864#line 30
19865  allow idmap idmap_service:service_manager { add find };
19866#line 30
19867  neverallow { domain -idmap } idmap_service:service_manager add;
19868#line 30
19869
19870#line 1 "system/sepolicy/prebuilts/api/29.0/public/incident.te"
19871# The incident command is used to call into the incidentd service to
19872# take an incident report (binary, shared bugreport), download incident
19873# reports that have already been taken, and monitor for new ones.
19874# It doesn't do anything else.
19875
19876# incident
19877type incident, domain;
19878
19879#line 1 "system/sepolicy/prebuilts/api/29.0/public/incident_helper.te"
19880# The incident_helper is called by incidentd and
19881# can only read/write data from/to incidentd
19882
19883# incident_helper
19884type incident_helper, domain;
19885#line 1 "system/sepolicy/prebuilts/api/29.0/public/incidentd.te"
19886# incidentd
19887type incidentd, domain;
19888
19889#line 1 "system/sepolicy/prebuilts/api/29.0/public/init.te"
19890# init is its own domain.
19891type init, domain, mlstrustedsubject;
19892type init_exec, system_file_type, exec_type, file_type;
19893type init_tmpfs, file_type;
19894
19895# /dev/__null__ node created by init.
19896allow init tmpfs:chr_file { create setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
19897
19898#
19899# init direct restorecon calls.
19900#
19901# /dev/kmsg
19902allow init tmpfs:chr_file relabelfrom;
19903allow init kmsg_device:chr_file { getattr write relabelto };
19904# /dev/kmsg_debug
19905#line 18
19906
19907# /dev/__properties__
19908allow init properties_device:dir relabelto;
19909allow init properties_serial:file { write relabelto };
19910allow init property_type:file { append create getattr map open read relabelto rename setattr unlink write };
19911# /dev/__properties__/property_info
19912allow init properties_device:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
19913allow init property_info:file relabelto;
19914# /dev/event-log-tags
19915allow init device:file relabelfrom;
19916allow init runtime_event_log_tags_file:file { open write setattr relabelto create };
19917# /dev/socket
19918allow init { device socket_device }:dir relabelto;
19919# Relabel /dev nodes created in first stage init, /dev/null, /dev/ptmx, /dev/random, /dev/urandom
19920allow init { null_device ptmx_device random_device } : chr_file relabelto;
19921# /dev/device-mapper, /dev/block(/.*)?
19922allow init tmpfs:{ chr_file blk_file } relabelfrom;
19923allow init tmpfs:blk_file getattr;
19924allow init block_device:{ dir blk_file lnk_file } relabelto;
19925allow init dm_device:{ chr_file blk_file } relabelto;
19926allow init kernel:fd use;
19927# restorecon for early mount device symlinks
19928allow init tmpfs:lnk_file { getattr read relabelfrom };
19929allow init {
19930  metadata_block_device
19931  misc_block_device
19932  recovery_block_device
19933  system_block_device
19934  userdata_block_device
19935}:{ blk_file lnk_file } relabelto;
19936
19937# setrlimit
19938allow init self:{ capability cap_userns } sys_resource;
19939
19940# Remove /dev/.booting and load /debug_ramdisk/* files
19941allow init tmpfs:file { getattr unlink };
19942
19943# Access pty created for fsck.
19944allow init devpts:chr_file { read write open };
19945
19946# Create /dev/fscklogs files.
19947allow init fscklogs:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
19948
19949# Access /dev/__null__ node created prior to initial policy load.
19950allow init tmpfs:chr_file write;
19951
19952# Access /dev/console.
19953allow init console_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
19954
19955# Access /dev/tty0.
19956allow init tty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
19957
19958# Call mount(2).
19959allow init self:{ capability cap_userns } sys_admin;
19960
19961# Call setns(2).
19962allow init self:{ capability cap_userns } sys_chroot;
19963
19964# Create and mount on directories in /.
19965allow init rootfs:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
19966allow init { rootfs cache_file cgroup storage_file system_data_file system_file vendor_file postinstall_mnt_dir }:dir mounton;
19967allow init cgroup_bpf:dir { create mounton };
19968
19969# Mount bpf fs on sys/fs/bpf
19970allow init fs_bpf:dir mounton;
19971
19972# Mount on /dev/usb-ffs/adb.
19973allow init device:dir mounton;
19974
19975# Mount tmpfs on /apex
19976allow init apex_mnt_dir:dir mounton;
19977
19978# Create and remove symlinks in /.
19979allow init rootfs:lnk_file { create unlink };
19980
19981# Mount debugfs on /sys/kernel/debug.
19982allow init sysfs:dir mounton;
19983
19984# Create cgroups mount points in tmpfs and mount cgroups on them.
19985allow init tmpfs:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
19986allow init tmpfs:dir mounton;
19987allow init cgroup:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
19988allow init cgroup:file { { getattr open read ioctl lock map } { open append write lock map } };
19989allow init cgroup_rc_file:file { { getattr open read ioctl lock map } { open append write lock map } };
19990allow init cgroup_desc_file:file { getattr open read ioctl lock map };
19991allow init vendor_cgroup_desc_file:file { getattr open read ioctl lock map };
19992
19993# /config
19994allow init configfs:dir mounton;
19995allow init configfs:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
19996allow init configfs:{ file lnk_file } { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
19997
19998# /metadata
19999allow init metadata_file:dir mounton;
20000
20001# Use tmpfs as /data, used for booting when /data is encrypted
20002allow init tmpfs:dir relabelfrom;
20003
20004# Create directories under /dev/cpuctl after chowning it to system.
20005allow init self:{ capability cap_userns } { dac_override dac_read_search };
20006
20007# Set system clock.
20008allow init self:{ capability cap_userns } sys_time;
20009
20010allow init self:{ capability cap_userns } { sys_rawio mknod };
20011
20012# Mounting filesystems from block devices.
20013allow init dev_type:blk_file { getattr open read ioctl lock map };
20014allowxperm init dev_type:blk_file ioctl 0x0000125d;
20015
20016# Mounting filesystems.
20017# Only allow relabelto for types used in context= mount options,
20018# which should all be assigned the contextmount_type attribute.
20019# This can be done in device-specific policy via type or typeattribute
20020# declarations.
20021allow init fs_type:filesystem ~relabelto;
20022allow init unlabeled:filesystem ~relabelto;
20023allow init contextmount_type:filesystem relabelto;
20024
20025# Allow read-only access to context= mounted filesystems.
20026allow init contextmount_type:dir { open getattr read search ioctl lock };
20027allow init contextmount_type:{ file lnk_file sock_file fifo_file } { getattr open read ioctl lock map };
20028
20029# restorecon /adb_keys or any other rootfs files and directories to a more
20030# specific type.
20031allow init rootfs:{ dir file } relabelfrom;
20032
20033# mkdir, symlink, write, rm/rmdir, chown/chmod, restorecon/restorecon_recursive from init.rc files.
20034# chown/chmod require open+read+setattr required for open()+fchown/fchmod().
20035# system/core/init.rc requires at least cache_file and data_file_type.
20036# init.<board>.rc files often include device-specific types, so
20037# we just allow all file types except /system files here.
20038allow init self:{ capability cap_userns } { chown fowner fsetid };
20039
20040allow init {
20041  file_type
20042  -app_data_file
20043  -exec_type
20044  -misc_logd_file
20045  -nativetest_data_file
20046  -privapp_data_file
20047  -system_app_data_file
20048  -system_file_type
20049  -vendor_file_type
20050}:dir { create search getattr open read setattr ioctl };
20051
20052allow init {
20053  file_type
20054  -app_data_file
20055  -exec_type
20056  -gsi_data_file
20057  -iorapd_data_file
20058  -keystore_data_file
20059  -misc_logd_file
20060  -nativetest_data_file
20061  -privapp_data_file
20062  -shell_data_file
20063  -system_app_data_file
20064  -system_file_type
20065  -vendor_file_type
20066  -vold_data_file
20067}:dir { write add_name remove_name rmdir relabelfrom };
20068
20069allow init {
20070  file_type
20071  -app_data_file
20072  -exec_type
20073  -gsi_data_file
20074  -iorapd_data_file
20075  -keystore_data_file
20076  -misc_logd_file
20077  -nativetest_data_file
20078  -privapp_data_file
20079  -runtime_event_log_tags_file
20080  -shell_data_file
20081  -system_app_data_file
20082  -system_file_type
20083  -vendor_file_type
20084  -vold_data_file
20085}:file { create getattr open read write setattr relabelfrom unlink map };
20086
20087allow init {
20088  file_type
20089  -app_data_file
20090  -exec_type
20091  -gsi_data_file
20092  -iorapd_data_file
20093  -keystore_data_file
20094  -misc_logd_file
20095  -nativetest_data_file
20096  -privapp_data_file
20097  -shell_data_file
20098  -system_app_data_file
20099  -system_file_type
20100  -vendor_file_type
20101  -vold_data_file
20102}:{ sock_file fifo_file } { create getattr open read setattr relabelfrom unlink };
20103
20104allow init {
20105  file_type
20106  -apex_mnt_dir
20107  -app_data_file
20108  -exec_type
20109  -gsi_data_file
20110  -iorapd_data_file
20111  -keystore_data_file
20112  -misc_logd_file
20113  -nativetest_data_file
20114  -privapp_data_file
20115  -shell_data_file
20116  -system_app_data_file
20117  -system_file_type
20118  -vendor_file_type
20119  -vold_data_file
20120}:lnk_file { create getattr setattr relabelfrom unlink };
20121
20122allow init cache_file:lnk_file { getattr open read ioctl lock map };
20123
20124allow init {
20125  file_type
20126  -system_file_type
20127  -vendor_file_type
20128  -exec_type
20129  -app_data_file
20130  -privapp_data_file
20131}:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } relabelto;
20132
20133allow init { sysfs debugfs debugfs_tracing debugfs_tracing_debug }:{ dir file lnk_file } { getattr relabelfrom };
20134allow init { sysfs_type debugfs_type }:{ dir file lnk_file } { relabelto getattr };
20135allow init dev_type:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20136allow init dev_type:lnk_file create;
20137
20138# Disable tracing by writing to /sys/kernel/debug/tracing/tracing_on
20139allow init debugfs_tracing:file { open append write lock map };
20140
20141# Setup and control wifi event tracing (see wifi-events.rc)
20142allow init debugfs_tracing_instances:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20143allow init debugfs_tracing_instances:file { open append write lock map };
20144allow init debugfs_wifi_tracing:file { open append write lock map };
20145
20146# chown/chmod on pseudo files.
20147allow init {
20148  fs_type
20149  -contextmount_type
20150  -keychord_device
20151  -proc_type
20152  -sdcard_type
20153  -sysfs_type
20154  -rootfs
20155}:file { open read setattr };
20156allow init { fs_type -contextmount_type -sdcard_type -rootfs }:dir  { open read setattr search };
20157
20158allow init {
20159  ashmem_device
20160  binder_device
20161  console_device
20162  devpts
20163  dm_device
20164  hwbinder_device
20165  hw_random_device
20166  input_device
20167  kmsg_device
20168  null_device
20169  owntty_device
20170  pmsg_device
20171  ptmx_device
20172  random_device
20173  tty_device
20174  zero_device
20175}:chr_file { read open };
20176
20177# chown/chmod on devices.
20178allow init {
20179  dev_type
20180  -keychord_device
20181  -port_device
20182}:chr_file setattr;
20183
20184# Unlabeled file access for upgrades from 4.2.
20185allow init unlabeled:dir { { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } } relabelfrom };
20186allow init unlabeled:{ file lnk_file sock_file fifo_file } { { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } } relabelfrom };
20187
20188# Any operation that can modify the kernel ring buffer, e.g. clear
20189# or a read that consumes the messages that were read.
20190allow init kernel:system syslog_mod;
20191allow init self:{ capability2 cap2_userns } syslog;
20192
20193# init access to /proc.
20194
20195#line 306
20196allow init proc_net_type:dir { open getattr read search ioctl lock };
20197#line 306
20198allow init proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
20199#line 306
20200
20201allow init proc_filesystems:file { getattr open read ioctl lock map };
20202
20203#line 314
20204
20205
20206allow init {
20207  proc # b/67049235 processes /proc/<pid>/* files are mislabeled.
20208  proc_cmdline
20209  proc_diskstats
20210  proc_kmsg # Open /proc/kmsg for logd service.
20211  proc_meminfo
20212  proc_stat # Read /proc/stat for bootchart.
20213  proc_uptime
20214  proc_version
20215}:file { getattr open read ioctl lock map };
20216
20217allow init {
20218  proc_abi
20219  proc_dirty
20220  proc_hostname
20221  proc_hung_task
20222  proc_extra_free_kbytes
20223  proc_net_type
20224  proc_max_map_count
20225  proc_min_free_order_shift
20226  proc_overcommit_memory
20227  proc_panic
20228  proc_page_cluster
20229  proc_perf
20230  proc_sched
20231  proc_sysrq
20232}:file { open append write lock map };
20233
20234allow init {
20235  proc_security
20236}:file { { getattr open read ioctl lock map } { open append write lock map } };
20237
20238# init chmod/chown access to /proc files.
20239allow init {
20240  proc_cmdline
20241  proc_kmsg
20242  proc_net
20243  proc_qtaguid_stat
20244  proc_slabinfo
20245  proc_sysrq
20246  proc_qtaguid_ctrl
20247  proc_vmallocinfo
20248}:file setattr;
20249
20250# init access to /sys files.
20251allow init {
20252  sysfs_android_usb
20253  sysfs_leds
20254  sysfs_power
20255  sysfs_fs_f2fs
20256  sysfs_dm
20257}:file { open append write lock map };
20258
20259allow init {
20260  sysfs_dt_firmware_android
20261  sysfs_fs_ext4_features
20262}:file { getattr open read ioctl lock map };
20263
20264allow init {
20265  sysfs_zram
20266}:file { { getattr open read ioctl lock map } { open append write lock map } };
20267
20268# allow init to create loop devices with /dev/loop-control
20269allow init loop_control_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
20270allow init loop_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
20271allowxperm init loop_device:blk_file ioctl {
20272  0x00004c00
20273  0x00004c01
20274  0x00004c82
20275  0x00004c09
20276  0x00004c08
20277};
20278
20279# Allow init to write to vibrator/trigger
20280allow init sysfs_vibrator:file { open append write lock map };
20281
20282# init chmod/chown access to /sys files.
20283allow init {
20284  sysfs_android_usb
20285  sysfs_devices_system_cpu
20286  sysfs_ipv4
20287  sysfs_leds
20288  sysfs_lowmemorykiller
20289  sysfs_power
20290  sysfs_vibrator
20291  sysfs_wake_lock
20292  sysfs_zram
20293}:file setattr;
20294
20295# Set usermodehelpers.
20296allow init { usermodehelper sysfs_usermodehelper }:file { { getattr open read ioctl lock map } { open append write lock map } };
20297
20298allow init self:{ capability cap_userns } net_admin;
20299
20300# Reboot.
20301allow init self:{ capability cap_userns } sys_boot;
20302
20303# Init will create /data/misc/logd when the property persist.logd.logpersistd is "logcatd".
20304# Init will also walk through the directory as part of a recursive restorecon.
20305allow init misc_logd_file:dir { add_name open create read getattr setattr search write };
20306allow init misc_logd_file:file { open create getattr setattr write };
20307
20308# Support "adb shell stop"
20309allow init self:{ capability cap_userns } kill;
20310allow init domain:process { getpgid sigkill signal };
20311
20312# Init creates keystore's directory on boot, and walks through
20313# the directory as part of a recursive restorecon.
20314allow init keystore_data_file:dir { open create read getattr setattr search };
20315allow init keystore_data_file:file { getattr };
20316
20317# Init creates vold's directory on boot, and walks through
20318# the directory as part of a recursive restorecon.
20319allow init vold_data_file:dir { open create read getattr setattr search };
20320allow init vold_data_file:file { getattr };
20321
20322# Init creates /data/local/tmp at boot
20323allow init shell_data_file:dir { open create read getattr setattr search };
20324allow init shell_data_file:file { getattr };
20325
20326# Set UID, GID, and adjust capability bounding set for services.
20327allow init self:{ capability cap_userns } { setuid setgid setpcap };
20328
20329# For bootchart to read the /proc/$pid/cmdline file of each process,
20330# we need to have following line to allow init to have access
20331# to different domains.
20332
20333#line 442
20334allow init domain:dir { open getattr read search ioctl lock };
20335#line 442
20336allow init domain:{ file lnk_file } { getattr open read ioctl lock map };
20337#line 442
20338
20339
20340# Use setexeccon(), setfscreatecon(), and setsockcreatecon().
20341# setexec is for services with seclabel options.
20342# setfscreate is for labeling directories and socket files.
20343# setsockcreate is for labeling local/unix domain sockets.
20344allow init self:process { setexec setfscreate setsockcreate };
20345
20346# Get file context
20347allow init file_contexts_file:file { getattr open read ioctl lock map };
20348
20349# sepolicy access
20350allow init sepolicy_file:file { getattr open read ioctl lock map };
20351
20352# Perform SELinux access checks on setting properties.
20353
20354#line 457
20355
20356#line 457
20357allow init selinuxfs:dir { open getattr read search ioctl lock };
20358#line 457
20359allow init selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
20360#line 457
20361
20362#line 457
20363allow init selinuxfs:file { open append write lock map };
20364#line 457
20365allow init kernel:security compute_av;
20366#line 457
20367allow init self:netlink_selinux_socket { read write create getattr setattr lock relabelfrom relabelto append bind connect listen accept getopt setopt shutdown recvfrom sendto name_bind };
20368#line 457
20369
20370
20371# Ask the kernel for the new context on services to label their sockets.
20372allow init kernel:security compute_create;
20373
20374# Create sockets for the services.
20375allow init domain:unix_stream_socket { create bind setopt };
20376allow init domain:unix_dgram_socket { create bind setopt };
20377
20378# Create /data/property and files within it.
20379allow init property_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20380allow init property_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20381
20382# Set any property.
20383allow init property_type:property_service set;
20384
20385# Send an SELinux userspace denial to the kernel audit subsystem,
20386# so it can be picked up and processed by logd. These denials are
20387# generated when an attempt to set a property is denied by policy.
20388allow init self:netlink_audit_socket { { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } } nlmsg_relay };
20389allow init self:{ capability cap_userns } audit_write;
20390
20391# Run "ifup lo" to bring up the localhost interface
20392allow init self:udp_socket { create ioctl };
20393# in addition to unpriv ioctls granted to all domains, init also needs:
20394allowxperm init self:udp_socket ioctl 0x00008914;
20395allow init self:{ capability cap_userns } net_raw;
20396
20397# Set scheduling info for psi monitor thread.
20398allow init kernel:process { getsched setsched };
20399
20400# swapon() needs write access to swap device
20401# system/core/fs_mgr/fs_mgr.c - fs_mgr_swapon_all
20402allow init swap_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
20403
20404# Read from /dev/hw_random if present.
20405# system/core/init/init.c - mix_hwrng_into_linux_rng_action
20406allow init hw_random_device:chr_file { getattr open read ioctl lock map };
20407
20408# Create and access /dev files without a specific type,
20409# e.g. /dev/.coldboot_done, /dev/.booting
20410# TODO:  Move these files into their own type unless they are
20411# only ever accessed by init.
20412allow init device:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20413
20414# keychord retrieval from /dev/input/ devices
20415allow init input_device:dir { open getattr read search ioctl lock };
20416allow init input_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
20417
20418# Access device mapper for setting up dm-verity
20419allow init dm_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
20420allow init dm_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
20421
20422# Access metadata block device for storing dm-verity state
20423allow init metadata_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
20424
20425# Read /sys/fs/pstore/console-ramoops to detect restarts caused
20426# by dm-verity detecting corrupted blocks
20427allow init pstorefs:dir search;
20428allow init pstorefs:file { getattr open read ioctl lock map };
20429allow init kernel:system syslog_read;
20430
20431# linux keyring configuration
20432allow init init:key { write search setattr };
20433
20434# Allow init to create /data/unencrypted
20435allow init unencrypted_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20436
20437# Set encryption policy on dirs in /data
20438allowxperm init data_file_type:dir ioctl {
20439  0x400c6615
20440  0x800c6613
20441};
20442
20443# Allow init to write to /proc/sys/vm/overcommit_memory
20444allow init proc_overcommit_memory:file { write };
20445
20446# Raw writes to misc block device
20447allow init misc_block_device:blk_file { open append write lock map };
20448
20449
20450#line 537
20451allow init system_file:dir { open getattr read search ioctl lock };
20452#line 537
20453allow init system_file:{ file lnk_file } { getattr open read ioctl lock map };
20454#line 537
20455
20456
20457#line 538
20458allow init vendor_file_type:dir { open getattr read search ioctl lock };
20459#line 538
20460allow init vendor_file_type:{ file lnk_file } { getattr open read ioctl lock map };
20461#line 538
20462
20463
20464allow init system_data_file:file { getattr read };
20465allow init system_data_file:lnk_file { getattr open read ioctl lock map };
20466
20467# For init to be able to run shell scripts from vendor
20468allow init vendor_shell_exec:file execute;
20469
20470# Metadata setup
20471allow init vold_metadata_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20472allow init vold_metadata_file:file getattr;
20473
20474# Allow init to use binder
20475
20476#line 551
20477# Call the servicemanager and transfer references to it.
20478#line 551
20479allow init servicemanager:binder { call transfer };
20480#line 551
20481# servicemanager performs getpidcon on clients.
20482#line 551
20483allow servicemanager init:dir search;
20484#line 551
20485allow servicemanager init:file { read open };
20486#line 551
20487allow servicemanager init:process getattr;
20488#line 551
20489# rw access to /dev/binder and /dev/ashmem is presently granted to
20490#line 551
20491# all domains in domain.te.
20492#line 551
20493;
20494allow init apex_service:service_manager find;
20495# Allow servicemanager to pass it
20496allow servicemanager init:binder transfer;
20497# Allow calls from init to apexd
20498allow init apexd:binder call;
20499
20500# Allow init to touch PSI monitors
20501allow init proc_pressure_mem:file { { { getattr open read ioctl lock map } { open append write lock map } } setattr };
20502
20503# init is using bootstrap bionic
20504allow init system_bootstrap_lib_file:dir { open getattr read search ioctl lock };
20505allow init system_bootstrap_lib_file:file { execute read open getattr map };
20506
20507###
20508### neverallow rules
20509###
20510
20511# The init domain is only entered via an exec based transition from the
20512# kernel domain, never via setcon().
20513neverallow domain init:process dyntransition;
20514neverallow { domain -kernel } init:process transition;
20515neverallow init { file_type fs_type -init_exec }:file entrypoint;
20516
20517# Never read/follow symlinks created by shell or untrusted apps.
20518neverallow init shell_data_file:lnk_file read;
20519neverallow init { app_data_file privapp_data_file }:lnk_file read;
20520
20521# init should never execute a program without changing to another domain.
20522neverallow init { file_type fs_type }:file execute_no_trans;
20523
20524# init can only find the APEX service
20525neverallow init { service_manager_type -apex_service }:service_manager { find };
20526# init can never add binder services
20527neverallow init service_manager_type:service_manager { add };
20528# init can never list binder services
20529neverallow init servicemanager:service_manager list;
20530
20531# Init should not be creating subdirectories in /data/local/tmp
20532neverallow init shell_data_file:dir { write add_name remove_name };
20533
20534# Init should not access sysfs node that are not explicitly labeled.
20535neverallow init sysfs:file { open read write };
20536
20537# No domain should be allowed to ptrace init.
20538neverallow * init:process ptrace;
20539#line 1 "system/sepolicy/prebuilts/api/29.0/public/inputflinger.te"
20540# inputflinger
20541type inputflinger, domain;
20542type inputflinger_exec, system_file_type, exec_type, file_type;
20543
20544
20545#line 5
20546# Call the servicemanager and transfer references to it.
20547#line 5
20548allow inputflinger servicemanager:binder { call transfer };
20549#line 5
20550# servicemanager performs getpidcon on clients.
20551#line 5
20552allow servicemanager inputflinger:dir search;
20553#line 5
20554allow servicemanager inputflinger:file { read open };
20555#line 5
20556allow servicemanager inputflinger:process getattr;
20557#line 5
20558# rw access to /dev/binder and /dev/ashmem is presently granted to
20559#line 5
20560# all domains in domain.te.
20561#line 5
20562
20563
20564#line 6
20565typeattribute inputflinger binderservicedomain;
20566#line 6
20567
20568
20569
20570#line 8
20571# Call the server domain and optionally transfer references to it.
20572#line 8
20573allow inputflinger system_server:binder { call transfer };
20574#line 8
20575# Allow the serverdomain to transfer references to the client on the reply.
20576#line 8
20577allow system_server inputflinger:binder transfer;
20578#line 8
20579# Receive and use open files from the server.
20580#line 8
20581allow inputflinger system_server:fd use;
20582#line 8
20583
20584
20585
20586#line 10
20587# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
20588#line 10
20589# deprecated.
20590#line 10
20591# Access /sys/power/wake_lock and /sys/power/wake_unlock
20592#line 10
20593allow inputflinger sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
20594#line 10
20595# Accessing these files requires CAP_BLOCK_SUSPEND
20596#line 10
20597allow inputflinger self:{ capability2 cap2_userns } block_suspend;
20598#line 10
20599# system_suspend permissions
20600#line 10
20601
20602#line 10
20603# Call the server domain and optionally transfer references to it.
20604#line 10
20605allow inputflinger system_suspend_server:binder { call transfer };
20606#line 10
20607# Allow the serverdomain to transfer references to the client on the reply.
20608#line 10
20609allow system_suspend_server inputflinger:binder transfer;
20610#line 10
20611# Receive and use open files from the server.
20612#line 10
20613allow inputflinger system_suspend_server:fd use;
20614#line 10
20615
20616#line 10
20617allow inputflinger system_suspend_hwservice:hwservice_manager find;
20618#line 10
20619# halclientdomain permissions
20620#line 10
20621
20622#line 10
20623# Call the hwservicemanager and transfer references to it.
20624#line 10
20625allow inputflinger hwservicemanager:binder { call transfer };
20626#line 10
20627# Allow hwservicemanager to send out callbacks
20628#line 10
20629allow hwservicemanager inputflinger:binder { call transfer };
20630#line 10
20631# hwservicemanager performs getpidcon on clients.
20632#line 10
20633allow hwservicemanager inputflinger:dir search;
20634#line 10
20635allow hwservicemanager inputflinger:file { read open map };
20636#line 10
20637allow hwservicemanager inputflinger:process getattr;
20638#line 10
20639# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
20640#line 10
20641# all domains in domain.te.
20642#line 10
20643
20644#line 10
20645
20646#line 10
20647allow inputflinger hwservicemanager_prop:file { getattr open read map };
20648#line 10
20649
20650#line 10
20651allow inputflinger hidl_manager_hwservice:hwservice_manager find;
20652#line 10
20653
20654
20655allow inputflinger input_device:dir { open getattr read search ioctl lock };
20656allow inputflinger input_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
20657
20658
20659#line 15
20660allow inputflinger cgroup:dir { open getattr read search ioctl lock };
20661#line 15
20662allow inputflinger cgroup:{ file lnk_file } { getattr open read ioctl lock map };
20663#line 15
20664
20665#line 1 "system/sepolicy/prebuilts/api/29.0/public/install_recovery.te"
20666# service flash_recovery in init.rc
20667type install_recovery, domain;
20668type install_recovery_exec, system_file_type, exec_type, file_type;
20669
20670allow install_recovery self:{ capability cap_userns } { dac_override dac_read_search };
20671
20672# /system/bin/install-recovery.sh is a shell script.
20673# Needs to execute /system/bin/sh
20674allow install_recovery shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
20675
20676# Execute /system/bin/applypatch
20677allow install_recovery system_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
20678
20679
20680allow install_recovery toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
20681
20682# Update the recovery block device based off a diff of the boot block device
20683allow install_recovery block_device:dir search;
20684allow install_recovery boot_block_device:blk_file { getattr open read ioctl lock map };
20685allow install_recovery recovery_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
20686
20687# Create and delete /cache/saved.file
20688allow install_recovery cache_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
20689allow install_recovery cache_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20690
20691# Write to /proc/sys/vm/drop_caches
20692allow install_recovery proc_drop_caches:file { open append write lock map };
20693#line 1 "system/sepolicy/prebuilts/api/29.0/public/installd.te"
20694# installer daemon
20695type installd, domain;
20696type installd_exec, system_file_type, exec_type, file_type;
20697typeattribute installd mlstrustedsubject;
20698allow installd self:{ capability cap_userns } { chown dac_override dac_read_search fowner fsetid setgid setuid sys_admin };
20699
20700# Allow labeling of files under /data/app/com.example/oat/
20701allow installd dalvikcache_data_file:dir relabelto;
20702allow installd dalvikcache_data_file:file { relabelto link };
20703
20704# Allow movement of APK files between volumes
20705allow installd apk_data_file:dir { { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } } relabelfrom };
20706allow installd apk_data_file:file { { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } } relabelfrom link };
20707allow installd apk_data_file:lnk_file { create { getattr open read ioctl lock map } unlink };
20708
20709# FS_IOC_ENABLE_VERITY and FS_IOC_MEASURE_VERITY (or in old implementation used in installd,
20710# FS_IOC_SET_VERITY_MEASUREMENT) ioctls on APKs in /data/app, to support fsverity.
20711# TODO(b/120629632): this path is deprecated, remove when possible.
20712allowxperm installd apk_data_file:file ioctl {
20713  0x6685 0x6686
20714};
20715
20716allow installd asec_apk_file:file { getattr open read ioctl lock map };
20717allow installd apk_tmp_file:file { { getattr open read ioctl lock map } unlink };
20718allow installd apk_tmp_file:dir { relabelfrom { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } } };
20719allow installd oemfs:dir { open getattr read search ioctl lock };
20720allow installd oemfs:file { getattr open read ioctl lock map };
20721allow installd cgroup:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20722allow installd mnt_expand_file:dir { search getattr };
20723# Check validity of SELinux context before use.
20724
20725#line 31
20726
20727#line 31
20728allow installd selinuxfs:dir { open getattr read search ioctl lock };
20729#line 31
20730allow installd selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
20731#line 31
20732
20733#line 31
20734allow installd selinuxfs:file { open append write lock map };
20735#line 31
20736allow installd kernel:security check_context;
20737#line 31
20738
20739
20740
20741#line 33
20742allow installd rootfs:dir { open getattr read search ioctl lock };
20743#line 33
20744allow installd rootfs:{ file lnk_file } { getattr open read ioctl lock map };
20745#line 33
20746
20747# Scan through APKs in /system/app and /system/priv-app
20748
20749#line 35
20750allow installd system_file:dir { open getattr read search ioctl lock };
20751#line 35
20752allow installd system_file:{ file lnk_file } { getattr open read ioctl lock map };
20753#line 35
20754
20755# Scan through APKs in /vendor/app
20756
20757#line 37
20758allow installd vendor_app_file:dir { open getattr read search ioctl lock };
20759#line 37
20760allow installd vendor_app_file:{ file lnk_file } { getattr open read ioctl lock map };
20761#line 37
20762
20763# Scan through JARs in /vendor/framework
20764
20765#line 39
20766allow installd vendor_framework_file:dir { open getattr read search ioctl lock };
20767#line 39
20768allow installd vendor_framework_file:{ file lnk_file } { getattr open read ioctl lock map };
20769#line 39
20770
20771# Scan through Runtime Resource Overlay APKs in /vendor/overlay
20772
20773#line 41
20774allow installd vendor_overlay_file:dir { open getattr read search ioctl lock };
20775#line 41
20776allow installd vendor_overlay_file:{ file lnk_file } { getattr open read ioctl lock map };
20777#line 41
20778
20779# Get file context
20780allow installd file_contexts_file:file { getattr open read ioctl lock map };
20781# Get seapp_context
20782allow installd seapp_contexts_file:file { getattr open read ioctl lock map };
20783
20784# Search /data/app-asec and stat files in it.
20785allow installd asec_image_file:dir search;
20786allow installd asec_image_file:file getattr;
20787
20788# Create /data/user and /data/user/0 if necessary.
20789# Also required to initially create /data/data subdirectories
20790# and lib symlinks before the setfilecon call.  May want to
20791# move symlink creation after setfilecon in installd.
20792allow installd system_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20793# Also, allow read for lnk_file so that we can process /data/user/0 links when
20794# optimizing application code.
20795allow installd system_data_file:lnk_file { create getattr read setattr unlink };
20796
20797# Upgrade /data/media for multi-user if necessary.
20798allow installd media_rw_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20799allow installd media_rw_data_file:file { getattr unlink };
20800# restorecon new /data/media directory.
20801allow installd system_data_file:dir relabelfrom;
20802allow installd media_rw_data_file:dir relabelto;
20803
20804# Delete /data/media files through sdcardfs, instead of going behind its back
20805allow installd tmpfs:dir { open getattr read search ioctl lock };
20806allow installd storage_file:dir search;
20807allow installd sdcard_type:dir { search open read write remove_name getattr rmdir };
20808allow installd sdcard_type:file { getattr unlink };
20809
20810# Upgrade /data/misc/keychain for multi-user if necessary.
20811allow installd misc_user_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20812allow installd misc_user_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20813allow installd keychain_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20814allow installd keychain_data_file:file {{ getattr open read ioctl lock map } unlink};
20815
20816# Create /data/.layout_version.* file
20817allow installd install_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20818
20819# Create files under /data/dalvik-cache.
20820allow installd dalvikcache_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20821allow installd dalvikcache_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20822allow installd dalvikcache_data_file:lnk_file getattr;
20823
20824# Create files under /data/resource-cache.
20825allow installd resourcecache_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
20826allow installd resourcecache_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20827
20828# Upgrade from unlabeled userdata.
20829# Just need enough to remove and/or relabel it.
20830allow installd unlabeled:dir { getattr search relabelfrom { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } rmdir };
20831allow installd unlabeled:{ file lnk_file sock_file fifo_file } { getattr relabelfrom rename unlink setattr };
20832# Read pkg.apk file for input during dexopt.
20833allow installd unlabeled:file { getattr open read ioctl lock map };
20834
20835# Upgrade from before system_app_data_file was used for system UID apps.
20836# Just need enough to relabel it and to unlink removed package files.
20837# Directory access covered by earlier rule above.
20838allow installd system_data_file:{ file lnk_file sock_file fifo_file } { getattr relabelfrom unlink };
20839
20840# Manage /data/data subdirectories, including initially labeling them
20841# upon creation via setfilecon or running restorecon_recursive,
20842# setting owner/mode, creating symlinks within them, and deleting them
20843# upon package uninstall.
20844# Types extracted from seapp_contexts type= fields.
20845allow installd {
20846    system_app_data_file
20847    bluetooth_data_file
20848    nfc_data_file
20849    radio_data_file
20850    shell_data_file
20851    app_data_file
20852    privapp_data_file
20853}:dir { { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } } relabelfrom relabelto };
20854
20855allow installd {
20856    system_app_data_file
20857    bluetooth_data_file
20858    nfc_data_file
20859    radio_data_file
20860    shell_data_file
20861    app_data_file
20862    privapp_data_file
20863}:{ file lnk_file sock_file fifo_file } { { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } } relabelfrom relabelto };
20864
20865# Similar for the files under /data/misc/profiles/
20866allow installd user_profile_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20867allow installd user_profile_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20868allow installd user_profile_data_file:dir rmdir;
20869allow installd user_profile_data_file:file unlink;
20870
20871# Files created/updated by profman dumps.
20872allow installd profman_dump_data_file:dir { search add_name write };
20873allow installd profman_dump_data_file:file { create setattr open write };
20874
20875# Create and use pty created by android_fork_execvp().
20876allow installd devpts:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
20877
20878# execute toybox for app relocation
20879allow installd toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
20880
20881# Allow installd to publish a binder service and make binder calls.
20882
20883#line 145
20884# Call the servicemanager and transfer references to it.
20885#line 145
20886allow installd servicemanager:binder { call transfer };
20887#line 145
20888# servicemanager performs getpidcon on clients.
20889#line 145
20890allow servicemanager installd:dir search;
20891#line 145
20892allow servicemanager installd:file { read open };
20893#line 145
20894allow servicemanager installd:process getattr;
20895#line 145
20896# rw access to /dev/binder and /dev/ashmem is presently granted to
20897#line 145
20898# all domains in domain.te.
20899#line 145
20900
20901
20902#line 146
20903  allow installd installd_service:service_manager { add find };
20904#line 146
20905  neverallow { domain -installd } installd_service:service_manager add;
20906#line 146
20907
20908allow installd dumpstate:fifo_file  { getattr write };
20909
20910# Allow installd to call into the system server so it can check permissions.
20911
20912#line 150
20913# Call the server domain and optionally transfer references to it.
20914#line 150
20915allow installd system_server:binder { call transfer };
20916#line 150
20917# Allow the serverdomain to transfer references to the client on the reply.
20918#line 150
20919allow system_server installd:binder transfer;
20920#line 150
20921# Receive and use open files from the server.
20922#line 150
20923allow installd system_server:fd use;
20924#line 150
20925
20926allow installd permission_service:service_manager find;
20927
20928# Allow installd to read and write quotas
20929allow installd block_device:dir { search };
20930allow installd labeledfs:filesystem { quotaget quotamod };
20931
20932# Allow installd to delete from /data/preloads when trimming data caches
20933# TODO b/34690396 Remove when time-based purge policy for preloads is implemented in system_server
20934allow installd preloads_data_file:file { { getattr open read ioctl lock map } unlink };
20935allow installd preloads_data_file:dir { { open getattr read search ioctl lock } write remove_name rmdir };
20936allow installd preloads_media_file:file { { getattr open read ioctl lock map } unlink };
20937allow installd preloads_media_file:dir { { open getattr read search ioctl lock } write remove_name rmdir };
20938
20939###
20940### Neverallow rules
20941###
20942
20943# only system_server, installd and dumpstate may interact with installd over binder
20944neverallow { domain -system_server -dumpstate -installd } installd_service:service_manager find;
20945neverallow { domain -system_server -dumpstate } installd:binder call;
20946neverallow installd {
20947    domain
20948    -ashmemd
20949    -system_server
20950    -servicemanager
20951
20952}:binder call;
20953#line 1 "system/sepolicy/prebuilts/api/29.0/public/iorapd.te"
20954# volume manager
20955type iorapd, domain;
20956type iorapd_exec, exec_type, file_type, system_file_type;
20957type iorapd_tmpfs, file_type;
20958
20959
20960#line 6
20961allow iorapd rootfs:dir { open getattr read search ioctl lock };
20962#line 6
20963allow iorapd rootfs:{ file lnk_file } { getattr open read ioctl lock map };
20964#line 6
20965
20966
20967# Allow read/write /proc/sys/vm/drop/caches
20968allow iorapd proc_drop_caches:file { { getattr open read ioctl lock map } { open append write lock map } };
20969
20970# Give iorapd a place where only iorapd can store files; everyone else is off limits
20971allow iorapd iorapd_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
20972allow iorapd iorapd_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
20973
20974# Allow iorapd to publish a binder service and make binder calls.
20975
20976#line 16
20977# Call the servicemanager and transfer references to it.
20978#line 16
20979allow iorapd servicemanager:binder { call transfer };
20980#line 16
20981# servicemanager performs getpidcon on clients.
20982#line 16
20983allow servicemanager iorapd:dir search;
20984#line 16
20985allow servicemanager iorapd:file { read open };
20986#line 16
20987allow servicemanager iorapd:process getattr;
20988#line 16
20989# rw access to /dev/binder and /dev/ashmem is presently granted to
20990#line 16
20991# all domains in domain.te.
20992#line 16
20993
20994
20995#line 17
20996  allow iorapd iorapd_service:service_manager { add find };
20997#line 17
20998  neverallow { domain -iorapd } iorapd_service:service_manager add;
20999#line 17
21000
21001
21002# Allow iorapd to call into the system server so it can check permissions.
21003
21004#line 20
21005# Call the server domain and optionally transfer references to it.
21006#line 20
21007allow iorapd system_server:binder { call transfer };
21008#line 20
21009# Allow the serverdomain to transfer references to the client on the reply.
21010#line 20
21011allow system_server iorapd:binder transfer;
21012#line 20
21013# Receive and use open files from the server.
21014#line 20
21015allow iorapd system_server:fd use;
21016#line 20
21017
21018allow iorapd permission_service:service_manager find;
21019# IUserManager
21020allow iorapd user_service:service_manager find;
21021# IPackageManagerNative
21022allow iorapd package_native_service:service_manager find;
21023
21024# talk to batteryservice
21025
21026#line 28
21027# Call the server domain and optionally transfer references to it.
21028#line 28
21029allow iorapd healthd:binder { call transfer };
21030#line 28
21031# Allow the serverdomain to transfer references to the client on the reply.
21032#line 28
21033allow healthd iorapd:binder transfer;
21034#line 28
21035# Receive and use open files from the server.
21036#line 28
21037allow iorapd healthd:fd use;
21038#line 28
21039
21040
21041# TODO: does each of the service_manager allow finds above need the binder_call?
21042
21043# iorapd temporarily changes its priority when running benchmarks
21044allow iorapd self:{ capability cap_userns } sys_nice;
21045
21046# Allow to access Perfetto traced's privileged consumer socket to start/stop
21047# tracing sessions and read trace data.
21048
21049#line 37
21050allow iorapd traced_consumer_socket:sock_file write;
21051#line 37
21052allow iorapd traced:unix_stream_socket connectto;
21053#line 37
21054
21055
21056###
21057### neverallow rules
21058###
21059
21060neverallow {
21061    domain
21062    -iorapd
21063} iorapd_data_file:dir ~{ open create read getattr setattr search relabelto ioctl };
21064
21065neverallow {
21066    domain
21067    -init
21068    -iorapd
21069} iorapd_data_file:dir *;
21070
21071neverallow {
21072    domain
21073    -kernel
21074    -iorapd
21075} iorapd_data_file:{ file lnk_file sock_file fifo_file } ~{ relabelto getattr };
21076
21077neverallow {
21078    domain
21079    -init
21080    -kernel
21081    -vendor_init
21082    -iorapd
21083} { iorapd_data_file }:{ file lnk_file sock_file fifo_file } *;
21084
21085# Only system_server can interact with iorapd over binder
21086neverallow { domain -system_server -iorapd } iorapd_service:service_manager find;
21087neverallow iorapd {
21088  domain
21089  -healthd
21090  -servicemanager
21091  -system_server
21092
21093}:binder call;
21094
21095neverallow { domain -init } iorapd:process { transition dyntransition };
21096neverallow iorapd domain:{ tcp_socket udp_socket rawip_socket } *;
21097#line 1 "system/sepolicy/prebuilts/api/29.0/public/isolated_app.te"
21098###
21099### Services with isolatedProcess=true in their manifest.
21100###
21101### This file defines the rules for isolated apps. An "isolated
21102### app" is an APP with UID between AID_ISOLATED_START (99000)
21103### and AID_ISOLATED_END (99999).
21104###
21105
21106type isolated_app, domain;
21107#line 1 "system/sepolicy/prebuilts/api/29.0/public/kernel.te"
21108# Life begins with the kernel.
21109type kernel, domain, mlstrustedsubject;
21110
21111allow kernel self:{ capability cap_userns } sys_nice;
21112
21113# Root fs.
21114
21115#line 7
21116allow kernel rootfs:dir { open getattr read search ioctl lock };
21117#line 7
21118allow kernel rootfs:{ file lnk_file } { getattr open read ioctl lock map };
21119#line 7
21120
21121allow kernel proc_cmdline:file { getattr open read ioctl lock map };
21122
21123# Get SELinux enforcing status.
21124allow kernel selinuxfs:dir { open getattr read search ioctl lock };
21125allow kernel selinuxfs:file { getattr open read ioctl lock map };
21126
21127# Get file contexts during first stage
21128allow kernel file_contexts_file:file { getattr open read ioctl lock map };
21129
21130# Allow init relabel itself.
21131allow kernel rootfs:file relabelfrom;
21132allow kernel init_exec:file relabelto;
21133# TODO: investigate why we need this.
21134allow kernel init:process share;
21135
21136# cgroup filesystem initialization prior to setting the cgroup root directory label.
21137allow kernel unlabeled:dir search;
21138
21139# Mount usbfs.
21140allow kernel usbfs:filesystem mount;
21141allow kernel usbfs:dir search;
21142
21143# Initial setenforce by init prior to switching to init domain.
21144# We use dontaudit instead of allow to prevent a kernel spawned userspace
21145# process from turning off SELinux once enabled.
21146dontaudit kernel self:security setenforce;
21147
21148# Write to /proc/1/oom_adj prior to switching to init domain.
21149allow kernel self:{ capability cap_userns } sys_resource;
21150
21151# Init reboot before switching selinux domains under certain error
21152# conditions. Allow it.
21153# As part of rebooting, init writes "u" to /proc/sysrq-trigger to
21154# remount filesystems read-only. /data is not mounted at this point,
21155# so we could ignore this. For now, we allow it.
21156allow kernel self:{ capability cap_userns } sys_boot;
21157allow kernel proc_sysrq:file { open append write lock map };
21158
21159# Allow writing to /dev/kmsg which was created prior to loading policy.
21160allow kernel tmpfs:chr_file write;
21161
21162# Set checkreqprot by init.rc prior to switching to init domain.
21163allow kernel selinuxfs:file write;
21164allow kernel self:security setcheckreqprot;
21165
21166# kernel thread "loop0", used by the loop block device, for ASECs (b/17158723)
21167allow kernel sdcard_type:file { read write };
21168
21169# f_mtp driver accesses files from kernel context.
21170allow kernel mediaprovider:fd use;
21171
21172# Allow the kernel to read OBB files from app directories. (b/17428116)
21173# Kernel thread "loop0" reads a vold supplied file descriptor.
21174# Fixes CTS tests:
21175#  * android.os.storage.cts.StorageManagerTest#testMountAndUnmountObbNormal
21176#  * android.os.storage.cts.StorageManagerTest#testMountAndUnmountTwoObbs
21177allow kernel vold:fd use;
21178allow kernel { app_data_file privapp_data_file }:file read;
21179allow kernel asec_image_file:file read;
21180
21181# Allow reading loop device in update_engine_unittests. (b/28319454)
21182# and for LTP kernel tests (b/73220071)
21183#line 73
21184
21185
21186# Access to /data/media.
21187# This should be removed if sdcardfs is modified to alter the secontext for its
21188# accesses to the underlying FS.
21189allow kernel media_rw_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
21190allow kernel media_rw_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
21191
21192# Access to /data/misc/vold/virtual_disk.
21193allow kernel vold_data_file:file { read write };
21194
21195# Allow the kernel to read APEX file descriptors and (staged) data files;
21196# Needed because APEX uses the loopback driver, which issues requests from
21197# a kernel thread in earlier kernel version.
21198allow kernel apexd:fd use;
21199allow kernel apex_data_file:file read;
21200allow kernel staging_data_file:file read;
21201
21202# Allow the first-stage init (which is running in the kernel domain) to execute the
21203# dynamic linker when it re-executes /init to switch into the second stage.
21204# Until Linux 4.8, the program interpreter (dynamic linker in this case) is executed
21205# before the domain is switched to the target domain. So, we need to allow the kernel
21206# domain (the source domain) to execute the dynamic linker (system_file type).
21207# TODO(b/110147943) remove these allow rules when we no longer need to support Linux
21208# kernel older than 4.8.
21209allow kernel system_file:file execute;
21210# The label for the dynamic linker is rootfs in the recovery partition. This is because
21211# the recovery partition which is rootfs does not support xattr and thus labeling can't be
21212# done at build-time. All files are by default labeled as rootfs upon booting.
21213#line 104
21214
21215
21216# required by VTS lidbm unit test
21217allow kernel appdomain_tmpfs:file read;
21218
21219###
21220### neverallow rules
21221###
21222
21223# The initial task starts in the kernel domain (assigned via
21224# initial_sid_contexts), but nothing ever transitions to it.
21225neverallow * kernel:process { transition dyntransition };
21226
21227# The kernel domain is never entered via an exec, nor should it
21228# ever execute a program outside the rootfs without changing to another domain.
21229# If you encounter an execute_no_trans denial on the kernel domain, then
21230# possible causes include:
21231# - The program is a kernel usermodehelper.  In this case, define a domain
21232#   for the program and domain_auto_trans() to it.
21233# - You are running an exploit which switched to the init task credentials
21234#   and is then trying to exec a shell or other program.  You lose!
21235neverallow kernel *:file { entrypoint execute_no_trans };
21236
21237# the kernel should not be accessing files owned by other users.
21238# Instead of adding dac_{read_search,override}, fix the unix permissions
21239# on files being accessed.
21240neverallow kernel self:{ capability cap_userns } { dac_override dac_read_search };
21241
21242# Nobody should be ptracing kernel threads
21243neverallow * kernel:process ptrace;
21244#line 1 "system/sepolicy/prebuilts/api/29.0/public/keystore.te"
21245type keystore, domain;
21246type keystore_exec, system_file_type, exec_type, file_type;
21247
21248# keystore daemon
21249typeattribute keystore mlstrustedsubject;
21250
21251#line 6
21252# Call the servicemanager and transfer references to it.
21253#line 6
21254allow keystore servicemanager:binder { call transfer };
21255#line 6
21256# servicemanager performs getpidcon on clients.
21257#line 6
21258allow servicemanager keystore:dir search;
21259#line 6
21260allow servicemanager keystore:file { read open };
21261#line 6
21262allow servicemanager keystore:process getattr;
21263#line 6
21264# rw access to /dev/binder and /dev/ashmem is presently granted to
21265#line 6
21266# all domains in domain.te.
21267#line 6
21268
21269
21270#line 7
21271typeattribute keystore binderservicedomain;
21272#line 7
21273
21274
21275#line 8
21276# Call the server domain and optionally transfer references to it.
21277#line 8
21278allow keystore system_server:binder { call transfer };
21279#line 8
21280# Allow the serverdomain to transfer references to the client on the reply.
21281#line 8
21282allow system_server keystore:binder transfer;
21283#line 8
21284# Receive and use open files from the server.
21285#line 8
21286allow keystore system_server:fd use;
21287#line 8
21288
21289
21290allow keystore keystore_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
21291allow keystore keystore_data_file:{ file lnk_file sock_file fifo_file } { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
21292allow keystore keystore_exec:file { getattr };
21293
21294
21295#line 14
21296  allow keystore keystore_service:service_manager { add find };
21297#line 14
21298  neverallow { domain -keystore } keystore_service:service_manager add;
21299#line 14
21300
21301allow keystore sec_key_att_app_id_provider_service:service_manager find;
21302allow keystore dropbox_service:service_manager find;
21303
21304# Check SELinux permissions.
21305
21306#line 19
21307
21308#line 19
21309allow keystore selinuxfs:dir { open getattr read search ioctl lock };
21310#line 19
21311allow keystore selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
21312#line 19
21313
21314#line 19
21315allow keystore selinuxfs:file { open append write lock map };
21316#line 19
21317allow keystore kernel:security compute_av;
21318#line 19
21319allow keystore self:netlink_selinux_socket { read write create getattr setattr lock relabelfrom relabelto append bind connect listen accept getopt setopt shutdown recvfrom sendto name_bind };
21320#line 19
21321
21322
21323
21324#line 21
21325allow keystore cgroup:dir { open getattr read search ioctl lock };
21326#line 21
21327allow keystore cgroup:{ file lnk_file } { getattr open read ioctl lock map };
21328#line 21
21329
21330
21331###
21332### Neverallow rules
21333###
21334### Protect ourself from others
21335###
21336
21337neverallow { domain -keystore } keystore_data_file:dir ~{ open create read getattr setattr search relabelto ioctl };
21338neverallow { domain -keystore } keystore_data_file:{ file lnk_file sock_file fifo_file } ~{ relabelto getattr };
21339
21340neverallow { domain -keystore -init } keystore_data_file:dir *;
21341neverallow { domain -keystore -init } keystore_data_file:{ file lnk_file sock_file fifo_file } *;
21342
21343neverallow * keystore:process ptrace;
21344#line 1 "system/sepolicy/prebuilts/api/29.0/public/llkd.te"
21345# llkd Live LocK Daemon
21346type llkd, domain, mlstrustedsubject;
21347type llkd_exec, system_file_type, exec_type, file_type;
21348#line 1 "system/sepolicy/prebuilts/api/29.0/public/lmkd.te"
21349# lmkd low memory killer daemon
21350type lmkd, domain, mlstrustedsubject;
21351type lmkd_exec, system_file_type, exec_type, file_type;
21352
21353allow lmkd self:{ capability cap_userns } { dac_override dac_read_search sys_resource kill };
21354
21355# lmkd locks itself in memory, to prevent it from being
21356# swapped out and unable to kill other memory hogs.
21357# system/core commit b28ff9131363f7b4a698990da5748b2a88c3ed35
21358# b/16236289
21359allow lmkd self:{ capability cap_userns } ipc_lock;
21360
21361## Open and write to /proc/PID/oom_score_adj
21362## TODO: maybe scope this down?
21363
21364#line 15
21365allow lmkd appdomain:dir { open getattr read search ioctl lock };
21366#line 15
21367allow lmkd appdomain:{ file lnk_file } { getattr open read ioctl lock map };
21368#line 15
21369
21370allow lmkd appdomain:file write;
21371
21372#line 17
21373allow lmkd system_server:dir { open getattr read search ioctl lock };
21374#line 17
21375allow lmkd system_server:{ file lnk_file } { getattr open read ioctl lock map };
21376#line 17
21377
21378allow lmkd system_server:file write;
21379
21380## Writes to /sys/module/lowmemorykiller/parameters/minfree
21381
21382#line 21
21383allow lmkd sysfs_lowmemorykiller:dir { open getattr read search ioctl lock };
21384#line 21
21385allow lmkd sysfs_lowmemorykiller:{ file lnk_file } { getattr open read ioctl lock map };
21386#line 21
21387
21388allow lmkd sysfs_lowmemorykiller:file { open append write lock map };
21389
21390# setsched and send kill signals
21391allow lmkd appdomain:process { setsched sigkill };
21392allow lmkd kernel:process { setsched };
21393
21394# Clean up old cgroups
21395allow lmkd cgroup:dir { remove_name rmdir };
21396
21397# Allow to read memcg stats
21398allow lmkd cgroup:file { getattr open read ioctl lock map };
21399
21400# Set self to SCHED_FIFO
21401allow lmkd self:{ capability cap_userns } sys_nice;
21402
21403allow lmkd proc_zoneinfo:file { getattr open read ioctl lock map };
21404
21405# Set sys.lmk.* properties.
21406
21407#line 40
21408
21409#line 40
21410allow lmkd property_socket:sock_file write;
21411#line 40
21412allow lmkd init:unix_stream_socket connectto;
21413#line 40
21414
21415#line 40
21416allow lmkd system_lmk_prop:property_service set;
21417#line 40
21418
21419#line 40
21420allow lmkd system_lmk_prop:file { getattr open read map };
21421#line 40
21422
21423#line 40
21424
21425
21426# live lock watchdog process allowed to look through /proc/
21427allow lmkd domain:dir { search open read };
21428allow lmkd domain:file { open read };
21429
21430# live lock watchdog process allowed to dump process trace and
21431# reboot because orderly shutdown may not be possible.
21432allow lmkd proc_sysrq:file { { getattr open read ioctl lock map } { open append write lock map } };
21433
21434# Read /proc/meminfo
21435allow lmkd proc_meminfo:file { getattr open read ioctl lock map };
21436
21437# Read /proc/pressure/cpu and /proc/pressure/io
21438allow lmkd proc_pressure_cpu:file { getattr open read ioctl lock map };
21439allow lmkd proc_pressure_io:file { getattr open read ioctl lock map };
21440
21441# Read/Write /proc/pressure/memory
21442allow lmkd proc_pressure_mem:file { { getattr open read ioctl lock map } { open append write lock map } };
21443
21444# Allow lmkd to write to statsd.
21445
21446#line 61
21447allow lmkd statsdw_socket:sock_file write;
21448#line 61
21449allow lmkd statsd:unix_dgram_socket sendto;
21450#line 61
21451
21452
21453### neverallow rules
21454
21455# never honor LD_PRELOAD
21456neverallow * lmkd:process noatsecure;
21457#line 1 "system/sepolicy/prebuilts/api/29.0/public/logd.te"
21458# android user-space log manager
21459type logd, domain, mlstrustedsubject;
21460type logd_exec, system_file_type, exec_type, file_type;
21461
21462# Read access to pseudo filesystems.
21463
21464#line 6
21465allow logd cgroup:dir { open getattr read search ioctl lock };
21466#line 6
21467allow logd cgroup:{ file lnk_file } { getattr open read ioctl lock map };
21468#line 6
21469
21470
21471#line 7
21472allow logd proc_kmsg:dir { open getattr read search ioctl lock };
21473#line 7
21474allow logd proc_kmsg:{ file lnk_file } { getattr open read ioctl lock map };
21475#line 7
21476
21477
21478#line 8
21479allow logd proc_meminfo:dir { open getattr read search ioctl lock };
21480#line 8
21481allow logd proc_meminfo:{ file lnk_file } { getattr open read ioctl lock map };
21482#line 8
21483
21484
21485allow logd self:{ capability cap_userns } { setuid setgid setpcap sys_nice audit_control };
21486allow logd self:{ capability2 cap2_userns } syslog;
21487allow logd self:netlink_audit_socket { { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } } nlmsg_write };
21488allow logd kernel:system syslog_read;
21489allow logd kmsg_device:chr_file { getattr { open append write lock map } };
21490allow logd system_data_file:{ file lnk_file } { getattr open read ioctl lock map };
21491allow logd packages_list_file:file { getattr open read ioctl lock map };
21492allow logd pstorefs:dir search;
21493allow logd pstorefs:file { getattr open read ioctl lock map };
21494#line 23
21495
21496allow logd runtime_event_log_tags_file:file { { getattr open read ioctl lock map } { open append write lock map } };
21497
21498# Access device logging gating property
21499
21500#line 27
21501allow logd device_logging_prop:file { getattr open read map };
21502#line 27
21503
21504
21505
21506#line 29
21507allow logd domain:dir { open getattr read search ioctl lock };
21508#line 29
21509allow logd domain:{ file lnk_file } { getattr open read ioctl lock map };
21510#line 29
21511
21512
21513allow logd kernel:system syslog_mod;
21514
21515
21516#line 33
21517# Group AID_LOG checked by filesystem & logd
21518#line 33
21519# to permit control commands
21520#line 33
21521
21522#line 33
21523allow logd logd_socket:sock_file write;
21524#line 33
21525allow logd logd:unix_stream_socket connectto;
21526#line 33
21527
21528#line 33
21529
21530
21531#line 34
21532allow logd runtime_event_log_tags_file:file { getattr open read ioctl lock map };
21533#line 34
21534
21535
21536allow runtime_event_log_tags_file tmpfs:filesystem associate;
21537# Typically harmlessly blindly trying to access via liblog
21538# event tag mapping while in the untrusted_app domain.
21539# Access for that domain is controlled and gated via the
21540# event log tag service (albeit at a performance penalty,
21541# expected to be locally cached).
21542dontaudit domain runtime_event_log_tags_file:file { map open read };
21543
21544###
21545### Neverallow rules
21546###
21547### logd should NEVER do any of this
21548
21549# Block device access.
21550neverallow logd dev_type:blk_file { read write };
21551
21552# ptrace any other app
21553neverallow logd domain:process ptrace;
21554
21555# ... and nobody may ptrace me (except on userdebug or eng builds)
21556neverallow { domain  } logd:process ptrace;
21557
21558# Write to /system.
21559neverallow logd system_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
21560
21561# Write to files in /data/data or system files on /data
21562neverallow logd { app_data_file privapp_data_file system_data_file packages_list_file }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
21563
21564# Only init is allowed to enter the logd domain via exec()
21565neverallow { domain -init } logd:process transition;
21566neverallow * logd:process dyntransition;
21567
21568# protect the event-log-tags file
21569neverallow {
21570  domain
21571  -init
21572  -logd
21573} runtime_event_log_tags_file:file { append create link unlink relabelfrom rename setattr write };
21574#line 1 "system/sepolicy/prebuilts/api/29.0/public/logpersist.te"
21575# android debug logging, logpersist domains
21576type logpersist, domain;
21577
21578###
21579### Neverallow rules
21580###
21581### logpersist should NEVER do any of this
21582
21583# Block device access.
21584neverallow logpersist dev_type:blk_file { read write };
21585
21586# ptrace any other app
21587neverallow logpersist domain:process ptrace;
21588
21589# Write to files in /data/data or system files on /data except misc_logd_file
21590neverallow logpersist { privapp_data_file app_data_file system_data_file }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
21591
21592# Only init should be allowed to enter the logpersist domain via exec()
21593# Following is a list of debug domains we know that transition to logpersist
21594# neverallow_with_undefined_domains {
21595#   domain
21596#   -init       # goldfish, logcatd, raft
21597#   -mmi        # bat, mtp8996, msmcobalt
21598#   -system_app # Smith.apk
21599# } logpersist:process transition;
21600neverallow * logpersist:process dyntransition;
21601#line 1 "system/sepolicy/prebuilts/api/29.0/public/mdnsd.te"
21602# mdns daemon
21603type mdnsd, domain;
21604#line 1 "system/sepolicy/prebuilts/api/29.0/public/mediadrmserver.te"
21605# mediadrmserver - mediadrm daemon
21606type mediadrmserver, domain;
21607type mediadrmserver_exec, system_file_type, exec_type, file_type;
21608
21609typeattribute mediadrmserver mlstrustedsubject;
21610
21611
21612#line 7
21613typeattribute mediadrmserver netdomain;
21614#line 7
21615
21616
21617#line 8
21618# Call the servicemanager and transfer references to it.
21619#line 8
21620allow mediadrmserver servicemanager:binder { call transfer };
21621#line 8
21622# servicemanager performs getpidcon on clients.
21623#line 8
21624allow servicemanager mediadrmserver:dir search;
21625#line 8
21626allow servicemanager mediadrmserver:file { read open };
21627#line 8
21628allow servicemanager mediadrmserver:process getattr;
21629#line 8
21630# rw access to /dev/binder and /dev/ashmem is presently granted to
21631#line 8
21632# all domains in domain.te.
21633#line 8
21634
21635
21636#line 9
21637# Call the server domain and optionally transfer references to it.
21638#line 9
21639allow mediadrmserver binderservicedomain:binder { call transfer };
21640#line 9
21641# Allow the serverdomain to transfer references to the client on the reply.
21642#line 9
21643allow binderservicedomain mediadrmserver:binder transfer;
21644#line 9
21645# Receive and use open files from the server.
21646#line 9
21647allow mediadrmserver binderservicedomain:fd use;
21648#line 9
21649
21650
21651#line 10
21652# Call the server domain and optionally transfer references to it.
21653#line 10
21654allow mediadrmserver appdomain:binder { call transfer };
21655#line 10
21656# Allow the serverdomain to transfer references to the client on the reply.
21657#line 10
21658allow appdomain mediadrmserver:binder transfer;
21659#line 10
21660# Receive and use open files from the server.
21661#line 10
21662allow mediadrmserver appdomain:fd use;
21663#line 10
21664
21665
21666#line 11
21667typeattribute mediadrmserver binderservicedomain;
21668#line 11
21669
21670
21671#line 12
21672typeattribute mediadrmserver halclientdomain;
21673#line 12
21674typeattribute mediadrmserver hal_drm_client;
21675#line 12
21676
21677#line 12
21678# TODO(b/34170079): Make the inclusion of the rules below conditional also on
21679#line 12
21680# non-Treble devices. For now, on non-Treble device, always grant clients of a
21681#line 12
21682# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
21683#line 12
21684
21685#line 12
21686
21687
21688
21689#line 14
21690  allow mediadrmserver mediadrmserver_service:service_manager { add find };
21691#line 14
21692  neverallow { domain -mediadrmserver } mediadrmserver_service:service_manager add;
21693#line 14
21694
21695allow mediadrmserver mediaserver_service:service_manager find;
21696allow mediadrmserver mediametrics_service:service_manager find;
21697allow mediadrmserver processinfo_service:service_manager find;
21698allow mediadrmserver surfaceflinger_service:service_manager find;
21699allow mediadrmserver system_file:dir { open getattr read search ioctl lock };
21700
21701# TODO(b/80317992): remove
21702
21703#line 22
21704# Call the server domain and optionally transfer references to it.
21705#line 22
21706allow mediadrmserver hal_omx_server:binder { call transfer };
21707#line 22
21708# Allow the serverdomain to transfer references to the client on the reply.
21709#line 22
21710allow hal_omx_server mediadrmserver:binder transfer;
21711#line 22
21712# Receive and use open files from the server.
21713#line 22
21714allow mediadrmserver hal_omx_server:fd use;
21715#line 22
21716
21717
21718###
21719### neverallow rules
21720###
21721
21722# mediadrmserver should never execute any executable without a
21723# domain transition
21724neverallow mediadrmserver { file_type fs_type }:file execute_no_trans;
21725
21726# do not allow privileged socket ioctl commands
21727neverallowxperm mediadrmserver domain:{ rawip_socket tcp_socket udp_socket } ioctl
21728#line 33
21729{
21730#line 33
21731# qualcomm rmnet ioctls
21732#line 33
217330x00006900 0x00006902
21734#line 33
21735# socket ioctls
21736#line 33
217370x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
21738#line 33
217390x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
21740#line 33
217410x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
21742#line 33
217430x00008927 0x00008929 0x00008930 0x00008931 0x00008932
21744#line 33
217450x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
21746#line 33
217470x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
21748#line 33
217490x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
21750#line 33
217510x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
21752#line 33
217530x00008991 0x00008992 0x00008993 0x00008994
21754#line 33
217550x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
21756#line 33
21757# device and protocol specific ioctls
21758#line 33
217590x000089f0-0x000089ff
21760#line 33
217610x000089e0-0x000089ef
21762#line 33
21763# Wireless extension ioctls
21764#line 33
217650x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
21766#line 33
217670x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
21768#line 33
217690x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
21770#line 33
217710x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
21772#line 33
217730x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
21774#line 33
217750x00008b34 0x00008b35 0x00008b36
21776#line 33
21777# Dev private ioctl i.e. hardware specific ioctls
21778#line 33
217790x00008be0-0x00008bff
21780#line 33
21781};
21782#line 1 "system/sepolicy/prebuilts/api/29.0/public/mediaextractor.te"
21783# mediaextractor - multimedia daemon
21784type mediaextractor, domain;
21785type mediaextractor_exec, system_file_type, exec_type, file_type;
21786type mediaextractor_tmpfs, file_type;
21787
21788typeattribute mediaextractor mlstrustedsubject;
21789
21790
21791#line 8
21792# Call the servicemanager and transfer references to it.
21793#line 8
21794allow mediaextractor servicemanager:binder { call transfer };
21795#line 8
21796# servicemanager performs getpidcon on clients.
21797#line 8
21798allow servicemanager mediaextractor:dir search;
21799#line 8
21800allow servicemanager mediaextractor:file { read open };
21801#line 8
21802allow servicemanager mediaextractor:process getattr;
21803#line 8
21804# rw access to /dev/binder and /dev/ashmem is presently granted to
21805#line 8
21806# all domains in domain.te.
21807#line 8
21808
21809
21810#line 9
21811# Call the server domain and optionally transfer references to it.
21812#line 9
21813allow mediaextractor binderservicedomain:binder { call transfer };
21814#line 9
21815# Allow the serverdomain to transfer references to the client on the reply.
21816#line 9
21817allow binderservicedomain mediaextractor:binder transfer;
21818#line 9
21819# Receive and use open files from the server.
21820#line 9
21821allow mediaextractor binderservicedomain:fd use;
21822#line 9
21823
21824
21825#line 10
21826# Call the server domain and optionally transfer references to it.
21827#line 10
21828allow mediaextractor appdomain:binder { call transfer };
21829#line 10
21830# Allow the serverdomain to transfer references to the client on the reply.
21831#line 10
21832allow appdomain mediaextractor:binder transfer;
21833#line 10
21834# Receive and use open files from the server.
21835#line 10
21836allow mediaextractor appdomain:fd use;
21837#line 10
21838
21839
21840#line 11
21841typeattribute mediaextractor binderservicedomain;
21842#line 11
21843
21844
21845
21846#line 13
21847  allow mediaextractor mediaextractor_service:service_manager { add find };
21848#line 13
21849  neverallow { domain -mediaextractor } mediaextractor_service:service_manager add;
21850#line 13
21851
21852allow mediaextractor mediametrics_service:service_manager find;
21853allow mediaextractor hidl_token_hwservice:hwservice_manager find;
21854
21855allow mediaextractor system_server:fd use;
21856
21857
21858#line 19
21859typeattribute mediaextractor halclientdomain;
21860#line 19
21861typeattribute mediaextractor hal_cas_client;
21862#line 19
21863
21864#line 19
21865# TODO(b/34170079): Make the inclusion of the rules below conditional also on
21866#line 19
21867# non-Treble devices. For now, on non-Treble device, always grant clients of a
21868#line 19
21869# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
21870#line 19
21871
21872#line 19
21873
21874
21875#line 20
21876typeattribute mediaextractor halclientdomain;
21877#line 20
21878typeattribute mediaextractor hal_allocator_client;
21879#line 20
21880
21881#line 20
21882# TODO(b/34170079): Make the inclusion of the rules below conditional also on
21883#line 20
21884# non-Treble devices. For now, on non-Treble device, always grant clients of a
21885#line 20
21886# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
21887#line 20
21888
21889#line 20
21890
21891
21892
21893#line 22
21894allow mediaextractor cgroup:dir { open getattr read search ioctl lock };
21895#line 22
21896allow mediaextractor cgroup:{ file lnk_file } { getattr open read ioctl lock map };
21897#line 22
21898
21899allow mediaextractor proc_meminfo:file { getattr open read ioctl lock map };
21900
21901
21902#line 25
21903
21904#line 25
21905allow mediaextractor anr_data_file:file append;
21906#line 25
21907allow mediaextractor dumpstate:fd use;
21908#line 25
21909allow mediaextractor incidentd:fd use;
21910#line 25
21911# TODO: Figure out why write is needed.
21912#line 25
21913allow mediaextractor dumpstate:fifo_file { append write };
21914#line 25
21915allow mediaextractor incidentd:fifo_file { append write };
21916#line 25
21917allow mediaextractor system_server:fifo_file { append write };
21918#line 25
21919allow mediaextractor tombstoned:unix_stream_socket connectto;
21920#line 25
21921allow mediaextractor tombstoned:fd use;
21922#line 25
21923allow mediaextractor tombstoned_crash_socket:sock_file write;
21924#line 25
21925allow mediaextractor tombstone_data_file:file append;
21926#line 25
21927
21928
21929# allow mediaextractor read permissions for file sources
21930allow mediaextractor sdcard_type:file { getattr read };
21931allow mediaextractor media_rw_data_file:file { getattr read };
21932allow mediaextractor { app_data_file privapp_data_file }:file { getattr read };
21933
21934# Read resources from open apk files passed over Binder
21935allow mediaextractor apk_data_file:file { read getattr };
21936allow mediaextractor asec_apk_file:file { read getattr };
21937allow mediaextractor ringtone_file:file { read getattr };
21938
21939# scan extractor library directory to dynamically load extractors
21940allow mediaextractor system_file:dir { read open };
21941
21942
21943#line 40
21944allow mediaextractor device_config_media_native_prop:file { getattr open read map };
21945#line 40
21946
21947
21948###
21949### neverallow rules
21950###
21951
21952# mediaextractor should never execute any executable without a
21953# domain transition
21954neverallow mediaextractor { file_type fs_type }:file execute_no_trans;
21955
21956# The goal of the mediaserver split is to place media processing code into
21957# restrictive sandboxes with limited responsibilities and thus limited
21958# permissions. Example: Audioserver is only responsible for controlling audio
21959# hardware and processing audio content. Cameraserver does the same for camera
21960# hardware/content. Etc.
21961#
21962# Media processing code is inherently risky and thus should have limited
21963# permissions and be isolated from the rest of the system and network.
21964# Lengthier explanation here:
21965# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
21966neverallow mediaextractor domain:{ tcp_socket udp_socket rawip_socket } *;
21967
21968# mediaextractor should not be opening /data files directly. Any files
21969# it touches (with a few exceptions) need to be passed to it via a file
21970# descriptor opened outside the process.
21971neverallow mediaextractor {
21972  data_file_type
21973  -zoneinfo_data_file # time zone data from /data/misc/zoneinfo
21974   # for loading media extractor plugins
21975
21976}:file open;
21977#line 1 "system/sepolicy/prebuilts/api/29.0/public/mediametrics.te"
21978# mediametrics - daemon for collecting media.metrics data
21979type mediametrics, domain;
21980type mediametrics_exec, system_file_type, exec_type, file_type;
21981
21982
21983
21984#line 6
21985# Call the servicemanager and transfer references to it.
21986#line 6
21987allow mediametrics servicemanager:binder { call transfer };
21988#line 6
21989# servicemanager performs getpidcon on clients.
21990#line 6
21991allow servicemanager mediametrics:dir search;
21992#line 6
21993allow servicemanager mediametrics:file { read open };
21994#line 6
21995allow servicemanager mediametrics:process getattr;
21996#line 6
21997# rw access to /dev/binder and /dev/ashmem is presently granted to
21998#line 6
21999# all domains in domain.te.
22000#line 6
22001
22002
22003#line 7
22004# Call the server domain and optionally transfer references to it.
22005#line 7
22006allow mediametrics binderservicedomain:binder { call transfer };
22007#line 7
22008# Allow the serverdomain to transfer references to the client on the reply.
22009#line 7
22010allow binderservicedomain mediametrics:binder transfer;
22011#line 7
22012# Receive and use open files from the server.
22013#line 7
22014allow mediametrics binderservicedomain:fd use;
22015#line 7
22016
22017
22018#line 8
22019typeattribute mediametrics binderservicedomain;
22020#line 8
22021
22022
22023
22024#line 10
22025  allow mediametrics mediametrics_service:service_manager { add find };
22026#line 10
22027  neverallow { domain -mediametrics } mediametrics_service:service_manager add;
22028#line 10
22029
22030
22031allow mediametrics system_server:fd use;
22032
22033
22034#line 14
22035allow mediametrics cgroup:dir { open getattr read search ioctl lock };
22036#line 14
22037allow mediametrics cgroup:{ file lnk_file } { getattr open read ioctl lock map };
22038#line 14
22039
22040allow mediametrics proc_meminfo:file { getattr open read ioctl lock map };
22041
22042# allows interactions with dumpsys to GMScore
22043allow mediametrics { app_data_file privapp_data_file }:file write;
22044
22045# allow access to package manager for uid->apk mapping
22046allow mediametrics package_native_service:service_manager find;
22047
22048# Allow metrics service to send information to statsd socket.
22049
22050#line 24
22051allow mediametrics statsdw_socket:sock_file write;
22052#line 24
22053allow mediametrics statsd:unix_dgram_socket sendto;
22054#line 24
22055
22056
22057###
22058### neverallow rules
22059###
22060
22061# mediametrics should never execute any executable without a
22062# domain transition
22063neverallow mediametrics { file_type fs_type }:file execute_no_trans;
22064
22065# The goal of the mediaserver split is to place media processing code into
22066# restrictive sandboxes with limited responsibilities and thus limited
22067# permissions. Example: Audioserver is only responsible for controlling audio
22068# hardware and processing audio content. Cameraserver does the same for camera
22069# hardware/content. Etc.
22070#
22071# Media processing code is inherently risky and thus should have limited
22072# permissions and be isolated from the rest of the system and network.
22073# Lengthier explanation here:
22074# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
22075neverallow mediametrics domain:{ tcp_socket udp_socket rawip_socket } *;
22076#line 1 "system/sepolicy/prebuilts/api/29.0/public/mediaprovider.te"
22077###
22078### A domain for android.process.media, which contains both
22079### MediaProvider and DownloadProvider and associated services.
22080###
22081
22082type mediaprovider, domain;
22083#line 1 "system/sepolicy/prebuilts/api/29.0/public/mediaserver.te"
22084# mediaserver - multimedia daemon
22085type mediaserver, domain;
22086type mediaserver_exec, system_file_type, exec_type, file_type;
22087type mediaserver_tmpfs, file_type;
22088
22089typeattribute mediaserver mlstrustedsubject;
22090
22091
22092#line 8
22093typeattribute mediaserver netdomain;
22094#line 8
22095
22096
22097
22098#line 10
22099allow mediaserver sdcard_type:dir { open getattr read search ioctl lock };
22100#line 10
22101allow mediaserver sdcard_type:{ file lnk_file } { getattr open read ioctl lock map };
22102#line 10
22103
22104
22105#line 11
22106allow mediaserver cgroup:dir { open getattr read search ioctl lock };
22107#line 11
22108allow mediaserver cgroup:{ file lnk_file } { getattr open read ioctl lock map };
22109#line 11
22110
22111
22112# stat /proc/self
22113allow mediaserver proc:lnk_file getattr;
22114
22115# open /vendor/lib/mediadrm
22116allow mediaserver system_file:dir { open getattr read search ioctl lock };
22117
22118#line 22
22119
22120
22121
22122#line 24
22123# Call the servicemanager and transfer references to it.
22124#line 24
22125allow mediaserver servicemanager:binder { call transfer };
22126#line 24
22127# servicemanager performs getpidcon on clients.
22128#line 24
22129allow servicemanager mediaserver:dir search;
22130#line 24
22131allow servicemanager mediaserver:file { read open };
22132#line 24
22133allow servicemanager mediaserver:process getattr;
22134#line 24
22135# rw access to /dev/binder and /dev/ashmem is presently granted to
22136#line 24
22137# all domains in domain.te.
22138#line 24
22139
22140
22141#line 25
22142# Call the server domain and optionally transfer references to it.
22143#line 25
22144allow mediaserver binderservicedomain:binder { call transfer };
22145#line 25
22146# Allow the serverdomain to transfer references to the client on the reply.
22147#line 25
22148allow binderservicedomain mediaserver:binder transfer;
22149#line 25
22150# Receive and use open files from the server.
22151#line 25
22152allow mediaserver binderservicedomain:fd use;
22153#line 25
22154
22155
22156#line 26
22157# Call the server domain and optionally transfer references to it.
22158#line 26
22159allow mediaserver appdomain:binder { call transfer };
22160#line 26
22161# Allow the serverdomain to transfer references to the client on the reply.
22162#line 26
22163allow appdomain mediaserver:binder transfer;
22164#line 26
22165# Receive and use open files from the server.
22166#line 26
22167allow mediaserver appdomain:fd use;
22168#line 26
22169
22170
22171#line 27
22172typeattribute mediaserver binderservicedomain;
22173#line 27
22174
22175
22176allow mediaserver media_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
22177allow mediaserver media_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
22178allow mediaserver { app_data_file privapp_data_file }:file { append getattr ioctl lock map read write };
22179allow mediaserver sdcard_type:file write;
22180allow mediaserver gpu_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
22181allow mediaserver video_device:dir { open getattr read search ioctl lock };
22182allow mediaserver video_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
22183
22184
22185#line 37
22186
22187#line 37
22188allow mediaserver property_socket:sock_file write;
22189#line 37
22190allow mediaserver init:unix_stream_socket connectto;
22191#line 37
22192
22193#line 37
22194allow mediaserver audio_prop:property_service set;
22195#line 37
22196
22197#line 37
22198allow mediaserver audio_prop:file { getattr open read map };
22199#line 37
22200
22201#line 37
22202
22203
22204# Read resources from open apk files passed over Binder.
22205allow mediaserver apk_data_file:file { read getattr };
22206allow mediaserver asec_apk_file:file { read getattr };
22207allow mediaserver ringtone_file:file { read getattr };
22208
22209# Read /data/data/com.android.providers.telephony files passed over Binder.
22210allow mediaserver radio_data_file:file { read getattr };
22211
22212# Use pipes passed over Binder from app domains.
22213allow mediaserver appdomain:fifo_file { getattr read write };
22214
22215allow mediaserver rpmsg_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
22216
22217# Inter System processes communicate over named pipe (FIFO)
22218allow mediaserver system_server:fifo_file { getattr open read ioctl lock map };
22219
22220
22221#line 55
22222allow mediaserver media_rw_data_file:dir { open getattr read search ioctl lock };
22223#line 55
22224allow mediaserver media_rw_data_file:{ file lnk_file } { getattr open read ioctl lock map };
22225#line 55
22226
22227
22228# Grant access to read files on appfuse.
22229allow mediaserver app_fuse_file:file { read getattr };
22230
22231# Needed on some devices for playing DRM protected content,
22232# but seems expected and appropriate for all devices.
22233
22234#line 62
22235allow mediaserver drmserver_socket:sock_file write;
22236#line 62
22237allow mediaserver drmserver:unix_stream_socket connectto;
22238#line 62
22239
22240
22241# Needed on some devices for playing audio on paired BT device,
22242# but seems appropriate for all devices.
22243
22244#line 66
22245allow mediaserver bluetooth_socket:sock_file write;
22246#line 66
22247allow mediaserver bluetooth:unix_stream_socket connectto;
22248#line 66
22249
22250
22251
22252#line 68
22253  allow mediaserver mediaserver_service:service_manager { add find };
22254#line 68
22255  neverallow { domain -mediaserver } mediaserver_service:service_manager add;
22256#line 68
22257
22258allow mediaserver activity_service:service_manager find;
22259allow mediaserver appops_service:service_manager find;
22260allow mediaserver audio_service:service_manager find;
22261allow mediaserver audioserver_service:service_manager find;
22262allow mediaserver cameraserver_service:service_manager find;
22263allow mediaserver batterystats_service:service_manager find;
22264allow mediaserver drmserver_service:service_manager find;
22265allow mediaserver mediaextractor_service:service_manager find;
22266allow mediaserver mediacodec_service:service_manager find;
22267allow mediaserver mediametrics_service:service_manager find;
22268allow mediaserver media_session_service:service_manager find;
22269allow mediaserver permission_service:service_manager find;
22270allow mediaserver power_service:service_manager find;
22271allow mediaserver processinfo_service:service_manager find;
22272allow mediaserver scheduling_policy_service:service_manager find;
22273allow mediaserver surfaceflinger_service:service_manager find;
22274
22275# for ModDrm/MediaPlayer
22276allow mediaserver mediadrmserver_service:service_manager find;
22277
22278# For hybrid interfaces
22279allow mediaserver hidl_token_hwservice:hwservice_manager find;
22280
22281# /oem access
22282allow mediaserver oemfs:dir search;
22283allow mediaserver oemfs:file { getattr open read ioctl lock map };
22284
22285# /vendor apk access
22286allow mediaserver vendor_app_file:file { read map getattr };
22287
22288
22289#line 99
22290  allow drmserver mediaserver:dir search;
22291#line 99
22292  allow drmserver mediaserver:file { read open };
22293#line 99
22294  allow drmserver mediaserver:process getattr;
22295#line 99
22296
22297allow mediaserver drmserver:drmservice {
22298    consumeRights
22299    setPlaybackStatus
22300    openDecryptSession
22301    closeDecryptSession
22302    initializeDecryptUnit
22303    decrypt
22304    finalizeDecryptUnit
22305    pread
22306};
22307
22308# only allow unprivileged socket ioctl commands
22309allowxperm mediaserver self:{ rawip_socket tcp_socket udp_socket }
22310  ioctl {
22311#line 113
22312{
22313#line 113
22314# Socket ioctls for gathering information about the interface
22315#line 113
223160x00008906 0x00008907
22317#line 113
223180x00008910 0x00008912 0x00008913 0x00008915 0x00008917 0x00008919
22319#line 113
223200x0000891b 0x00008921 0x00008933 0x00008938 0x00008942
22321#line 113
22322# Wireless extension ioctls. Primarily get functions.
22323#line 113
223240x00008b01 0x00008b05 0x00008b07 0x00008b09 0x00008b0b 0x00008b0d
22325#line 113
223260x00008b0f 0x00008b11 0x00008b12 0x00008b13 0x00008b21 0x00008b23
22327#line 113
223280x00008b25 0x00008b27 0x00008b29 0x00008b2d
22329#line 113
22330} {
22331#line 113
22332  0x00005411 0x00005451 0x00005450 0x00005401 0x00005402 0x00005413 0x00005414 0x0000540e
22333#line 113
22334  0x00005403 0x0000540b 0x00005410 0x0000540f
22335#line 113
22336} };
22337
22338# Access to /data/media.
22339# This should be removed if sdcardfs is modified to alter the secontext for its
22340# accesses to the underlying FS.
22341allow mediaserver media_rw_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
22342allow mediaserver media_rw_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
22343
22344# Access to media in /data/preloads
22345allow mediaserver preloads_media_file:file { getattr read ioctl };
22346
22347allow mediaserver ion_device:chr_file { getattr open read ioctl lock map };
22348allow mediaserver hal_graphics_allocator:fd use;
22349allow mediaserver hal_graphics_composer:fd use;
22350allow mediaserver hal_camera:fd use;
22351
22352allow mediaserver system_server:fd use;
22353
22354# b/120491318 allow mediaserver to access void:fd
22355allow mediaserver vold:fd use;
22356
22357
22358#line 134
22359typeattribute mediaserver halclientdomain;
22360#line 134
22361typeattribute mediaserver hal_allocator_client;
22362#line 134
22363
22364#line 134
22365# TODO(b/34170079): Make the inclusion of the rules below conditional also on
22366#line 134
22367# non-Treble devices. For now, on non-Treble device, always grant clients of a
22368#line 134
22369# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
22370#line 134
22371
22372#line 134
22373
22374
22375###
22376### neverallow rules
22377###
22378
22379# mediaserver should never execute any executable without a
22380# domain transition
22381neverallow mediaserver { file_type fs_type }:file execute_no_trans;
22382
22383# do not allow privileged socket ioctl commands
22384neverallowxperm mediaserver domain:{ rawip_socket tcp_socket udp_socket } ioctl
22385#line 145
22386{
22387#line 145
22388# qualcomm rmnet ioctls
22389#line 145
223900x00006900 0x00006902
22391#line 145
22392# socket ioctls
22393#line 145
223940x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
22395#line 145
223960x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
22397#line 145
223980x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
22399#line 145
224000x00008927 0x00008929 0x00008930 0x00008931 0x00008932
22401#line 145
224020x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
22403#line 145
224040x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
22405#line 145
224060x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
22407#line 145
224080x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
22409#line 145
224100x00008991 0x00008992 0x00008993 0x00008994
22411#line 145
224120x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
22413#line 145
22414# device and protocol specific ioctls
22415#line 145
224160x000089f0-0x000089ff
22417#line 145
224180x000089e0-0x000089ef
22419#line 145
22420# Wireless extension ioctls
22421#line 145
224220x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
22423#line 145
224240x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
22425#line 145
224260x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
22427#line 145
224280x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
22429#line 145
224300x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
22431#line 145
224320x00008b34 0x00008b35 0x00008b36
22433#line 145
22434# Dev private ioctl i.e. hardware specific ioctls
22435#line 145
224360x00008be0-0x00008bff
22437#line 145
22438};
22439#line 1 "system/sepolicy/prebuilts/api/29.0/public/mediaswcodec.te"
22440type mediaswcodec, domain;
22441type mediaswcodec_exec, system_file_type, exec_type, file_type;
22442
22443
22444#line 4
22445typeattribute mediaswcodec halserverdomain;
22446#line 4
22447typeattribute mediaswcodec hal_codec2_server;
22448#line 4
22449typeattribute mediaswcodec hal_codec2;
22450#line 4
22451
22452
22453# mediaswcodec may use an input surface from a different Codec2 service or an
22454# OMX service
22455
22456#line 8
22457typeattribute mediaswcodec halclientdomain;
22458#line 8
22459typeattribute mediaswcodec hal_codec2_client;
22460#line 8
22461
22462#line 8
22463# TODO(b/34170079): Make the inclusion of the rules below conditional also on
22464#line 8
22465# non-Treble devices. For now, on non-Treble device, always grant clients of a
22466#line 8
22467# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
22468#line 8
22469
22470#line 8
22471
22472
22473#line 9
22474typeattribute mediaswcodec halclientdomain;
22475#line 9
22476typeattribute mediaswcodec hal_omx_client;
22477#line 9
22478
22479#line 9
22480# TODO(b/34170079): Make the inclusion of the rules below conditional also on
22481#line 9
22482# non-Treble devices. For now, on non-Treble device, always grant clients of a
22483#line 9
22484# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
22485#line 9
22486
22487#line 9
22488
22489
22490
22491#line 11
22492typeattribute mediaswcodec halclientdomain;
22493#line 11
22494typeattribute mediaswcodec hal_allocator_client;
22495#line 11
22496
22497#line 11
22498# TODO(b/34170079): Make the inclusion of the rules below conditional also on
22499#line 11
22500# non-Treble devices. For now, on non-Treble device, always grant clients of a
22501#line 11
22502# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
22503#line 11
22504
22505#line 11
22506
22507
22508#line 12
22509typeattribute mediaswcodec halclientdomain;
22510#line 12
22511typeattribute mediaswcodec hal_graphics_allocator_client;
22512#line 12
22513
22514#line 12
22515# TODO(b/34170079): Make the inclusion of the rules below conditional also on
22516#line 12
22517# non-Treble devices. For now, on non-Treble device, always grant clients of a
22518#line 12
22519# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
22520#line 12
22521
22522#line 12
22523
22524
22525
22526#line 14
22527allow mediaswcodec device_config_media_native_prop:file { getattr open read map };
22528#line 14
22529
22530
22531
22532#line 16
22533
22534#line 16
22535allow mediaswcodec anr_data_file:file append;
22536#line 16
22537allow mediaswcodec dumpstate:fd use;
22538#line 16
22539allow mediaswcodec incidentd:fd use;
22540#line 16
22541# TODO: Figure out why write is needed.
22542#line 16
22543allow mediaswcodec dumpstate:fifo_file { append write };
22544#line 16
22545allow mediaswcodec incidentd:fifo_file { append write };
22546#line 16
22547allow mediaswcodec system_server:fifo_file { append write };
22548#line 16
22549allow mediaswcodec tombstoned:unix_stream_socket connectto;
22550#line 16
22551allow mediaswcodec tombstoned:fd use;
22552#line 16
22553allow mediaswcodec tombstoned_crash_socket:sock_file write;
22554#line 16
22555allow mediaswcodec tombstone_data_file:file append;
22556#line 16
22557
22558
22559# mediaswcodec_server should never execute any executable without a
22560# domain transition
22561neverallow mediaswcodec { file_type fs_type }:file execute_no_trans;
22562
22563# Media processing code is inherently risky and thus should have limited
22564# permissions and be isolated from the rest of the system and network.
22565# Lengthier explanation here:
22566# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
22567neverallow mediaswcodec domain:{ tcp_socket udp_socket rawip_socket } *;
22568
22569#line 1 "system/sepolicy/prebuilts/api/29.0/public/modprobe.te"
22570type modprobe, domain;
22571
22572allow modprobe proc_modules:file { getattr open read ioctl lock map };
22573allow modprobe self:{ capability cap_userns } sys_module;
22574allow modprobe kernel:key search;
22575#line 9
22576
22577#line 1 "system/sepolicy/prebuilts/api/29.0/public/mtp.te"
22578# vpn tunneling protocol manager
22579type mtp, domain;
22580type mtp_exec, system_file_type, exec_type, file_type;
22581
22582
22583#line 5
22584typeattribute mtp netdomain;
22585#line 5
22586
22587
22588# pptp policy
22589allow mtp self:{ socket pppox_socket } { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
22590allow mtp self:{ capability cap_userns } net_raw;
22591allow mtp ppp:process signal;
22592allow mtp vpn_data_file:dir search;
22593#line 1 "system/sepolicy/prebuilts/api/29.0/public/net.te"
22594## Network types
22595type node, node_type;
22596type netif, netif_type;
22597type port, port_type;
22598
22599###
22600### Domain with network access
22601###
22602
22603# Use network sockets.
22604allow netdomain self:tcp_socket { create { { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } listen accept } };
22605allow netdomain self:{ icmp_socket udp_socket rawip_socket } { create { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } };
22606
22607# Connect to ports.
22608allow netdomain port_type:tcp_socket name_connect;
22609# Bind to ports.
22610allow {netdomain -ephemeral_app} node_type:{ icmp_socket rawip_socket tcp_socket udp_socket } node_bind;
22611allow {netdomain -ephemeral_app} port_type:udp_socket name_bind;
22612allow {netdomain -ephemeral_app} port_type:tcp_socket name_bind;
22613# See changes to the routing table.
22614allow netdomain self:netlink_route_socket { create read getattr write setattr lock append bind connect getopt setopt shutdown nlmsg_read };
22615
22616# Talks to netd via dnsproxyd socket.
22617
22618#line 24
22619allow netdomain dnsproxyd_socket:sock_file write;
22620#line 24
22621allow netdomain netd:unix_stream_socket connectto;
22622#line 24
22623
22624
22625# Talks to netd via fwmarkd socket.
22626
22627#line 27
22628allow netdomain fwmarkd_socket:sock_file write;
22629#line 27
22630allow netdomain netd:unix_stream_socket connectto;
22631#line 27
22632
22633
22634# Connect to mdnsd via mdnsd socket.
22635
22636#line 30
22637allow netdomain mdnsd_socket:sock_file write;
22638#line 30
22639allow netdomain mdnsd:unix_stream_socket connectto;
22640#line 30
22641
22642#line 1 "system/sepolicy/prebuilts/api/29.0/public/netd.te"
22643# network manager
22644type netd, domain, mlstrustedsubject;
22645type netd_exec, system_file_type, exec_type, file_type;
22646
22647
22648#line 5
22649typeattribute netd netdomain;
22650#line 5
22651
22652# in addition to ioctls allowlisted for all domains, grant netd priv_sock_ioctls.
22653allowxperm netd self:udp_socket ioctl
22654#line 7
22655{
22656#line 7
22657# qualcomm rmnet ioctls
22658#line 7
226590x00006900 0x00006902
22660#line 7
22661# socket ioctls
22662#line 7
226630x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
22664#line 7
226650x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
22666#line 7
226670x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
22668#line 7
226690x00008927 0x00008929 0x00008930 0x00008931 0x00008932
22670#line 7
226710x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
22672#line 7
226730x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
22674#line 7
226750x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
22676#line 7
226770x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
22678#line 7
226790x00008991 0x00008992 0x00008993 0x00008994
22680#line 7
226810x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
22682#line 7
22683# device and protocol specific ioctls
22684#line 7
226850x000089f0-0x000089ff
22686#line 7
226870x000089e0-0x000089ef
22688#line 7
22689# Wireless extension ioctls
22690#line 7
226910x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
22692#line 7
226930x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
22694#line 7
226950x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
22696#line 7
226970x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
22698#line 7
226990x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
22700#line 7
227010x00008b34 0x00008b35 0x00008b36
22702#line 7
22703# Dev private ioctl i.e. hardware specific ioctls
22704#line 7
227050x00008be0-0x00008bff
22706#line 7
22707};
22708
22709
22710#line 9
22711allow netd cgroup:dir { open getattr read search ioctl lock };
22712#line 9
22713allow netd cgroup:{ file lnk_file } { getattr open read ioctl lock map };
22714#line 9
22715
22716
22717allow netd system_server:fd use;
22718
22719allow netd self:{ capability cap_userns } { net_admin net_raw kill };
22720# Note: fsetid is deliberately not included above. fsetid checks are
22721# triggered by chmod on a directory or file owned by a group other
22722# than one of the groups assigned to the current process to see if
22723# the setgid bit should be cleared, regardless of whether the setgid
22724# bit was even set.  We do not appear to truly need this capability
22725# for netd to operate.
22726dontaudit netd self:{ capability cap_userns } fsetid;
22727
22728# Allow netd to open /dev/tun, set it up and pass it to clatd
22729allow netd tun_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
22730allowxperm netd tun_device:chr_file ioctl { 0x800454d2 0x400454ca };
22731allow netd self:tun_socket create;
22732
22733allow netd self:netlink_kobject_uevent_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
22734allow netd self:netlink_route_socket nlmsg_write;
22735allow netd self:netlink_nflog_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
22736allow netd self:netlink_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
22737allow netd self:netlink_tcpdiag_socket { { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } } nlmsg_read nlmsg_write };
22738allow netd self:netlink_generic_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
22739allow netd self:netlink_netfilter_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
22740allow netd shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
22741allow netd system_file:file { getattr execute execute_no_trans map };
22742
22743allow netd devpts:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
22744
22745# Acquire advisory lock on /system/etc/xtables.lock
22746allow netd system_file:file lock;
22747
22748# Allow netd to write to qtaguid ctrl file.
22749# TODO: Add proper rules to prevent other process to access qtaguid_proc file
22750# after migration complete
22751allow netd proc_qtaguid_ctrl:file { { getattr open read ioctl lock map } { open append write lock map } };
22752# Allow netd to read /dev/qtaguid. This is the same privilege level that normal apps have.
22753allow netd qtaguid_device:chr_file { getattr open read ioctl lock map };
22754
22755
22756#line 49
22757allow netd proc_net_type:dir { open getattr read search ioctl lock };
22758#line 49
22759allow netd proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
22760#line 49
22761
22762# For /proc/sys/net/ipv[46]/route/flush.
22763allow netd proc_net_type:file { { getattr open read ioctl lock map } { open append write lock map } };
22764
22765# Enables PppController and interface enumeration (among others)
22766allow netd sysfs:dir { open getattr read search ioctl lock };
22767
22768#line 55
22769allow netd sysfs_net:dir { open getattr read search ioctl lock };
22770#line 55
22771allow netd sysfs_net:{ file lnk_file } { getattr open read ioctl lock map };
22772#line 55
22773
22774
22775# Allows setting interface MTU
22776allow netd sysfs_net:file { open append write lock map };
22777
22778# TODO: added to match above sysfs rule. Remove me?
22779allow netd sysfs_usb:file write;
22780
22781
22782#line 63
22783allow netd cgroup_bpf:dir { open getattr read search ioctl lock };
22784#line 63
22785allow netd cgroup_bpf:{ file lnk_file } { getattr open read ioctl lock map };
22786#line 63
22787
22788
22789allow netd fs_bpf:dir search;
22790allow netd fs_bpf:file { read write setattr };
22791
22792# TODO: netd previously thought it needed these permissions to do WiFi related
22793#       work.  However, after all the WiFi stuff is gone, we still need them.
22794#       Why?
22795allow netd self:{ capability cap_userns } { dac_override dac_read_search chown };
22796
22797# Needed to update /data/misc/net/rt_tables
22798allow netd net_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
22799allow netd net_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
22800allow netd self:{ capability cap_userns } fowner;
22801
22802# Needed to lock the iptables lock.
22803allow netd system_file:file lock;
22804
22805# Allow netd to spawn dnsmasq in it's own domain
22806allow netd dnsmasq:process signal;
22807
22808# Allow netd to start clatd in its own domain
22809allow netd clatd:process signal;
22810
22811
22812#line 87
22813
22814#line 87
22815allow netd property_socket:sock_file write;
22816#line 87
22817allow netd init:unix_stream_socket connectto;
22818#line 87
22819
22820#line 87
22821allow netd ctl_mdnsd_prop:property_service set;
22822#line 87
22823
22824#line 87
22825allow netd ctl_mdnsd_prop:file { getattr open read map };
22826#line 87
22827
22828#line 87
22829
22830
22831#line 88
22832
22833#line 88
22834allow netd property_socket:sock_file write;
22835#line 88
22836allow netd init:unix_stream_socket connectto;
22837#line 88
22838
22839#line 88
22840allow netd netd_stable_secret_prop:property_service set;
22841#line 88
22842
22843#line 88
22844allow netd netd_stable_secret_prop:file { getattr open read map };
22845#line 88
22846
22847#line 88
22848
22849
22850# Allow netd to publish a binder service and make binder calls.
22851
22852#line 91
22853# Call the servicemanager and transfer references to it.
22854#line 91
22855allow netd servicemanager:binder { call transfer };
22856#line 91
22857# servicemanager performs getpidcon on clients.
22858#line 91
22859allow servicemanager netd:dir search;
22860#line 91
22861allow servicemanager netd:file { read open };
22862#line 91
22863allow servicemanager netd:process getattr;
22864#line 91
22865# rw access to /dev/binder and /dev/ashmem is presently granted to
22866#line 91
22867# all domains in domain.te.
22868#line 91
22869
22870
22871#line 92
22872  allow netd netd_service:service_manager { add find };
22873#line 92
22874  neverallow { domain -netd } netd_service:service_manager add;
22875#line 92
22876
22877
22878#line 93
22879  allow netd dnsresolver_service:service_manager { add find };
22880#line 93
22881  neverallow { domain -netd } dnsresolver_service:service_manager add;
22882#line 93
22883
22884allow netd dumpstate:fifo_file  { getattr write };
22885
22886# Allow netd to call into the system server so it can check permissions.
22887allow netd system_server:binder call;
22888allow netd permission_service:service_manager find;
22889
22890# Allow netd to talk to the framework service which collects netd events.
22891allow netd netd_listener_service:service_manager find;
22892
22893# Allow netd to operate on sockets that are passed to it.
22894allow netd netdomain:{
22895  icmp_socket
22896  tcp_socket
22897  udp_socket
22898  rawip_socket
22899  tun_socket
22900} { read write getattr setattr getopt setopt };
22901allow netd netdomain:fd use;
22902
22903# give netd permission to read and write netlink xfrm
22904allow netd self:netlink_xfrm_socket { { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } } nlmsg_write nlmsg_read };
22905
22906# Allow netd to register as hal server.
22907
22908#line 117
22909  allow netd system_net_netd_hwservice:hwservice_manager { add find };
22910#line 117
22911  allow netd hidl_base_hwservice:hwservice_manager add;
22912#line 117
22913  neverallow { domain -netd } system_net_netd_hwservice:hwservice_manager add;
22914#line 117
22915
22916
22917#line 118
22918# Call the hwservicemanager and transfer references to it.
22919#line 118
22920allow netd hwservicemanager:binder { call transfer };
22921#line 118
22922# Allow hwservicemanager to send out callbacks
22923#line 118
22924allow hwservicemanager netd:binder { call transfer };
22925#line 118
22926# hwservicemanager performs getpidcon on clients.
22927#line 118
22928allow hwservicemanager netd:dir search;
22929#line 118
22930allow hwservicemanager netd:file { read open map };
22931#line 118
22932allow hwservicemanager netd:process getattr;
22933#line 118
22934# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
22935#line 118
22936# all domains in domain.te.
22937#line 118
22938
22939
22940#line 119
22941allow netd hwservicemanager_prop:file { getattr open read map };
22942#line 119
22943
22944
22945#line 120
22946allow netd device_config_netd_native_prop:file { getattr open read map };
22947#line 120
22948
22949
22950###
22951### Neverallow rules
22952###
22953### netd should NEVER do any of this
22954
22955# Block device access.
22956neverallow netd dev_type:blk_file { read write };
22957
22958# ptrace any other app
22959neverallow netd { domain }:process ptrace;
22960
22961# Write to /system.
22962neverallow netd system_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
22963
22964# Write to files in /data/data or system files on /data
22965neverallow netd { app_data_file privapp_data_file system_data_file }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
22966
22967# only system_server, dumpstate and network stack app may find netd service
22968neverallow {
22969    domain
22970    -system_server
22971    -dumpstate
22972    -network_stack
22973    -netd
22974    -netutils_wrapper
22975} netd_service:service_manager find;
22976
22977# only system_server, dumpstate and network stack app may find dnsresolver service
22978neverallow {
22979    domain
22980    -system_server
22981    -dumpstate
22982    -network_stack
22983    -netd
22984    -netutils_wrapper
22985} dnsresolver_service:service_manager find;
22986
22987# apps may not interact with netd over binder.
22988neverallow { appdomain -network_stack } netd:binder call;
22989neverallow netd { appdomain -network_stack  }:binder call;
22990
22991# persist.netd.stable_secret contains RFC 7217 secret key which should never be
22992# leaked to other processes. Make sure it never leaks.
22993neverallow { domain -netd -init -dumpstate } netd_stable_secret_prop:file { getattr open read ioctl lock map };
22994
22995# We want to ensure that no other process ever tries tampering with persist.netd.stable_secret,
22996# the RFC 7217 secret key managed by netd. Doing so could compromise user privacy.
22997neverallow { domain -netd -init } netd_stable_secret_prop:property_service set;
22998
22999# If an already existing file is opened with O_CREATE, the kernel might generate
23000# a false report of a create denial. Silence these denials and make sure that
23001# inappropriate permissions are not granted.
23002neverallow netd proc_net:dir { add_name create link relabelfrom remove_name rename reparent rmdir setattr write };
23003dontaudit netd proc_net:dir write;
23004
23005neverallow netd sysfs_net:dir { add_name create link relabelfrom remove_name rename reparent rmdir setattr write };
23006dontaudit netd sysfs_net:dir write;
23007#line 1 "system/sepolicy/prebuilts/api/29.0/public/netutils_wrapper.te"
23008type netutils_wrapper, domain;
23009type netutils_wrapper_exec, system_file_type, exec_type, file_type;
23010
23011neverallow domain netutils_wrapper_exec:file execute_no_trans;
23012#line 1 "system/sepolicy/prebuilts/api/29.0/public/network_stack.te"
23013# Network stack service app
23014type network_stack, domain;
23015#line 1 "system/sepolicy/prebuilts/api/29.0/public/nfc.te"
23016# nfc subsystem
23017type nfc, domain;
23018#line 1 "system/sepolicy/prebuilts/api/29.0/public/perfetto.te"
23019type perfetto, domain, coredomain;
23020#line 1 "system/sepolicy/prebuilts/api/29.0/public/performanced.te"
23021# performanced
23022type performanced, domain, mlstrustedsubject;
23023type performanced_exec, system_file_type, exec_type, file_type;
23024
23025# Needed to check for app permissions.
23026
23027#line 6
23028# Call the servicemanager and transfer references to it.
23029#line 6
23030allow performanced servicemanager:binder { call transfer };
23031#line 6
23032# servicemanager performs getpidcon on clients.
23033#line 6
23034allow servicemanager performanced:dir search;
23035#line 6
23036allow servicemanager performanced:file { read open };
23037#line 6
23038allow servicemanager performanced:process getattr;
23039#line 6
23040# rw access to /dev/binder and /dev/ashmem is presently granted to
23041#line 6
23042# all domains in domain.te.
23043#line 6
23044
23045
23046#line 7
23047# Call the server domain and optionally transfer references to it.
23048#line 7
23049allow performanced system_server:binder { call transfer };
23050#line 7
23051# Allow the serverdomain to transfer references to the client on the reply.
23052#line 7
23053allow system_server performanced:binder transfer;
23054#line 7
23055# Receive and use open files from the server.
23056#line 7
23057allow performanced system_server:fd use;
23058#line 7
23059
23060allow performanced permission_service:service_manager find;
23061
23062
23063#line 10
23064# Mark the server domain as a PDX server.
23065#line 10
23066typeattribute performanced pdx_performance_client_server_type;
23067#line 10
23068# Allow the init process to create the initial endpoint socket.
23069#line 10
23070allow init pdx_performance_client_endpoint_socket_type:unix_stream_socket { create bind };
23071#line 10
23072# Allow the server domain to use the endpoint socket and accept connections on it.
23073#line 10
23074# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
23075#line 10
23076# than we need (e.g. we don"t need "bind" or "connect").
23077#line 10
23078allow performanced pdx_performance_client_endpoint_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown listen accept };
23079#line 10
23080# Allow the server domain to apply security context label to the channel socket pair (allow process to use setsockcreatecon_raw()).
23081#line 10
23082allow performanced self:process setsockcreate;
23083#line 10
23084# Allow the server domain to create a client channel socket.
23085#line 10
23086allow performanced pdx_performance_client_channel_socket_type:unix_stream_socket { create { { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } listen accept } };
23087#line 10
23088# Prevent other processes from claiming to be a server for the same service.
23089#line 10
23090neverallow {domain -performanced} pdx_performance_client_endpoint_socket_type:unix_stream_socket { listen accept };
23091#line 10
23092
23093
23094# TODO: use file caps to obtain sys_nice instead of setuid / setgid.
23095allow performanced self:{ capability cap_userns } { setuid setgid sys_nice };
23096
23097# Access /proc to validate we're only affecting threads in the same thread group.
23098# Performanced also shields unbound kernel threads.  It scans every task in the
23099# root cpu set, but only affects the kernel threads.
23100
23101#line 18
23102allow performanced { appdomain bufferhubd kernel surfaceflinger }:dir { open getattr read search ioctl lock };
23103#line 18
23104allow performanced { appdomain bufferhubd kernel surfaceflinger }:{ file lnk_file } { getattr open read ioctl lock map };
23105#line 18
23106
23107dontaudit performanced domain:dir read;
23108allow performanced { appdomain bufferhubd kernel surfaceflinger }:process setsched;
23109
23110# These /proc accesses only show up in permissive mode but they
23111# generate a lot of noise in the log.
23112#line 27
23113
23114
23115# Access /dev/cpuset/cpuset.cpus
23116
23117#line 30
23118allow performanced cgroup:dir { open getattr read search ioctl lock };
23119#line 30
23120allow performanced cgroup:{ file lnk_file } { getattr open read ioctl lock map };
23121#line 30
23122
23123#line 1 "system/sepolicy/prebuilts/api/29.0/public/perfprofd.te"
23124# perfprofd - perf profile collection daemon
23125type perfprofd, domain;
23126type perfprofd_exec, system_file_type, exec_type, file_type;
23127
23128#line 121
23129
23130#line 1 "system/sepolicy/prebuilts/api/29.0/public/platform_app.te"
23131###
23132### Apps signed with the platform key.
23133###
23134
23135type platform_app, domain;
23136#line 1 "system/sepolicy/prebuilts/api/29.0/public/postinstall.te"
23137# Domain where the postinstall program runs during the update.
23138# Extend the permissions in this domain to allow this program to access other
23139# files needed by the specific device on your device's sepolicy directory.
23140type postinstall, domain;
23141
23142# Allow postinstall to write to its stdout/stderr when redirected via pipes to
23143# update_engine.
23144allow postinstall update_engine_common:fd use;
23145allow postinstall update_engine_common:fifo_file { { getattr open read ioctl lock map } { open append write lock map } };
23146
23147# Allow postinstall to read and execute directories and files in the same
23148# mounted location.
23149allow postinstall postinstall_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
23150allow postinstall postinstall_file:lnk_file { getattr open read ioctl lock map };
23151allow postinstall postinstall_file:dir { open getattr read search ioctl lock };
23152
23153# Allow postinstall to execute the shell or other system executables.
23154allow postinstall shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
23155allow postinstall system_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
23156allow postinstall toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
23157
23158# Allow postinstall to execute shell in recovery.
23159#line 25
23160
23161
23162#
23163# For OTA dexopt.
23164#
23165
23166# Allow postinstall scripts to talk to the system server.
23167
23168#line 32
23169# Call the servicemanager and transfer references to it.
23170#line 32
23171allow postinstall servicemanager:binder { call transfer };
23172#line 32
23173# servicemanager performs getpidcon on clients.
23174#line 32
23175allow servicemanager postinstall:dir search;
23176#line 32
23177allow servicemanager postinstall:file { read open };
23178#line 32
23179allow servicemanager postinstall:process getattr;
23180#line 32
23181# rw access to /dev/binder and /dev/ashmem is presently granted to
23182#line 32
23183# all domains in domain.te.
23184#line 32
23185
23186
23187#line 33
23188# Call the server domain and optionally transfer references to it.
23189#line 33
23190allow postinstall system_server:binder { call transfer };
23191#line 33
23192# Allow the serverdomain to transfer references to the client on the reply.
23193#line 33
23194allow system_server postinstall:binder transfer;
23195#line 33
23196# Receive and use open files from the server.
23197#line 33
23198allow postinstall system_server:fd use;
23199#line 33
23200
23201
23202# Need to talk to the otadexopt service.
23203allow postinstall otadexopt_service:service_manager find;
23204
23205# Allow postinstall scripts to trigger f2fs garbage collection
23206allow postinstall sysfs_fs_f2fs:file { { getattr open read ioctl lock map } { open append write lock map } };
23207allow postinstall sysfs_fs_f2fs:dir { open getattr read search ioctl lock };
23208
23209# No domain other than update_engine and recovery (via update_engine_sideload)
23210# should transition to postinstall, as it is only meant to run during the
23211# update.
23212neverallow { domain -update_engine -recovery } postinstall:process { transition dyntransition };
23213#line 1 "system/sepolicy/prebuilts/api/29.0/public/ppp.te"
23214# Point to Point Protocol daemon
23215type ppp, domain;
23216type ppp_device, dev_type;
23217type ppp_exec, system_file_type, exec_type, file_type;
23218
23219
23220#line 6
23221typeattribute ppp netdomain;
23222#line 6
23223
23224
23225
23226#line 8
23227allow ppp proc_net_type:dir { open getattr read search ioctl lock };
23228#line 8
23229allow ppp proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
23230#line 8
23231
23232
23233allow ppp mtp:{ socket pppox_socket } { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map };
23234
23235# ioctls needed for VPN.
23236allowxperm ppp self:udp_socket ioctl
23237#line 13
23238{
23239#line 13
23240# qualcomm rmnet ioctls
23241#line 13
232420x00006900 0x00006902
23243#line 13
23244# socket ioctls
23245#line 13
232460x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
23247#line 13
232480x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
23249#line 13
232500x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
23251#line 13
232520x00008927 0x00008929 0x00008930 0x00008931 0x00008932
23253#line 13
232540x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
23255#line 13
232560x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
23257#line 13
232580x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
23259#line 13
232600x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
23261#line 13
232620x00008991 0x00008992 0x00008993 0x00008994
23263#line 13
232640x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
23265#line 13
23266# device and protocol specific ioctls
23267#line 13
232680x000089f0-0x000089ff
23269#line 13
232700x000089e0-0x000089ef
23271#line 13
23272# Wireless extension ioctls
23273#line 13
232740x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
23275#line 13
232760x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
23277#line 13
232780x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
23279#line 13
232800x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
23281#line 13
232820x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
23283#line 13
232840x00008b34 0x00008b35 0x00008b36
23285#line 13
23286# Dev private ioctl i.e. hardware specific ioctls
23287#line 13
232880x00008be0-0x00008bff
23289#line 13
23290};
23291allowxperm ppp mtp:{ socket pppox_socket } ioctl {
23292#line 14
232930x7436 0x7437 0x7438 0x7439
23294#line 14
232950x743a 0x743b 0x743c 0x743d
23296#line 14
232970x743e 0x743f 0x7440 0x7441
23298#line 14
232990x7446 0x7447 0x744b 0x744c
23300#line 14
233010x744d 0x744e 0x744f
23302#line 14
233030x7450 0x7451 0x7452 0x7453
23304#line 14
233050x7454 0x7455 0x7456 0x7457
23306#line 14
233070x7458 0x7459 0x745a 0x7480
23308#line 14
233090x7481 0x7482 0x7483 0x7484
23310#line 14
233110x7485 0x7486 0x7487 0x7488
23312#line 14
23313};
23314
23315allow ppp mtp:unix_dgram_socket { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map };
23316allow ppp ppp_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
23317allow ppp self:{ capability cap_userns } net_admin;
23318allow ppp system_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
23319
23320allow ppp vpn_data_file:dir { open search write add_name remove_name lock };
23321allow ppp vpn_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
23322allow ppp mtp:fd use;
23323#line 1 "system/sepolicy/prebuilts/api/29.0/public/priv_app.te"
23324###
23325### A domain for further sandboxing privileged apps.
23326###
23327
23328type priv_app, domain;
23329#line 1 "system/sepolicy/prebuilts/api/29.0/public/profman.te"
23330# profman
23331type profman, domain;
23332type profman_exec, system_file_type, exec_type, file_type;
23333
23334allow profman user_profile_data_file:file { getattr read write lock map };
23335
23336# Dumping profile info opens the application APK file for pretty printing.
23337allow profman asec_apk_file:file { read map };
23338allow profman apk_data_file:file { getattr read map };
23339allow profman apk_data_file:dir { getattr read search };
23340
23341allow profman oemfs:file { read map };
23342# Reading an APK opens a ZipArchive, which unpack to tmpfs.
23343allow profman tmpfs:file { read map };
23344allow profman profman_dump_data_file:file { write map };
23345
23346allow profman installd:fd use;
23347
23348# Allow profman to analyze profiles for the secondary dex files. These
23349# are application dex files reported back to the framework when using
23350# BaseDexClassLoader.
23351allow profman { privapp_data_file app_data_file }:file { getattr read write lock map };
23352allow profman { privapp_data_file app_data_file }:dir { getattr read search };
23353
23354###
23355### neverallow rules
23356###
23357
23358neverallow profman { privapp_data_file app_data_file }:{ file lnk_file sock_file fifo_file } open;
23359#line 1 "system/sepolicy/prebuilts/api/29.0/public/property.te"
23360type apexd_prop, property_type;
23361type audio_prop, property_type, core_property_type;
23362type boottime_prop, property_type;
23363type boottime_public_prop, property_type;
23364type bluetooth_a2dp_offload_prop, property_type;
23365type bluetooth_audio_hal_prop, property_type;
23366type bluetooth_prop, property_type;
23367type bpf_progs_loaded_prop, property_type;
23368type bootloader_boot_reason_prop, property_type;
23369type config_prop, property_type, core_property_type;
23370type cppreopt_prop, property_type, core_property_type;
23371type cpu_variant_prop, property_type;
23372type ctl_adbd_prop, property_type;
23373type ctl_bootanim_prop, property_type;
23374type ctl_bugreport_prop, property_type;
23375type ctl_console_prop, property_type;
23376type ctl_default_prop, property_type;
23377type ctl_dumpstate_prop, property_type;
23378type ctl_fuse_prop, property_type;
23379type ctl_gsid_prop, property_type;
23380type ctl_interface_restart_prop, property_type;
23381type ctl_interface_start_prop, property_type;
23382type ctl_interface_stop_prop, property_type;
23383type ctl_mdnsd_prop, property_type;
23384type ctl_restart_prop, property_type;
23385type ctl_rildaemon_prop, property_type;
23386type ctl_sigstop_prop, property_type;
23387type ctl_start_prop, property_type;
23388type ctl_stop_prop, property_type;
23389type dalvik_prop, property_type, core_property_type;
23390type debuggerd_prop, property_type, core_property_type;
23391type debug_prop, property_type, core_property_type;
23392type default_prop, property_type, core_property_type;
23393type device_config_activity_manager_native_boot_prop, property_type;
23394type device_config_boot_count_prop, property_type;
23395type device_config_reset_performed_prop, property_type;
23396type device_config_input_native_boot_prop, property_type;
23397type device_config_netd_native_prop, property_type;
23398type device_config_runtime_native_boot_prop, property_type;
23399type device_config_runtime_native_prop, property_type;
23400type device_config_media_native_prop, property_type;
23401type device_logging_prop, property_type;
23402type dhcp_prop, property_type, core_property_type;
23403type dumpstate_options_prop, property_type;
23404type dumpstate_prop, property_type, core_property_type;
23405type dynamic_system_prop, property_type;
23406type exported_secure_prop, property_type;
23407type sota_prop, property_type;
23408type ffs_prop, property_type, core_property_type;
23409type fingerprint_prop, property_type, core_property_type;
23410type firstboot_prop, property_type;
23411type gsid_prop, property_type;
23412type heapprofd_enabled_prop, property_type;
23413type heapprofd_prop, property_type;
23414type hwservicemanager_prop, property_type;
23415type last_boot_reason_prop, property_type;
23416type system_lmk_prop, property_type;
23417type llkd_prop, property_type;
23418type logd_prop, property_type, core_property_type;
23419type logpersistd_logging_prop, property_type;
23420type log_prop, property_type, log_property_type;
23421type log_tag_prop, property_type, log_property_type;
23422type lowpan_prop, property_type;
23423type lpdumpd_prop, property_type;
23424type mmc_prop, property_type;
23425type net_dns_prop, property_type;
23426type net_radio_prop, property_type, core_property_type;
23427type netd_stable_secret_prop, property_type;
23428type nfc_prop, property_type, core_property_type;
23429type nnapi_ext_deny_product_prop, property_type;
23430type overlay_prop, property_type;
23431type pan_result_prop, property_type, core_property_type;
23432type persist_debug_prop, property_type, core_property_type;
23433type persistent_properties_ready_prop, property_type;
23434type pm_prop, property_type;
23435type powerctl_prop, property_type, core_property_type;
23436type radio_prop, property_type, core_property_type;
23437type restorecon_prop, property_type, core_property_type;
23438type safemode_prop, property_type;
23439type serialno_prop, property_type;
23440type shell_prop, property_type, core_property_type;
23441type system_boot_reason_prop, property_type;
23442type system_prop, property_type, core_property_type;
23443type system_radio_prop, property_type, core_property_type;
23444type system_trace_prop, property_type;
23445type test_boot_reason_prop, property_type;
23446type test_harness_prop, property_type;
23447type theme_prop, property_type;
23448type time_prop, property_type;
23449type traced_enabled_prop, property_type;
23450type traced_lazy_prop, property_type;
23451type use_memfd_prop, property_type;
23452type vold_prop, property_type, core_property_type;
23453type wifi_log_prop, property_type, log_property_type;
23454type wifi_prop, property_type;
23455type vendor_security_patch_level_prop, property_type;
23456
23457# Properties for whitelisting
23458type exported_audio_prop, property_type;
23459type exported_bluetooth_prop, property_type;
23460type exported_config_prop, property_type;
23461type exported_dalvik_prop, property_type;
23462type exported_default_prop, property_type;
23463type exported_dumpstate_prop, property_type;
23464type exported_ffs_prop, property_type;
23465type exported_fingerprint_prop, property_type;
23466type exported_overlay_prop, property_type;
23467type exported_pm_prop, property_type;
23468type exported_radio_prop, property_type;
23469type exported_system_prop, property_type;
23470type exported_system_radio_prop, property_type;
23471type exported_vold_prop, property_type;
23472type exported_wifi_prop, property_type;
23473type exported2_config_prop, property_type;
23474type exported2_default_prop, property_type;
23475type exported2_radio_prop, property_type;
23476type exported2_system_prop, property_type;
23477type exported2_vold_prop, property_type;
23478type exported3_default_prop, property_type;
23479type exported3_radio_prop, property_type;
23480type exported3_system_prop, property_type;
23481type vendor_default_prop, property_type;
23482
23483allow property_type tmpfs:filesystem associate;
23484
23485###
23486### Neverallow rules
23487###
23488
23489# There is no need to perform ioctl or advisory locking operations on
23490# property files. If this neverallow is being triggered, it is
23491# likely that the policy is using r_file_perms directly instead of
23492# the get_prop() macro.
23493neverallow domain property_type:file { ioctl lock };
23494
23495# core_property_type should not be used for new properties or
23496# device specific properties. Properties with this attribute
23497# are readable to everyone, which is overly broad and should
23498# be avoided.
23499# New properties should have appropriate read / write access
23500# control rules written.
23501
23502neverallow * {
23503  core_property_type
23504  -audio_prop
23505  -config_prop
23506  -cppreopt_prop
23507  -dalvik_prop
23508  -debuggerd_prop
23509  -debug_prop
23510  -default_prop
23511  -dhcp_prop
23512  -dumpstate_prop
23513  -ffs_prop
23514  -fingerprint_prop
23515  -logd_prop
23516  -net_radio_prop
23517  -nfc_prop
23518  -pan_result_prop
23519  -persist_debug_prop
23520  -powerctl_prop
23521  -radio_prop
23522  -restorecon_prop
23523  -shell_prop
23524  -system_prop
23525  -system_radio_prop
23526  -vold_prop
23527}:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
23528
23529# sigstop property is only used for debugging; should only be set by su which is permissive
23530# for userdebug/eng
23531neverallow {
23532  domain
23533  -init
23534  -vendor_init
23535} ctl_sigstop_prop:property_service set;
23536
23537# Don't audit legacy ctl. property handling.  We only want the newer permission check to appear
23538# in the audit log
23539dontaudit domain {
23540  ctl_bootanim_prop
23541  ctl_bugreport_prop
23542  ctl_console_prop
23543  ctl_default_prop
23544  ctl_dumpstate_prop
23545  ctl_fuse_prop
23546  ctl_mdnsd_prop
23547  ctl_rildaemon_prop
23548}:property_service set;
23549
23550
23551#line 191
23552# Prevent properties from being set
23553#line 191
23554  neverallow {
23555#line 191
23556    domain
23557#line 191
23558    -coredomain
23559#line 191
23560    -appdomain
23561#line 191
23562    -vendor_init
23563#line 191
23564  } {
23565#line 191
23566    core_property_type
23567#line 191
23568    extended_core_property_type
23569#line 191
23570    exported_config_prop
23571#line 191
23572    exported_dalvik_prop
23573#line 191
23574    exported_default_prop
23575#line 191
23576    exported_dumpstate_prop
23577#line 191
23578    exported_ffs_prop
23579#line 191
23580    exported_fingerprint_prop
23581#line 191
23582    exported_system_prop
23583#line 191
23584    exported_system_radio_prop
23585#line 191
23586    exported_vold_prop
23587#line 191
23588    exported2_config_prop
23589#line 191
23590    exported2_default_prop
23591#line 191
23592    exported2_system_prop
23593#line 191
23594    exported2_vold_prop
23595#line 191
23596    exported3_default_prop
23597#line 191
23598    exported3_system_prop
23599#line 191
23600    -nfc_prop
23601#line 191
23602    -powerctl_prop
23603#line 191
23604    -radio_prop
23605#line 191
23606  }:property_service set;
23607#line 191
23608
23609#line 191
23610  neverallow {
23611#line 191
23612    domain
23613#line 191
23614    -coredomain
23615#line 191
23616    -appdomain
23617#line 191
23618    -hal_nfc_server
23619#line 191
23620  } {
23621#line 191
23622    nfc_prop
23623#line 191
23624  }:property_service set;
23625#line 191
23626
23627#line 191
23628  neverallow {
23629#line 191
23630    domain
23631#line 191
23632    -coredomain
23633#line 191
23634    -appdomain
23635#line 191
23636    -hal_telephony_server
23637#line 191
23638    -vendor_init
23639#line 191
23640  } {
23641#line 191
23642    exported_radio_prop
23643#line 191
23644    exported3_radio_prop
23645#line 191
23646  }:property_service set;
23647#line 191
23648
23649#line 191
23650  neverallow {
23651#line 191
23652    domain
23653#line 191
23654    -coredomain
23655#line 191
23656    -appdomain
23657#line 191
23658    -hal_telephony_server
23659#line 191
23660  } {
23661#line 191
23662    exported2_radio_prop
23663#line 191
23664    radio_prop
23665#line 191
23666  }:property_service set;
23667#line 191
23668
23669#line 191
23670  neverallow {
23671#line 191
23672    domain
23673#line 191
23674    -coredomain
23675#line 191
23676    -bluetooth
23677#line 191
23678    -hal_bluetooth_server
23679#line 191
23680  } {
23681#line 191
23682    bluetooth_prop
23683#line 191
23684  }:property_service set;
23685#line 191
23686
23687#line 191
23688  neverallow {
23689#line 191
23690    domain
23691#line 191
23692    -coredomain
23693#line 191
23694    -bluetooth
23695#line 191
23696    -hal_bluetooth_server
23697#line 191
23698    -vendor_init
23699#line 191
23700  } {
23701#line 191
23702    exported_bluetooth_prop
23703#line 191
23704  }:property_service set;
23705#line 191
23706
23707#line 191
23708  neverallow {
23709#line 191
23710    domain
23711#line 191
23712    -coredomain
23713#line 191
23714    -hal_wifi_server
23715#line 191
23716    -wificond
23717#line 191
23718  } {
23719#line 191
23720    wifi_prop
23721#line 191
23722  }:property_service set;
23723#line 191
23724
23725#line 191
23726  neverallow {
23727#line 191
23728    domain
23729#line 191
23730    -coredomain
23731#line 191
23732    -hal_wifi_server
23733#line 191
23734    -wificond
23735#line 191
23736    -vendor_init
23737#line 191
23738  } {
23739#line 191
23740    exported_wifi_prop
23741#line 191
23742  }:property_service set;
23743#line 191
23744
23745#line 191
23746# Prevent properties from being read
23747#line 191
23748  neverallow {
23749#line 191
23750    domain
23751#line 191
23752    -coredomain
23753#line 191
23754    -appdomain
23755#line 191
23756    -vendor_init
23757#line 191
23758  } {
23759#line 191
23760    core_property_type
23761#line 191
23762    extended_core_property_type
23763#line 191
23764    exported_dalvik_prop
23765#line 191
23766    exported_ffs_prop
23767#line 191
23768    exported_system_radio_prop
23769#line 191
23770    exported2_config_prop
23771#line 191
23772    exported2_system_prop
23773#line 191
23774    exported2_vold_prop
23775#line 191
23776    exported3_default_prop
23777#line 191
23778    exported3_system_prop
23779#line 191
23780    -debug_prop
23781#line 191
23782    -logd_prop
23783#line 191
23784    -nfc_prop
23785#line 191
23786    -powerctl_prop
23787#line 191
23788    -radio_prop
23789#line 191
23790  }:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
23791#line 191
23792
23793#line 191
23794  neverallow {
23795#line 191
23796    domain
23797#line 191
23798    -coredomain
23799#line 191
23800    -appdomain
23801#line 191
23802    -hal_nfc_server
23803#line 191
23804  } {
23805#line 191
23806    nfc_prop
23807#line 191
23808  }:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
23809#line 191
23810
23811#line 191
23812  neverallow {
23813#line 191
23814    domain
23815#line 191
23816    -coredomain
23817#line 191
23818    -appdomain
23819#line 191
23820    -hal_telephony_server
23821#line 191
23822  } {
23823#line 191
23824    radio_prop
23825#line 191
23826  }:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
23827#line 191
23828
23829#line 191
23830  neverallow {
23831#line 191
23832    domain
23833#line 191
23834    -coredomain
23835#line 191
23836    -bluetooth
23837#line 191
23838    -hal_bluetooth_server
23839#line 191
23840  } {
23841#line 191
23842    bluetooth_prop
23843#line 191
23844  }:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
23845#line 191
23846
23847#line 191
23848  neverallow {
23849#line 191
23850    domain
23851#line 191
23852    -coredomain
23853#line 191
23854    -hal_wifi_server
23855#line 191
23856    -wificond
23857#line 191
23858  } {
23859#line 191
23860    wifi_prop
23861#line 191
23862  }:file { { append create link unlink relabelfrom rename setattr write } open read ioctl lock };
23863#line 348
23864
23865
23866
23867#line 350
23868  # Neverallow coredomain to set vendor properties
23869#line 350
23870  neverallow {
23871#line 350
23872    coredomain
23873#line 350
23874    -init
23875#line 350
23876    -system_writes_vendor_properties_violators
23877#line 350
23878  } {
23879#line 350
23880    property_type
23881#line 350
23882    -apexd_prop
23883#line 350
23884    -audio_prop
23885#line 350
23886    -bluetooth_a2dp_offload_prop
23887#line 350
23888    -bluetooth_audio_hal_prop
23889#line 350
23890    -bluetooth_prop
23891#line 350
23892    -bootloader_boot_reason_prop
23893#line 350
23894    -boottime_prop
23895#line 350
23896    -boottime_public_prop
23897#line 350
23898    -bpf_progs_loaded_prop
23899#line 350
23900    -config_prop
23901#line 350
23902    -cppreopt_prop
23903#line 350
23904    -ctl_adbd_prop
23905#line 350
23906    -ctl_bootanim_prop
23907#line 350
23908    -ctl_bugreport_prop
23909#line 350
23910    -ctl_console_prop
23911#line 350
23912    -ctl_default_prop
23913#line 350
23914    -ctl_dumpstate_prop
23915#line 350
23916    -ctl_fuse_prop
23917#line 350
23918    -ctl_gsid_prop
23919#line 350
23920    -ctl_interface_restart_prop
23921#line 350
23922    -ctl_interface_start_prop
23923#line 350
23924    -ctl_interface_stop_prop
23925#line 350
23926    -ctl_mdnsd_prop
23927#line 350
23928    -ctl_restart_prop
23929#line 350
23930    -ctl_rildaemon_prop
23931#line 350
23932    -ctl_sigstop_prop
23933#line 350
23934    -ctl_start_prop
23935#line 350
23936    -ctl_stop_prop
23937#line 350
23938    -dalvik_prop
23939#line 350
23940    -debug_prop
23941#line 350
23942    -debuggerd_prop
23943#line 350
23944    -default_prop
23945#line 350
23946    -device_logging_prop
23947#line 350
23948    -dhcp_prop
23949#line 350
23950    -dumpstate_options_prop
23951#line 350
23952    -dumpstate_prop
23953#line 350
23954    -exported2_config_prop
23955#line 350
23956    -exported2_default_prop
23957#line 350
23958    -exported2_radio_prop
23959#line 350
23960    -exported2_system_prop
23961#line 350
23962    -exported2_vold_prop
23963#line 350
23964    -exported3_default_prop
23965#line 350
23966    -exported3_radio_prop
23967#line 350
23968    -exported3_system_prop
23969#line 350
23970    -exported_bluetooth_prop
23971#line 350
23972    -exported_config_prop
23973#line 350
23974    -exported_dalvik_prop
23975#line 350
23976    -exported_default_prop
23977#line 350
23978    -exported_dumpstate_prop
23979#line 350
23980    -exported_ffs_prop
23981#line 350
23982    -exported_fingerprint_prop
23983#line 350
23984    -exported_overlay_prop
23985#line 350
23986    -exported_pm_prop
23987#line 350
23988    -exported_radio_prop
23989#line 350
23990    -exported_secure_prop
23991#line 350
23992    -exported_system_prop
23993#line 350
23994    -exported_system_radio_prop
23995#line 350
23996    -exported_vold_prop
23997#line 350
23998    -exported_wifi_prop
23999#line 350
24000    -extended_core_property_type
24001#line 350
24002    -sota_prop
24003#line 350
24004    -ffs_prop
24005#line 350
24006    -fingerprint_prop
24007#line 350
24008    -firstboot_prop
24009#line 350
24010    -device_config_activity_manager_native_boot_prop
24011#line 350
24012    -device_config_reset_performed_prop
24013#line 350
24014    -device_config_boot_count_prop
24015#line 350
24016    -device_config_input_native_boot_prop
24017#line 350
24018    -device_config_netd_native_prop
24019#line 350
24020    -device_config_runtime_native_boot_prop
24021#line 350
24022    -device_config_runtime_native_prop
24023#line 350
24024    -device_config_media_native_prop
24025#line 350
24026    -dynamic_system_prop
24027#line 350
24028    -gsid_prop
24029#line 350
24030    -heapprofd_enabled_prop
24031#line 350
24032    -heapprofd_prop
24033#line 350
24034    -hwservicemanager_prop
24035#line 350
24036    -last_boot_reason_prop
24037#line 350
24038    -system_lmk_prop
24039#line 350
24040    -log_prop
24041#line 350
24042    -log_tag_prop
24043#line 350
24044    -logd_prop
24045#line 350
24046    -logpersistd_logging_prop
24047#line 350
24048    -lowpan_prop
24049#line 350
24050    -lpdumpd_prop
24051#line 350
24052    -mmc_prop
24053#line 350
24054    -net_dns_prop
24055#line 350
24056    -net_radio_prop
24057#line 350
24058    -netd_stable_secret_prop
24059#line 350
24060    -nfc_prop
24061#line 350
24062    -overlay_prop
24063#line 350
24064    -pan_result_prop
24065#line 350
24066    -persist_debug_prop
24067#line 350
24068    -persistent_properties_ready_prop
24069#line 350
24070    -pm_prop
24071#line 350
24072    -powerctl_prop
24073#line 350
24074    -radio_prop
24075#line 350
24076    -restorecon_prop
24077#line 350
24078    -safemode_prop
24079#line 350
24080    -serialno_prop
24081#line 350
24082    -shell_prop
24083#line 350
24084    -system_boot_reason_prop
24085#line 350
24086    -system_prop
24087#line 350
24088    -system_radio_prop
24089#line 350
24090    -system_trace_prop
24091#line 350
24092    -test_boot_reason_prop
24093#line 350
24094    -test_harness_prop
24095#line 350
24096    -theme_prop
24097#line 350
24098    -time_prop
24099#line 350
24100    -traced_enabled_prop
24101#line 350
24102    -traced_lazy_prop
24103#line 350
24104    -vendor_default_prop
24105#line 350
24106    -vendor_security_patch_level_prop
24107#line 350
24108    -vold_prop
24109#line 350
24110    -wifi_log_prop
24111#line 350
24112    -wifi_prop
24113#line 350
24114  }:property_service set;
24115#line 475
24116
24117#line 1 "system/sepolicy/prebuilts/api/29.0/public/racoon.te"
24118# IKE key management daemon
24119type racoon, domain;
24120type racoon_exec, system_file_type, exec_type, file_type;
24121
24122typeattribute racoon mlstrustedsubject;
24123
24124
24125#line 7
24126typeattribute racoon netdomain;
24127#line 7
24128
24129allowxperm racoon self:udp_socket ioctl { 0x00008914 0x00008916 0x0000891c };
24130
24131
24132#line 10
24133# Call the servicemanager and transfer references to it.
24134#line 10
24135allow racoon servicemanager:binder { call transfer };
24136#line 10
24137# servicemanager performs getpidcon on clients.
24138#line 10
24139allow servicemanager racoon:dir search;
24140#line 10
24141allow servicemanager racoon:file { read open };
24142#line 10
24143allow servicemanager racoon:process getattr;
24144#line 10
24145# rw access to /dev/binder and /dev/ashmem is presently granted to
24146#line 10
24147# all domains in domain.te.
24148#line 10
24149
24150
24151allow racoon tun_device:chr_file { getattr open read ioctl lock map };
24152allowxperm racoon tun_device:chr_file ioctl 0x400454ca;
24153allow racoon cgroup:dir { add_name create };
24154allow racoon kernel:system module_request;
24155
24156allow racoon self:key_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
24157allow racoon self:tun_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
24158allow racoon self:{ capability cap_userns } { net_admin net_bind_service net_raw };
24159
24160# XXX: should we give ip-up-vpn its own label (currently racoon domain)
24161allow racoon system_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
24162
24163allow racoon vpn_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
24164allow racoon vpn_data_file:dir { open search write add_name remove_name lock };
24165
24166
24167#line 27
24168  allow keystore racoon:dir search;
24169#line 27
24170  allow keystore racoon:file { read open };
24171#line 27
24172  allow keystore racoon:process getattr;
24173#line 27
24174  allow racoon keystore_service:service_manager find;
24175#line 27
24176
24177#line 27
24178# Call the server domain and optionally transfer references to it.
24179#line 27
24180allow racoon keystore:binder { call transfer };
24181#line 27
24182# Allow the serverdomain to transfer references to the client on the reply.
24183#line 27
24184allow keystore racoon:binder transfer;
24185#line 27
24186# Receive and use open files from the server.
24187#line 27
24188allow racoon keystore:fd use;
24189#line 27
24190
24191#line 27
24192
24193#line 27
24194# Call the server domain and optionally transfer references to it.
24195#line 27
24196allow keystore racoon:binder { call transfer };
24197#line 27
24198# Allow the serverdomain to transfer references to the client on the reply.
24199#line 27
24200allow racoon keystore:binder transfer;
24201#line 27
24202# Receive and use open files from the server.
24203#line 27
24204allow keystore racoon:fd use;
24205#line 27
24206
24207#line 27
24208
24209
24210# Racoon (VPN) has a restricted set of permissions from the default.
24211allow racoon keystore:keystore_key {
24212	get
24213	sign
24214	verify
24215};
24216#line 1 "system/sepolicy/prebuilts/api/29.0/public/radio.te"
24217# phone subsystem
24218type radio, domain, mlstrustedsubject;
24219
24220
24221#line 4
24222typeattribute radio netdomain;
24223#line 4
24224
24225
24226#line 5
24227typeattribute radio bluetoothdomain;
24228#line 5
24229
24230
24231#line 6
24232typeattribute radio binderservicedomain;
24233#line 6
24234
24235
24236# Talks to hal_telephony_server via the rild socket only for devices without full treble
24237
24238
24239# Data file accesses.
24240allow radio radio_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
24241allow radio radio_data_file:{ file lnk_file sock_file fifo_file } { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
24242
24243
24244allow radio net_data_file:dir search;
24245allow radio net_data_file:file { getattr open read ioctl lock map };
24246
24247# Property service
24248
24249#line 20
24250
24251#line 20
24252allow radio property_socket:sock_file write;
24253#line 20
24254allow radio init:unix_stream_socket connectto;
24255#line 20
24256
24257#line 20
24258allow radio radio_prop:property_service set;
24259#line 20
24260
24261#line 20
24262allow radio radio_prop:file { getattr open read map };
24263#line 20
24264
24265#line 20
24266
24267
24268#line 21
24269
24270#line 21
24271allow radio property_socket:sock_file write;
24272#line 21
24273allow radio init:unix_stream_socket connectto;
24274#line 21
24275
24276#line 21
24277allow radio exported_radio_prop:property_service set;
24278#line 21
24279
24280#line 21
24281allow radio exported_radio_prop:file { getattr open read map };
24282#line 21
24283
24284#line 21
24285
24286
24287#line 22
24288
24289#line 22
24290allow radio property_socket:sock_file write;
24291#line 22
24292allow radio init:unix_stream_socket connectto;
24293#line 22
24294
24295#line 22
24296allow radio exported2_radio_prop:property_service set;
24297#line 22
24298
24299#line 22
24300allow radio exported2_radio_prop:file { getattr open read map };
24301#line 22
24302
24303#line 22
24304
24305
24306#line 23
24307
24308#line 23
24309allow radio property_socket:sock_file write;
24310#line 23
24311allow radio init:unix_stream_socket connectto;
24312#line 23
24313
24314#line 23
24315allow radio exported3_radio_prop:property_service set;
24316#line 23
24317
24318#line 23
24319allow radio exported3_radio_prop:file { getattr open read map };
24320#line 23
24321
24322#line 23
24323
24324
24325#line 24
24326
24327#line 24
24328allow radio property_socket:sock_file write;
24329#line 24
24330allow radio init:unix_stream_socket connectto;
24331#line 24
24332
24333#line 24
24334allow radio net_radio_prop:property_service set;
24335#line 24
24336
24337#line 24
24338allow radio net_radio_prop:file { getattr open read map };
24339#line 24
24340
24341#line 24
24342
24343
24344# ctl interface
24345
24346#line 27
24347
24348#line 27
24349allow radio property_socket:sock_file write;
24350#line 27
24351allow radio init:unix_stream_socket connectto;
24352#line 27
24353
24354#line 27
24355allow radio ctl_rildaemon_prop:property_service set;
24356#line 27
24357
24358#line 27
24359allow radio ctl_rildaemon_prop:file { getattr open read map };
24360#line 27
24361
24362#line 27
24363
24364
24365
24366#line 29
24367  allow radio radio_service:service_manager { add find };
24368#line 29
24369  neverallow { domain -radio } radio_service:service_manager add;
24370#line 29
24371
24372allow radio audioserver_service:service_manager find;
24373allow radio cameraserver_service:service_manager find;
24374allow radio drmserver_service:service_manager find;
24375allow radio mediaserver_service:service_manager find;
24376allow radio nfc_service:service_manager find;
24377allow radio app_api_service:service_manager find;
24378allow radio system_api_service:service_manager find;
24379allow radio timedetector_service:service_manager find;
24380
24381# Perform HwBinder IPC.
24382
24383#line 40
24384# Call the hwservicemanager and transfer references to it.
24385#line 40
24386allow radio hwservicemanager:binder { call transfer };
24387#line 40
24388# Allow hwservicemanager to send out callbacks
24389#line 40
24390allow hwservicemanager radio:binder { call transfer };
24391#line 40
24392# hwservicemanager performs getpidcon on clients.
24393#line 40
24394allow hwservicemanager radio:dir search;
24395#line 40
24396allow hwservicemanager radio:file { read open map };
24397#line 40
24398allow hwservicemanager radio:process getattr;
24399#line 40
24400# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
24401#line 40
24402# all domains in domain.te.
24403#line 40
24404
24405
24406#line 41
24407typeattribute radio halclientdomain;
24408#line 41
24409typeattribute radio hal_telephony_client;
24410#line 41
24411
24412#line 41
24413# TODO(b/34170079): Make the inclusion of the rules below conditional also on
24414#line 41
24415# non-Treble devices. For now, on non-Treble device, always grant clients of a
24416#line 41
24417# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
24418#line 41
24419
24420#line 41
24421
24422
24423# Used by TelephonyManager
24424allow radio proc_cmdline:file { getattr open read ioctl lock map };
24425#line 1 "system/sepolicy/prebuilts/api/29.0/public/recovery.te"
24426# recovery console (used in recovery init.rc for /sbin/recovery)
24427
24428# Declare the domain unconditionally so we can always reference it
24429# in neverallow rules.
24430type recovery, domain;
24431
24432# But the allow rules are only included in the recovery policy.
24433# Otherwise recovery is only allowed the domain rules.
24434#line 141
24435
24436
24437###
24438### neverallow rules
24439###
24440
24441# Recovery should never touch /data.
24442#
24443# In particular, if /data is encrypted, it is not accessible
24444# to recovery anyway.
24445#
24446# For now, we only enforce write/execute restrictions, as domain.te
24447# contains a number of read-only rules that apply to all
24448# domains, including recovery.
24449#
24450# TODO: tighten this up further.
24451neverallow recovery {
24452   data_file_type
24453   -cache_file
24454   -cache_recovery_file
24455
24456}:file { { append create link unlink relabelfrom rename setattr write } { execute execute_no_trans } };
24457neverallow recovery {
24458   data_file_type
24459   -cache_file
24460   -cache_recovery_file
24461
24462}:dir { add_name create link relabelfrom remove_name rename reparent rmdir setattr write };
24463#line 1 "system/sepolicy/prebuilts/api/29.0/public/recovery_persist.te"
24464# android recovery persistent log manager
24465type recovery_persist, domain;
24466type recovery_persist_exec, system_file_type, exec_type, file_type;
24467
24468allow recovery_persist pstorefs:dir search;
24469allow recovery_persist pstorefs:file { getattr open read ioctl lock map };
24470
24471allow recovery_persist recovery_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
24472allow recovery_persist recovery_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
24473
24474allow recovery_persist cache_file:dir search;
24475allow recovery_persist cache_file:lnk_file read;
24476allow recovery_persist cache_recovery_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
24477allow recovery_persist cache_recovery_file:file { { getattr open read ioctl lock map } unlink };
24478
24479###
24480### Neverallow rules
24481###
24482### recovery_persist should NEVER do any of this
24483
24484# Block device access.
24485neverallow recovery_persist dev_type:blk_file { read write };
24486
24487# ptrace any other app
24488neverallow recovery_persist domain:process ptrace;
24489
24490# Write to /system.
24491neverallow recovery_persist system_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
24492
24493# Write to files in /data/data
24494neverallow recovery_persist { privapp_data_file app_data_file system_data_file }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
24495
24496#line 1 "system/sepolicy/prebuilts/api/29.0/public/recovery_refresh.te"
24497# android recovery refresh log manager
24498type recovery_refresh, domain;
24499type recovery_refresh_exec, system_file_type, exec_type, file_type;
24500
24501allow recovery_refresh pstorefs:dir search;
24502allow recovery_refresh pstorefs:file { getattr open read ioctl lock map };
24503# NB: domain inherits write_logd which hands us write to pmsg_device
24504
24505###
24506### Neverallow rules
24507###
24508### recovery_refresh should NEVER do any of this
24509
24510# Block device access.
24511neverallow recovery_refresh dev_type:blk_file { read write };
24512
24513# ptrace any other app
24514neverallow recovery_refresh domain:process ptrace;
24515
24516# Write to /system.
24517neverallow recovery_refresh system_file:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
24518
24519# Write to files in /data/data or system files on /data
24520neverallow recovery_refresh { app_data_file privapp_data_file system_data_file }:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } write;
24521#line 1 "system/sepolicy/prebuilts/api/29.0/public/rs.te"
24522type rs, domain, coredomain;
24523type rs_exec, system_file_type, exec_type, file_type;
24524#line 1 "system/sepolicy/prebuilts/api/29.0/public/rss_hwm_reset.te"
24525# rss_hwm_reset resets RSS high-water mark counters for all procesess.
24526type rss_hwm_reset, domain, coredomain, mlstrustedsubject;
24527#line 1 "system/sepolicy/prebuilts/api/29.0/public/runas.te"
24528type runas, domain, mlstrustedsubject;
24529type runas_exec, system_file_type, exec_type, file_type;
24530
24531allow runas adbd:fd use;
24532allow runas adbd:process sigchld;
24533allow runas adbd:unix_stream_socket { read write };
24534allow runas shell:fd use;
24535allow runas shell:fifo_file { read write };
24536allow runas shell:unix_stream_socket { read write };
24537allow runas devpts:chr_file { read write ioctl };
24538allow runas shell_data_file:file { read write };
24539
24540# run-as reads package information.
24541allow runas system_data_file:file { getattr open read ioctl lock map };
24542allow runas system_data_file:lnk_file getattr;
24543allow runas packages_list_file:file { getattr open read ioctl lock map };
24544
24545# The app's data dir may be accessed through a symlink.
24546allow runas system_data_file:lnk_file read;
24547
24548# run-as checks and changes to the app data dir.
24549dontaudit runas self:{ capability cap_userns } { dac_override dac_read_search };
24550allow runas app_data_file:dir { getattr search };
24551
24552# run-as switches to the app UID/GID.
24553allow runas self:{ capability cap_userns } { setuid setgid };
24554
24555# run-as switches to the app security context.
24556
24557#line 29
24558
24559#line 29
24560allow runas selinuxfs:dir { open getattr read search ioctl lock };
24561#line 29
24562allow runas selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
24563#line 29
24564
24565#line 29
24566allow runas selinuxfs:file { open append write lock map };
24567#line 29
24568allow runas kernel:security check_context;
24569#line 29
24570 # validate context
24571allow runas self:process setcurrent;
24572allow runas { appdomain -system_app }:process dyntransition; # setcon
24573
24574# runas/libselinux needs access to seapp_contexts_file to
24575# determine which domain to transition to.
24576allow runas seapp_contexts_file:file { getattr open read ioctl lock map };
24577
24578###
24579### neverallow rules
24580###
24581
24582# run-as cannot have capabilities other than CAP_SETUID and CAP_SETGID
24583neverallow runas self:{ capability cap_userns } ~{ setuid setgid };
24584neverallow runas self:{ capability2 cap2_userns } *;
24585#line 1 "system/sepolicy/prebuilts/api/29.0/public/runas_app.te"
24586type runas_app, domain;
24587#line 1 "system/sepolicy/prebuilts/api/29.0/public/scheduler_service_server.te"
24588
24589#line 1
24590  allow scheduler_service_server fwk_scheduler_hwservice:hwservice_manager { add find };
24591#line 1
24592  allow scheduler_service_server hidl_base_hwservice:hwservice_manager add;
24593#line 1
24594  neverallow { domain -scheduler_service_server } fwk_scheduler_hwservice:hwservice_manager add;
24595#line 1
24596
24597#line 1 "system/sepolicy/prebuilts/api/29.0/public/sdcardd.te"
24598type sdcardd, domain;
24599type sdcardd_exec, system_file_type, exec_type, file_type;
24600
24601allow sdcardd cgroup:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
24602allow sdcardd fuse_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
24603allow sdcardd rootfs:dir mounton;  # TODO: deprecated in M
24604allow sdcardd sdcardfs:filesystem remount;
24605allow sdcardd tmpfs:dir { open getattr read search ioctl lock };
24606allow sdcardd mnt_media_rw_file:dir { open getattr read search ioctl lock };
24607allow sdcardd storage_file:dir search;
24608allow sdcardd storage_stub_file:dir { search mounton };
24609allow sdcardd sdcard_type:filesystem { mount unmount };
24610allow sdcardd self:{ capability cap_userns } { setuid setgid dac_override dac_read_search sys_admin sys_resource };
24611
24612allow sdcardd sdcard_type:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
24613allow sdcardd sdcard_type:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
24614
24615allow sdcardd media_rw_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
24616allow sdcardd media_rw_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
24617
24618# Read /data/system/packages.list.
24619allow sdcardd system_data_file:file { getattr open read ioctl lock map };
24620allow sdcardd packages_list_file:file { getattr open read ioctl lock map };
24621
24622# Read /data/.layout_version
24623allow sdcardd install_data_file:file { getattr open read ioctl lock map };
24624
24625# Allow stdin/out back to vold
24626allow sdcardd vold:fd use;
24627allow sdcardd vold:fifo_file { read write getattr };
24628
24629# Allow running on top of expanded storage
24630allow sdcardd mnt_expand_file:dir search;
24631
24632# access /proc/filesystems
24633allow sdcardd proc_filesystems:file { getattr open read ioctl lock map };
24634
24635###
24636### neverallow rules
24637###
24638
24639# The sdcard daemon should no longer be started from init
24640neverallow init sdcardd_exec:file execute;
24641neverallow init sdcardd:process { transition dyntransition };
24642#line 1 "system/sepolicy/prebuilts/api/29.0/public/secure_element.te"
24643# secure_element subsystem
24644type secure_element, domain;
24645#line 1 "system/sepolicy/prebuilts/api/29.0/public/sensor_service_server.te"
24646
24647#line 1
24648  allow sensor_service_server fwk_sensor_hwservice:hwservice_manager { add find };
24649#line 1
24650  allow sensor_service_server hidl_base_hwservice:hwservice_manager add;
24651#line 1
24652  neverallow { domain -sensor_service_server } fwk_sensor_hwservice:hwservice_manager add;
24653#line 1
24654
24655#line 1 "system/sepolicy/prebuilts/api/29.0/public/service.te"
24656type apex_service,              service_manager_type;
24657type audioserver_service,       service_manager_type;
24658type batteryproperties_service, app_api_service, ephemeral_app_api_service, service_manager_type;
24659type bluetooth_service,         service_manager_type;
24660type cameraserver_service,      service_manager_type;
24661type default_android_service,   service_manager_type;
24662type dnsresolver_service,       service_manager_type;
24663type drmserver_service,         service_manager_type;
24664type dumpstate_service,         service_manager_type;
24665type fingerprintd_service,      service_manager_type;
24666type hal_fingerprint_service,   service_manager_type;
24667type gatekeeper_service,        app_api_service, service_manager_type;
24668type gpu_service,               app_api_service, service_manager_type;
24669type idmap_service,             service_manager_type;
24670type iorapd_service,            service_manager_type;
24671type incident_service,          service_manager_type;
24672type installd_service,          service_manager_type;
24673type keystore_service,          service_manager_type;
24674type lpdump_service,            service_manager_type;
24675type mediaserver_service,       service_manager_type;
24676type mediametrics_service,      service_manager_type;
24677type mediaextractor_service,    service_manager_type;
24678type mediacodec_service,        service_manager_type;
24679type mediadrmserver_service,    service_manager_type;
24680type netd_service,              service_manager_type;
24681type nfc_service,               service_manager_type;
24682type perfprofd_service,         service_manager_type;
24683type radio_service,             service_manager_type;
24684type secure_element_service,    service_manager_type;
24685type storaged_service,          service_manager_type;
24686type surfaceflinger_service,    app_api_service, ephemeral_app_api_service, service_manager_type;
24687type system_app_service,        service_manager_type;
24688type system_suspend_control_service, service_manager_type;
24689type update_engine_service,     service_manager_type;
24690type virtual_touchpad_service,  service_manager_type;
24691type vold_service,              service_manager_type;
24692type vr_hwc_service,            service_manager_type;
24693type vrflinger_vsync_service,   service_manager_type;
24694
24695# system_server_services broken down
24696type accessibility_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24697type account_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24698type activity_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24699type activity_task_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24700type adb_service, system_api_service, system_server_service, service_manager_type;
24701type alarm_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24702type app_binding_service, system_server_service, service_manager_type;
24703type app_prediction_service, app_api_service, system_server_service, service_manager_type;
24704type appops_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24705type appwidget_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24706type assetatlas_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24707type audio_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24708type autofill_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24709type backup_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24710type batterystats_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24711type battery_service, system_server_service, service_manager_type;
24712type binder_calls_stats_service, system_server_service, service_manager_type;
24713type bluetooth_manager_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24714type broadcastradio_service, system_server_service, service_manager_type;
24715type cameraproxy_service, system_server_service, service_manager_type;
24716type clipboard_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24717type contexthub_service, app_api_service,  system_server_service, service_manager_type;
24718type crossprofileapps_service, app_api_service, system_server_service, service_manager_type;
24719type IProxyService_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24720type companion_device_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24721type connectivity_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24722type connmetrics_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24723type consumer_ir_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24724type content_capture_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24725type content_suggestions_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24726type content_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24727type country_detector_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24728# Note: The coverage_service should only be enabled for userdebug / eng builds that were compiled
24729# with EMMA_INSTRUMENT=true. We should consider locking this down in the future.
24730type coverage_service, system_server_service, service_manager_type;
24731type cpuinfo_service, system_api_service, system_server_service, service_manager_type;
24732type dbinfo_service, system_api_service, system_server_service, service_manager_type;
24733type device_config_service, system_server_service, service_manager_type;
24734type device_policy_service, app_api_service, system_server_service, service_manager_type;
24735type deviceidle_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24736type device_identifiers_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24737type devicestoragemonitor_service, system_server_service, service_manager_type;
24738type diskstats_service, system_api_service, system_server_service, service_manager_type;
24739type display_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24740type color_display_service, system_api_service, system_server_service, service_manager_type;
24741type external_vibrator_service, system_server_service, service_manager_type;
24742type font_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24743type netd_listener_service, system_server_service, service_manager_type;
24744type network_watchlist_service, system_server_service, service_manager_type;
24745type DockObserver_service, system_server_service, service_manager_type;
24746type dreams_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24747type dropbox_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24748type lowpan_service, system_api_service, system_server_service, service_manager_type;
24749type ethernet_service, app_api_service, system_server_service, service_manager_type;
24750type biometric_service, app_api_service, system_server_service, service_manager_type;
24751type bugreport_service, system_api_service, system_server_service, service_manager_type;
24752type face_service, app_api_service, system_server_service, service_manager_type;
24753type fingerprint_service, app_api_service, system_server_service, service_manager_type;
24754type gfxinfo_service, system_api_service, system_server_service, service_manager_type;
24755type graphicsstats_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24756type hardware_service, system_server_service, service_manager_type;
24757type hardware_properties_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24758type hdmi_control_service, system_api_service, system_server_service, service_manager_type;
24759type imms_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24760type input_method_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24761type input_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24762type ipsec_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24763type iris_service, app_api_service, system_server_service, service_manager_type;
24764type jobscheduler_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24765type launcherapps_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24766type location_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24767type lock_settings_service, system_api_service, system_server_service, service_manager_type;
24768type looper_stats_service, system_server_service, service_manager_type;
24769type media_projection_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24770type media_router_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24771type media_session_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24772type meminfo_service, system_api_service, system_server_service, service_manager_type;
24773type midi_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24774type mount_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24775type netpolicy_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24776type netstats_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24777type network_management_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24778type network_score_service, system_api_service, system_server_service, service_manager_type;
24779type network_stack_service, system_server_service, service_manager_type;
24780type network_time_update_service, system_server_service, service_manager_type;
24781type notification_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24782type oem_lock_service, system_api_service, system_server_service, service_manager_type;
24783type otadexopt_service, system_server_service, service_manager_type;
24784type overlay_service, system_api_service, system_server_service, service_manager_type;
24785type package_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24786type package_native_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24787type permission_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24788type permissionmgr_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24789type persistent_data_block_service, system_api_service, system_server_service, service_manager_type;
24790type pinner_service, system_server_service, service_manager_type;
24791type power_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24792type print_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24793type processinfo_service, system_server_service, service_manager_type;
24794type procstats_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24795type recovery_service, system_server_service, service_manager_type;
24796type registry_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24797type restrictions_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24798type role_service, app_api_service, system_server_service, service_manager_type;
24799type rollback_service, app_api_service, system_server_service, service_manager_type;
24800type runtime_service, system_server_service, service_manager_type;
24801type rttmanager_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24802type samplingprofiler_service, system_server_service, service_manager_type;
24803type scheduling_policy_service, system_server_service, service_manager_type;
24804type search_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24805type sec_key_att_app_id_provider_service, app_api_service, system_server_service, service_manager_type;
24806type sensorservice_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24807type sensor_privacy_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24808type serial_service, system_api_service, system_server_service, service_manager_type;
24809type servicediscovery_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24810type settings_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24811type shortcut_service, app_api_service, system_server_service, service_manager_type;
24812type slice_service, app_api_service, system_server_service, service_manager_type;
24813type statusbar_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24814type storagestats_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24815type system_update_service, system_server_service, service_manager_type;
24816type task_service, system_server_service, service_manager_type;
24817type testharness_service, system_server_service, service_manager_type;
24818type textclassification_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24819type textservices_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24820type telecom_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24821type thermal_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24822type timedetector_service, system_server_service, service_manager_type;
24823type timezone_service, system_server_service, service_manager_type;
24824type trust_service, app_api_service, system_server_service, service_manager_type;
24825type tv_input_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24826type uimode_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24827type updatelock_service, system_api_service, system_server_service, service_manager_type;
24828type uri_grants_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24829type usagestats_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24830type usb_service, app_api_service, system_server_service, service_manager_type;
24831type user_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24832type vibrator_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24833type voiceinteraction_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24834type vr_manager_service, system_server_service, service_manager_type;
24835type wallpaper_service, app_api_service, system_server_service, service_manager_type;
24836type webviewupdate_service, app_api_service, ephemeral_app_api_service, system_server_service, service_manager_type;
24837type wifip2p_service, app_api_service, system_server_service, service_manager_type;
24838type wifiscanner_service, system_api_service, system_server_service, service_manager_type;
24839type wifi_service, app_api_service, system_server_service, service_manager_type;
24840type wificond_service, service_manager_type;
24841type wifiaware_service, app_api_service, system_server_service, service_manager_type;
24842type window_service, system_api_service, system_server_service, service_manager_type;
24843type inputflinger_service, system_api_service, system_server_service, service_manager_type;
24844type wpantund_service, system_api_service, service_manager_type;
24845
24846###
24847### Neverallow rules
24848###
24849
24850# servicemanager handles registering or looking up named services.
24851# It does not make sense to register or lookup something which is not a service.
24852# Trigger a compile error if this occurs.
24853neverallow domain ~{ service_manager_type vndservice_manager_type }:service_manager { add find };
24854#line 1 "system/sepolicy/prebuilts/api/29.0/public/servicemanager.te"
24855# servicemanager - the Binder context manager
24856type servicemanager, domain, mlstrustedsubject;
24857type servicemanager_exec, system_file_type, exec_type, file_type;
24858
24859# Note that we do not use the binder_* macros here.
24860# servicemanager is unique in that it only provides
24861# name service (aka context manager) for Binder.
24862# As such, it only ever receives and transfers other references
24863# created by other domains.  It never passes its own references
24864# or initiates a Binder IPC.
24865allow servicemanager self:binder set_context_mgr;
24866allow servicemanager {
24867  domain
24868  -init
24869  -vendor_init
24870  -hwservicemanager
24871  -vndservicemanager
24872}:binder transfer;
24873
24874allow servicemanager service_contexts_file:file { getattr open read ioctl lock map };
24875# nonplat_service_contexts only accessible on non full-treble devices
24876
24877
24878# Check SELinux permissions.
24879
24880#line 25
24881
24882#line 25
24883allow servicemanager selinuxfs:dir { open getattr read search ioctl lock };
24884#line 25
24885allow servicemanager selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
24886#line 25
24887
24888#line 25
24889allow servicemanager selinuxfs:file { open append write lock map };
24890#line 25
24891allow servicemanager kernel:security compute_av;
24892#line 25
24893allow servicemanager self:netlink_selinux_socket { read write create getattr setattr lock relabelfrom relabelto append bind connect listen accept getopt setopt shutdown recvfrom sendto name_bind };
24894#line 25
24895
24896#line 1 "system/sepolicy/prebuilts/api/29.0/public/sgdisk.te"
24897# sgdisk called from vold
24898type sgdisk, domain;
24899type sgdisk_exec, system_file_type, exec_type, file_type;
24900
24901# Allowed to read/write low-level partition tables
24902allow sgdisk block_device:dir search;
24903allow sgdisk vold_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
24904# HDIO_GETGEO needed to get the number of disk heads
24905# on vold_device. How quaint.
24906allowxperm sgdisk vold_device:blk_file ioctl { 0x00000301 };
24907# sgdisk also uses BLKGETSIZE and BLKGETSIZE64. BLKGETSIZE64
24908# is granted to all block device users in domain.te, so
24909# no need to mention it here. sgdisk should not be
24910# using the BLKGETSIZE ioctl as it is useless for devices over
24911# 2T in size, but we allow it for now and hope that sgdisk
24912# will fix their bug.
24913allowxperm sgdisk vold_device:blk_file ioctl { 0x00001260 };
24914# Force a re-read of the partition table.
24915allowxperm sgdisk vold_device:blk_file ioctl { 0x0000125f };
24916
24917# Inherit and use pty created by android_fork_execvp()
24918allow sgdisk devpts:chr_file { read write ioctl getattr };
24919
24920# Allow stdin/out back to vold
24921allow sgdisk vold:fd use;
24922allow sgdisk vold:fifo_file { read write getattr };
24923
24924# Used to probe kernel to reload partition tables
24925allow sgdisk self:{ capability cap_userns } sys_admin;
24926
24927# Only allow entry from vold
24928neverallow { domain -vold } sgdisk:process transition;
24929neverallow * sgdisk:process dyntransition;
24930neverallow sgdisk { file_type fs_type -sgdisk_exec }:file entrypoint;
24931#line 1 "system/sepolicy/prebuilts/api/29.0/public/shared_relro.te"
24932# Process which creates/updates shared RELRO files to be used by other apps.
24933type shared_relro, domain;
24934
24935# Grant write access to the shared relro files/directory.
24936allow shared_relro shared_relro_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
24937allow shared_relro shared_relro_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
24938
24939# Needs to contact the "webviewupdate" and "activity" services
24940allow shared_relro activity_service:service_manager find;
24941allow shared_relro webviewupdate_service:service_manager find;
24942allow shared_relro package_service:service_manager find;
24943#line 1 "system/sepolicy/prebuilts/api/29.0/public/shell.te"
24944# Domain for shell processes spawned by ADB or console service.
24945type shell, domain, mlstrustedsubject;
24946type shell_exec, system_file_type, exec_type, file_type;
24947
24948# Create and use network sockets.
24949
24950#line 6
24951typeattribute shell netdomain;
24952#line 6
24953
24954
24955# logcat
24956
24957#line 9
24958allow shell logcat_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
24959#line 9
24960
24961#line 9
24962allow shell logdr_socket:sock_file write;
24963#line 9
24964allow shell logd:unix_stream_socket connectto;
24965#line 9
24966
24967#line 9
24968
24969
24970#line 10
24971# Group AID_LOG checked by filesystem & logd
24972#line 10
24973# to permit control commands
24974#line 10
24975
24976#line 10
24977allow shell logd_socket:sock_file write;
24978#line 10
24979allow shell logd:unix_stream_socket connectto;
24980#line 10
24981
24982#line 10
24983
24984# logcat -L (directly, or via dumpstate)
24985allow shell pstorefs:dir search;
24986allow shell pstorefs:file { getattr open read ioctl lock map };
24987
24988# Root fs.
24989allow shell rootfs:dir { open getattr read search ioctl lock };
24990
24991# read files in /data/anr
24992allow shell anr_data_file:dir { open getattr read search ioctl lock };
24993allow shell anr_data_file:file { getattr open read ioctl lock map };
24994
24995# Access /data/local/tmp.
24996allow shell shell_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
24997allow shell shell_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
24998allow shell shell_data_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
24999allow shell shell_data_file:lnk_file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
25000
25001# Read and delete from /data/local/traces.
25002allow shell trace_data_file:file { { getattr open read ioctl lock map } unlink };
25003allow shell trace_data_file:dir { { open getattr read search ioctl lock } remove_name write };
25004
25005# Access /data/misc/profman.
25006allow shell profman_dump_data_file:dir { write remove_name { open getattr read search ioctl lock } };
25007allow shell profman_dump_data_file:file { unlink { getattr open read ioctl lock map } };
25008
25009# Read/execute files in /data/nativetest
25010#line 40
25011
25012
25013# adb bugreport
25014
25015#line 43
25016allow shell dumpstate_socket:sock_file write;
25017#line 43
25018allow shell dumpstate:unix_stream_socket connectto;
25019#line 43
25020
25021
25022allow shell devpts:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
25023allow shell tty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
25024allow shell console_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
25025
25026allow shell input_device:dir { open getattr read search ioctl lock };
25027allow shell input_device:chr_file { getattr open read ioctl lock map };
25028
25029
25030#line 52
25031allow shell system_file:dir { open getattr read search ioctl lock };
25032#line 52
25033allow shell system_file:{ file lnk_file } { getattr open read ioctl lock map };
25034#line 52
25035
25036allow shell system_file:file { getattr execute execute_no_trans map };
25037allow shell toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25038allow shell tzdatacheck_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25039allow shell shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25040allow shell zygote_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25041
25042
25043#line 59
25044allow shell apk_data_file:dir { open getattr read search ioctl lock };
25045#line 59
25046allow shell apk_data_file:{ file lnk_file } { getattr open read ioctl lock map };
25047#line 59
25048
25049
25050# Set properties.
25051
25052#line 62
25053
25054#line 62
25055allow shell property_socket:sock_file write;
25056#line 62
25057allow shell init:unix_stream_socket connectto;
25058#line 62
25059
25060#line 62
25061allow shell shell_prop:property_service set;
25062#line 62
25063
25064#line 62
25065allow shell shell_prop:file { getattr open read map };
25066#line 62
25067
25068#line 62
25069
25070
25071#line 63
25072
25073#line 63
25074allow shell property_socket:sock_file write;
25075#line 63
25076allow shell init:unix_stream_socket connectto;
25077#line 63
25078
25079#line 63
25080allow shell ctl_bugreport_prop:property_service set;
25081#line 63
25082
25083#line 63
25084allow shell ctl_bugreport_prop:file { getattr open read map };
25085#line 63
25086
25087#line 63
25088
25089
25090#line 64
25091
25092#line 64
25093allow shell property_socket:sock_file write;
25094#line 64
25095allow shell init:unix_stream_socket connectto;
25096#line 64
25097
25098#line 64
25099allow shell ctl_dumpstate_prop:property_service set;
25100#line 64
25101
25102#line 64
25103allow shell ctl_dumpstate_prop:file { getattr open read map };
25104#line 64
25105
25106#line 64
25107
25108
25109#line 65
25110
25111#line 65
25112allow shell property_socket:sock_file write;
25113#line 65
25114allow shell init:unix_stream_socket connectto;
25115#line 65
25116
25117#line 65
25118allow shell dumpstate_prop:property_service set;
25119#line 65
25120
25121#line 65
25122allow shell dumpstate_prop:file { getattr open read map };
25123#line 65
25124
25125#line 65
25126
25127
25128#line 66
25129
25130#line 66
25131allow shell property_socket:sock_file write;
25132#line 66
25133allow shell init:unix_stream_socket connectto;
25134#line 66
25135
25136#line 66
25137allow shell exported_dumpstate_prop:property_service set;
25138#line 66
25139
25140#line 66
25141allow shell exported_dumpstate_prop:file { getattr open read map };
25142#line 66
25143
25144#line 66
25145
25146
25147#line 67
25148
25149#line 67
25150allow shell property_socket:sock_file write;
25151#line 67
25152allow shell init:unix_stream_socket connectto;
25153#line 67
25154
25155#line 67
25156allow shell debug_prop:property_service set;
25157#line 67
25158
25159#line 67
25160allow shell debug_prop:file { getattr open read map };
25161#line 67
25162
25163#line 67
25164
25165
25166#line 68
25167
25168#line 68
25169allow shell property_socket:sock_file write;
25170#line 68
25171allow shell init:unix_stream_socket connectto;
25172#line 68
25173
25174#line 68
25175allow shell powerctl_prop:property_service set;
25176#line 68
25177
25178#line 68
25179allow shell powerctl_prop:file { getattr open read map };
25180#line 68
25181
25182#line 68
25183
25184
25185#line 69
25186
25187#line 69
25188allow shell property_socket:sock_file write;
25189#line 69
25190allow shell init:unix_stream_socket connectto;
25191#line 69
25192
25193#line 69
25194allow shell log_tag_prop:property_service set;
25195#line 69
25196
25197#line 69
25198allow shell log_tag_prop:file { getattr open read map };
25199#line 69
25200
25201#line 69
25202
25203
25204#line 70
25205
25206#line 70
25207allow shell property_socket:sock_file write;
25208#line 70
25209allow shell init:unix_stream_socket connectto;
25210#line 70
25211
25212#line 70
25213allow shell wifi_log_prop:property_service set;
25214#line 70
25215
25216#line 70
25217allow shell wifi_log_prop:file { getattr open read map };
25218#line 70
25219
25220#line 70
25221
25222# Allow shell to start/stop traced via the persist.traced.enable
25223# property (which also takes care of /data/misc initialization).
25224
25225#line 73
25226
25227#line 73
25228allow shell property_socket:sock_file write;
25229#line 73
25230allow shell init:unix_stream_socket connectto;
25231#line 73
25232
25233#line 73
25234allow shell traced_enabled_prop:property_service set;
25235#line 73
25236
25237#line 73
25238allow shell traced_enabled_prop:file { getattr open read map };
25239#line 73
25240
25241#line 73
25242
25243# adjust is_loggable properties
25244
25245# logpersist script
25246
25247# Allow shell to start/stop heapprofd via the persist.heapprofd.enable
25248# property.
25249
25250#line 80
25251
25252#line 80
25253allow shell property_socket:sock_file write;
25254#line 80
25255allow shell init:unix_stream_socket connectto;
25256#line 80
25257
25258#line 80
25259allow shell heapprofd_enabled_prop:property_service set;
25260#line 80
25261
25262#line 80
25263allow shell heapprofd_enabled_prop:file { getattr open read map };
25264#line 80
25265
25266#line 80
25267
25268# Allow shell to start/stop gsid via ctl.start|stop|restart gsid.
25269
25270#line 82
25271
25272#line 82
25273allow shell property_socket:sock_file write;
25274#line 82
25275allow shell init:unix_stream_socket connectto;
25276#line 82
25277
25278#line 82
25279allow shell ctl_gsid_prop:property_service set;
25280#line 82
25281
25282#line 82
25283allow shell ctl_gsid_prop:file { getattr open read map };
25284#line 82
25285
25286#line 82
25287
25288# Allow shell to enable Dynamic System Update
25289
25290#line 84
25291
25292#line 84
25293allow shell property_socket:sock_file write;
25294#line 84
25295allow shell init:unix_stream_socket connectto;
25296#line 84
25297
25298#line 84
25299allow shell dynamic_system_prop:property_service set;
25300#line 84
25301
25302#line 84
25303allow shell dynamic_system_prop:file { getattr open read map };
25304#line 84
25305
25306#line 84
25307
25308
25309#line 91
25310
25311
25312# Read device's serial number from system properties
25313
25314#line 94
25315allow shell serialno_prop:file { getattr open read map };
25316#line 94
25317
25318
25319# Allow shell to read the vendor security patch level for CTS
25320
25321#line 97
25322allow shell vendor_security_patch_level_prop:file { getattr open read map };
25323#line 97
25324
25325
25326# Read state of logging-related properties
25327
25328#line 100
25329allow shell device_logging_prop:file { getattr open read map };
25330#line 100
25331
25332
25333# Read state of boot reason properties
25334
25335#line 103
25336allow shell bootloader_boot_reason_prop:file { getattr open read map };
25337#line 103
25338
25339
25340#line 104
25341allow shell last_boot_reason_prop:file { getattr open read map };
25342#line 104
25343
25344
25345#line 105
25346allow shell system_boot_reason_prop:file { getattr open read map };
25347#line 105
25348
25349
25350# allow shell access to services
25351allow shell servicemanager:service_manager list;
25352# don't allow shell to access GateKeeper service
25353# TODO: why is this so broad? Tightening candidate? It needs at list:
25354# - dumpstate_service (so it can receive dumpstate progress updates)
25355allow shell {
25356  service_manager_type
25357  -apex_service
25358  -dnsresolver_service
25359  -gatekeeper_service
25360  -incident_service
25361  -installd_service
25362  -iorapd_service
25363  -netd_service
25364  -system_suspend_control_service
25365  -virtual_touchpad_service
25366  -vold_service
25367  -vr_hwc_service
25368}:service_manager find;
25369allow shell dumpstate:binder call;
25370
25371# allow shell to get information from hwservicemanager
25372# for instance, listing hardware services with lshal
25373
25374#line 130
25375# Call the hwservicemanager and transfer references to it.
25376#line 130
25377allow shell hwservicemanager:binder { call transfer };
25378#line 130
25379# Allow hwservicemanager to send out callbacks
25380#line 130
25381allow hwservicemanager shell:binder { call transfer };
25382#line 130
25383# hwservicemanager performs getpidcon on clients.
25384#line 130
25385allow hwservicemanager shell:dir search;
25386#line 130
25387allow hwservicemanager shell:file { read open map };
25388#line 130
25389allow hwservicemanager shell:process getattr;
25390#line 130
25391# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
25392#line 130
25393# all domains in domain.te.
25394#line 130
25395
25396allow shell hwservicemanager:hwservice_manager list;
25397
25398# allow shell to look through /proc/ for lsmod, ps, top, netstat.
25399
25400#line 134
25401allow shell proc_net_type:dir { open getattr read search ioctl lock };
25402#line 134
25403allow shell proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
25404#line 134
25405
25406
25407allow shell {
25408  proc_asound
25409  proc_filesystems
25410  proc_interrupts
25411  proc_loadavg # b/124024827
25412  proc_meminfo
25413  proc_modules
25414  proc_pid_max
25415  proc_slabinfo
25416  proc_stat
25417  proc_timer
25418  proc_uptime
25419  proc_version
25420  proc_zoneinfo
25421}:file { getattr open read ioctl lock map };
25422
25423# allow listing network interfaces under /sys/class/net.
25424allow shell sysfs_net:dir { open getattr read search ioctl lock };
25425
25426
25427#line 155
25428allow shell cgroup:dir { open getattr read search ioctl lock };
25429#line 155
25430allow shell cgroup:{ file lnk_file } { getattr open read ioctl lock map };
25431#line 155
25432
25433allow shell domain:dir { search open read getattr };
25434allow shell domain:{ file lnk_file } { open read getattr };
25435
25436# statvfs() of /proc and other labeled filesystems
25437# (yaffs2, jffs2, ext2, ext3, ext4, xfs, btrfs, f2fs, squashfs, overlay)
25438allow shell { proc labeledfs }:filesystem getattr;
25439
25440# stat() of /dev
25441allow shell device:dir getattr;
25442
25443# allow shell to read /proc/pid/attr/current for ps -Z
25444allow shell domain:process getattr;
25445
25446# Allow pulling the SELinux policy for CTS purposes
25447allow shell selinuxfs:dir { open getattr read search ioctl lock };
25448allow shell selinuxfs:file { getattr open read ioctl lock map };
25449
25450# enable shell domain to read/write files/dirs for bootchart data
25451# User will creates the start and stop file via adb shell
25452# and read other files created by init process under /data/bootchart
25453allow shell bootchart_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
25454allow shell bootchart_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
25455
25456# Make sure strace works for the non-privileged shell user
25457allow shell self:process ptrace;
25458
25459# allow shell to get battery info
25460allow shell sysfs:dir { open getattr read search ioctl lock };
25461allow shell sysfs_batteryinfo:dir { open getattr read search ioctl lock };
25462allow shell sysfs_batteryinfo:file { getattr open read ioctl lock map };
25463
25464# Allow access to ion memory allocation device.
25465allow shell ion_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
25466
25467#
25468# filesystem test for insecure chr_file's is done
25469# via a host side test
25470#
25471allow shell dev_type:dir { open getattr read search ioctl lock };
25472allow shell dev_type:chr_file getattr;
25473
25474# /dev/fd is a symlink
25475allow shell proc:lnk_file getattr;
25476
25477#
25478# filesystem test for insucre blk_file's is done
25479# via hostside test
25480#
25481allow shell dev_type:blk_file getattr;
25482
25483# read selinux policy files
25484allow shell file_contexts_file:file { getattr open read ioctl lock map };
25485allow shell property_contexts_file:file { getattr open read ioctl lock map };
25486allow shell seapp_contexts_file:file { getattr open read ioctl lock map };
25487allow shell service_contexts_file:file { getattr open read ioctl lock map };
25488allow shell sepolicy_file:file { getattr open read ioctl lock map };
25489
25490# Allow shell to start up vendor shell
25491allow shell vendor_shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25492
25493# Everything is labeled as rootfs in recovery mode. Allow shell to
25494# execute them.
25495#line 220
25496
25497
25498###
25499### Neverallow rules
25500###
25501
25502# Do not allow shell to hard link to any files.
25503# In particular, if shell hard links to app data
25504# files, installd will not be able to guarantee the deletion
25505# of the linked to file. Hard links also contribute to security
25506# bugs, so we want to ensure the shell user never has this
25507# capability.
25508neverallow shell file_type:file link;
25509
25510# Do not allow privileged socket ioctl commands
25511neverallowxperm shell domain:{ rawip_socket tcp_socket udp_socket } ioctl
25512#line 235
25513{
25514#line 235
25515# qualcomm rmnet ioctls
25516#line 235
255170x00006900 0x00006902
25518#line 235
25519# socket ioctls
25520#line 235
255210x0000890b 0x0000890c 0x0000890d 0x00008911 0x00008914 0x00008916
25522#line 235
255230x00008918 0x0000891a 0x0000891c 0x0000891d 0x0000891e 0x0000891f
25524#line 235
255250x00008920 0x00008922 0x00008923 0x00008924 0x00008925 0x00008926
25526#line 235
255270x00008927 0x00008929 0x00008930 0x00008931 0x00008932
25528#line 235
255290x00008934 0x00008935 0x00008936 0x00008937 0x00008939 0x00008940 0x00008941
25530#line 235
255310x00008943 0x00008946 0x00008947 0x00008948 0x00008949 0x0000894a
25532#line 235
255330x0000894b 0x00008953 0x00008954 0x00008955 0x00008960 0x00008961 0x00008962 0x00008970
25534#line 235
255350x00008971 0x00008980 0x00008981 0x00008982 0x00008983 0x00008990
25536#line 235
255370x00008991 0x00008992 0x00008993 0x00008994
25538#line 235
255390x00008995 0x000089a0 0x000089a1 0x000089a2 0x000089a3 0x000089b0
25540#line 235
25541# device and protocol specific ioctls
25542#line 235
255430x000089f0-0x000089ff
25544#line 235
255450x000089e0-0x000089ef
25546#line 235
25547# Wireless extension ioctls
25548#line 235
255490x00008b00 0x00008b02 0x00008b04 0x00008b06 0x00008b08 0x00008b0a
25550#line 235
255510x00008b0c 0x00008b0e 0x00008b10 0x00008b14 0x00008b15 0x00008b16 0x00008b17
25552#line 235
255530x00008b18 0x00008b19 0x00008b1a 0x00008b1b 0x00008b1c 0x00008b1d
25554#line 235
255550x00008b20 0x00008b22 0x00008b24 0x00008b26 0x00008b28 0x00008b2a
25556#line 235
255570x00008b2b 0x00008b2c 0x00008b30 0x00008b31 0x00008b32 0x00008b33
25558#line 235
255590x00008b34 0x00008b35 0x00008b36
25560#line 235
25561# Dev private ioctl i.e. hardware specific ioctls
25562#line 235
255630x00008be0-0x00008bff
25564#line 235
25565};
25566
25567# limit shell access to sensitive char drivers to
25568# only getattr required for host side test.
25569neverallow shell {
25570  fuse_device
25571  hw_random_device
25572  port_device
25573}:chr_file ~getattr;
25574
25575# Limit shell to only getattr on blk devices for host side tests.
25576neverallow shell dev_type:blk_file ~getattr;
25577
25578# b/30861057: Shell access to existing input devices is an abuse
25579# vector. The shell user can inject events that look like they
25580# originate from the touchscreen etc.
25581# Everyone should have already moved to UiAutomation#injectInputEvent
25582# if they are running instrumentation tests (i.e. CTS), Monkey for
25583# their stress tests, and the input command (adb shell input ...) for
25584# injecting swipes and things.
25585neverallow shell input_device:chr_file { append create link unlink relabelfrom rename setattr write };
25586#line 1 "system/sepolicy/prebuilts/api/29.0/public/simpleperf_app_runner.te"
25587type simpleperf_app_runner, domain, mlstrustedsubject;
25588type simpleperf_app_runner_exec, system_file_type, exec_type, file_type;
25589
25590# run simpleperf_app_runner in adb shell.
25591allow simpleperf_app_runner adbd:fd use;
25592allow simpleperf_app_runner shell:fd use;
25593allow simpleperf_app_runner devpts:chr_file { read write ioctl };
25594
25595# simpleperf_app_runner reads package information.
25596allow simpleperf_app_runner system_data_file:file { getattr open read ioctl lock map };
25597allow simpleperf_app_runner system_data_file:lnk_file getattr;
25598allow simpleperf_app_runner packages_list_file:file { getattr open read ioctl lock map };
25599
25600# The app's data dir may be accessed through a symlink.
25601allow simpleperf_app_runner system_data_file:lnk_file read;
25602
25603# simpleperf_app_runner switches to the app UID/GID.
25604allow simpleperf_app_runner self:{ capability cap_userns } { setuid setgid };
25605
25606# simpleperf_app_runner switches to the app security context.
25607
25608#line 21
25609
25610#line 21
25611allow simpleperf_app_runner selinuxfs:dir { open getattr read search ioctl lock };
25612#line 21
25613allow simpleperf_app_runner selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
25614#line 21
25615
25616#line 21
25617allow simpleperf_app_runner selinuxfs:file { open append write lock map };
25618#line 21
25619allow simpleperf_app_runner kernel:security check_context;
25620#line 21
25621 # validate context
25622allow simpleperf_app_runner self:process setcurrent;
25623allow simpleperf_app_runner untrusted_app_all:process dyntransition; # setcon
25624
25625# simpleperf_app_runner/libselinux needs access to seapp_contexts_file to
25626# determine which domain to transition to.
25627allow simpleperf_app_runner seapp_contexts_file:file { getattr open read ioctl lock map };
25628
25629# simpleperf_app_runner passes pipe fds.
25630allow simpleperf_app_runner shell:fifo_file read;
25631
25632# simpleperf_app_runner checks shell data paths.
25633# simpleperf_app_runner passes shell data fds.
25634allow simpleperf_app_runner shell_data_file:dir { getattr search };
25635allow simpleperf_app_runner shell_data_file:file { getattr write };
25636
25637###
25638### neverallow rules
25639###
25640
25641# simpleperf_app_runner cannot have capabilities other than CAP_SETUID and CAP_SETGID
25642neverallow simpleperf_app_runner self:{ capability cap_userns } ~{ setuid setgid };
25643neverallow simpleperf_app_runner self:{ capability2 cap2_userns } *;
25644#line 1 "system/sepolicy/prebuilts/api/29.0/public/slideshow.te"
25645# slideshow seclabel is specified in init.rc since
25646# it lives in the rootfs and has no unique file type.
25647type slideshow, domain;
25648
25649allow slideshow kmsg_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
25650
25651#line 6
25652# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
25653#line 6
25654# deprecated.
25655#line 6
25656# Access /sys/power/wake_lock and /sys/power/wake_unlock
25657#line 6
25658allow slideshow sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
25659#line 6
25660# Accessing these files requires CAP_BLOCK_SUSPEND
25661#line 6
25662allow slideshow self:{ capability2 cap2_userns } block_suspend;
25663#line 6
25664# system_suspend permissions
25665#line 6
25666
25667#line 6
25668# Call the server domain and optionally transfer references to it.
25669#line 6
25670allow slideshow system_suspend_server:binder { call transfer };
25671#line 6
25672# Allow the serverdomain to transfer references to the client on the reply.
25673#line 6
25674allow system_suspend_server slideshow:binder transfer;
25675#line 6
25676# Receive and use open files from the server.
25677#line 6
25678allow slideshow system_suspend_server:fd use;
25679#line 6
25680
25681#line 6
25682allow slideshow system_suspend_hwservice:hwservice_manager find;
25683#line 6
25684# halclientdomain permissions
25685#line 6
25686
25687#line 6
25688# Call the hwservicemanager and transfer references to it.
25689#line 6
25690allow slideshow hwservicemanager:binder { call transfer };
25691#line 6
25692# Allow hwservicemanager to send out callbacks
25693#line 6
25694allow hwservicemanager slideshow:binder { call transfer };
25695#line 6
25696# hwservicemanager performs getpidcon on clients.
25697#line 6
25698allow hwservicemanager slideshow:dir search;
25699#line 6
25700allow hwservicemanager slideshow:file { read open map };
25701#line 6
25702allow hwservicemanager slideshow:process getattr;
25703#line 6
25704# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
25705#line 6
25706# all domains in domain.te.
25707#line 6
25708
25709#line 6
25710
25711#line 6
25712allow slideshow hwservicemanager_prop:file { getattr open read map };
25713#line 6
25714
25715#line 6
25716allow slideshow hidl_manager_hwservice:hwservice_manager find;
25717#line 6
25718
25719allow slideshow device:dir { open getattr read search ioctl lock };
25720allow slideshow self:{ capability cap_userns } sys_tty_config;
25721allow slideshow graphics_device:dir { open getattr read search ioctl lock };
25722allow slideshow graphics_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
25723allow slideshow input_device:dir { open getattr read search ioctl lock };
25724allow slideshow input_device:chr_file { getattr open read ioctl lock map };
25725allow slideshow tty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
25726
25727#line 1 "system/sepolicy/prebuilts/api/29.0/public/stats_service_server.te"
25728
25729#line 1
25730  allow stats_service_server fwk_stats_hwservice:hwservice_manager { add find };
25731#line 1
25732  allow stats_service_server hidl_base_hwservice:hwservice_manager add;
25733#line 1
25734  neverallow { domain -stats_service_server } fwk_stats_hwservice:hwservice_manager add;
25735#line 1
25736
25737#line 1 "system/sepolicy/prebuilts/api/29.0/public/statsd.te"
25738type statsd, domain, mlstrustedsubject;
25739
25740type statsd_exec, system_file_type, exec_type, file_type;
25741
25742#line 4
25743# Call the servicemanager and transfer references to it.
25744#line 4
25745allow statsd servicemanager:binder { call transfer };
25746#line 4
25747# servicemanager performs getpidcon on clients.
25748#line 4
25749allow servicemanager statsd:dir search;
25750#line 4
25751allow servicemanager statsd:file { read open };
25752#line 4
25753allow servicemanager statsd:process getattr;
25754#line 4
25755# rw access to /dev/binder and /dev/ashmem is presently granted to
25756#line 4
25757# all domains in domain.te.
25758#line 4
25759
25760
25761# Allow statsd to scan through /proc/pid for all processes.
25762
25763#line 7
25764allow statsd domain:dir { open getattr read search ioctl lock };
25765#line 7
25766allow statsd domain:{ file lnk_file } { getattr open read ioctl lock map };
25767#line 7
25768
25769
25770# Allow executing files on system, such as running a shell or running:
25771#   /system/bin/toolbox
25772#   /system/bin/logcat
25773#   /system/bin/dumpsys
25774allow statsd devpts:chr_file { getattr ioctl read write };
25775allow statsd shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25776allow statsd system_file:file execute_no_trans;
25777allow statsd toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25778
25779#line 20
25780
25781
25782# Create, read, and write into /data/misc/stats-data, /data/misc/stats-system.
25783allow statsd stats_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
25784allow statsd stats_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
25785
25786# Allow statsd to make binder calls to any binder service.
25787
25788#line 27
25789# Call the server domain and optionally transfer references to it.
25790#line 27
25791allow statsd appdomain:binder { call transfer };
25792#line 27
25793# Allow the serverdomain to transfer references to the client on the reply.
25794#line 27
25795allow appdomain statsd:binder transfer;
25796#line 27
25797# Receive and use open files from the server.
25798#line 27
25799allow statsd appdomain:fd use;
25800#line 27
25801
25802
25803#line 28
25804# Call the server domain and optionally transfer references to it.
25805#line 28
25806allow statsd healthd:binder { call transfer };
25807#line 28
25808# Allow the serverdomain to transfer references to the client on the reply.
25809#line 28
25810allow healthd statsd:binder transfer;
25811#line 28
25812# Receive and use open files from the server.
25813#line 28
25814allow statsd healthd:fd use;
25815#line 28
25816
25817
25818#line 29
25819# Call the server domain and optionally transfer references to it.
25820#line 29
25821allow statsd incidentd:binder { call transfer };
25822#line 29
25823# Allow the serverdomain to transfer references to the client on the reply.
25824#line 29
25825allow incidentd statsd:binder transfer;
25826#line 29
25827# Receive and use open files from the server.
25828#line 29
25829allow statsd incidentd:fd use;
25830#line 29
25831
25832#line 32
25833
25834
25835#line 33
25836# Call the server domain and optionally transfer references to it.
25837#line 33
25838allow statsd system_server:binder { call transfer };
25839#line 33
25840# Allow the serverdomain to transfer references to the client on the reply.
25841#line 33
25842allow system_server statsd:binder transfer;
25843#line 33
25844# Receive and use open files from the server.
25845#line 33
25846allow statsd system_server:fd use;
25847#line 33
25848
25849
25850# Allow statsd to interact with gpuservice
25851allow statsd gpu_service:service_manager find;
25852
25853#line 37
25854# Call the server domain and optionally transfer references to it.
25855#line 37
25856allow statsd gpuservice:binder { call transfer };
25857#line 37
25858# Allow the serverdomain to transfer references to the client on the reply.
25859#line 37
25860allow gpuservice statsd:binder transfer;
25861#line 37
25862# Receive and use open files from the server.
25863#line 37
25864allow statsd gpuservice:fd use;
25865#line 37
25866
25867
25868# Allow logd access.
25869
25870#line 40
25871allow statsd logcat_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
25872#line 40
25873
25874#line 40
25875allow statsd logdr_socket:sock_file write;
25876#line 40
25877allow statsd logd:unix_stream_socket connectto;
25878#line 40
25879
25880#line 40
25881
25882
25883#line 41
25884# Group AID_LOG checked by filesystem & logd
25885#line 41
25886# to permit control commands
25887#line 41
25888
25889#line 41
25890allow statsd logd_socket:sock_file write;
25891#line 41
25892allow statsd logd:unix_stream_socket connectto;
25893#line 41
25894
25895#line 41
25896
25897
25898# Grant statsd with permissions to register the services.
25899allow statsd {
25900  app_api_service
25901  incident_service
25902
25903#line 50
25904  system_api_service
25905}:service_manager find;
25906
25907# Grant statsd to access health hal to access battery metrics.
25908allow statsd hal_health_hwservice:hwservice_manager find;
25909
25910# Allow statsd to send dump info to dumpstate
25911allow statsd dumpstate:fd use;
25912allow statsd dumpstate:fifo_file { getattr write };
25913
25914# Allow access to with hardware layer and process stats.
25915allow statsd proc_uid_cputime_showstat:file { getattr open read };
25916
25917#line 62
25918typeattribute statsd halclientdomain;
25919#line 62
25920typeattribute statsd hal_health_client;
25921#line 62
25922
25923#line 62
25924# TODO(b/34170079): Make the inclusion of the rules below conditional also on
25925#line 62
25926# non-Treble devices. For now, on non-Treble device, always grant clients of a
25927#line 62
25928# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
25929#line 62
25930
25931#line 62
25932
25933
25934#line 63
25935typeattribute statsd halclientdomain;
25936#line 63
25937typeattribute statsd hal_power_client;
25938#line 63
25939
25940#line 63
25941# TODO(b/34170079): Make the inclusion of the rules below conditional also on
25942#line 63
25943# non-Treble devices. For now, on non-Treble device, always grant clients of a
25944#line 63
25945# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
25946#line 63
25947
25948#line 63
25949
25950
25951#line 64
25952typeattribute statsd halclientdomain;
25953#line 64
25954typeattribute statsd hal_power_stats_client;
25955#line 64
25956
25957#line 64
25958# TODO(b/34170079): Make the inclusion of the rules below conditional also on
25959#line 64
25960# non-Treble devices. For now, on non-Treble device, always grant clients of a
25961#line 64
25962# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
25963#line 64
25964
25965#line 64
25966
25967
25968#line 65
25969typeattribute statsd halclientdomain;
25970#line 65
25971typeattribute statsd hal_thermal_client;
25972#line 65
25973
25974#line 65
25975# TODO(b/34170079): Make the inclusion of the rules below conditional also on
25976#line 65
25977# non-Treble devices. For now, on non-Treble device, always grant clients of a
25978#line 65
25979# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
25980#line 65
25981
25982#line 65
25983
25984
25985# Allow 'adb shell cmd' to upload configs and download output.
25986allow statsd adbd:fd use;
25987allow statsd adbd:unix_stream_socket { getattr read write };
25988allow statsd shell:fifo_file { getattr read write };
25989
25990
25991#line 72
25992allow statsd statsdw_socket:sock_file write;
25993#line 72
25994allow statsd statsd:unix_dgram_socket sendto;
25995#line 72
25996
25997
25998###
25999### neverallow rules
26000###
26001
26002# Only statsd and the other root services in limited circumstances.
26003# can get to the files in /data/misc/stats-data, /data/misc/stats-service.
26004# Other services are prohibitted from accessing the file.
26005neverallow { domain -statsd -system_server -init -vold } stats_data_file:file *;
26006
26007# Limited access to the directory itself.
26008neverallow { domain -statsd -system_server -init -vold } stats_data_file:dir *;
26009#line 1 "system/sepolicy/prebuilts/api/29.0/public/su.te"
26010# All types must be defined regardless of build variant to ensure
26011# policy compilation succeeds with userdebug/user combination at boot
26012type su, domain;
26013
26014# File types must be defined for file_contexts.
26015type su_exec, system_file_type, exec_type, file_type;
26016
26017#line 104
26018
26019#line 1 "system/sepolicy/prebuilts/api/29.0/public/surfaceflinger.te"
26020# surfaceflinger - display compositor service
26021type surfaceflinger, domain;
26022type surfaceflinger_tmpfs, file_type;
26023#line 1 "system/sepolicy/prebuilts/api/29.0/public/system_app.te"
26024###
26025### Apps that run with the system UID, e.g. com.android.system.ui,
26026### com.android.settings.  These are not as privileged as the system
26027### server.
26028###
26029
26030type system_app, domain;
26031#line 1 "system/sepolicy/prebuilts/api/29.0/public/system_server.te"
26032#
26033# System Server aka system_server spawned by zygote.
26034# Most of the framework services run in this process.
26035#
26036type system_server, domain;
26037type system_server_tmpfs, file_type, mlstrustedobject;
26038#line 1 "system/sepolicy/prebuilts/api/29.0/public/system_suspend_server.te"
26039# Required to export a HIDL interface.
26040
26041#line 2
26042# Call the hwservicemanager and transfer references to it.
26043#line 2
26044allow system_suspend_server hwservicemanager:binder { call transfer };
26045#line 2
26046# Allow hwservicemanager to send out callbacks
26047#line 2
26048allow hwservicemanager system_suspend_server:binder { call transfer };
26049#line 2
26050# hwservicemanager performs getpidcon on clients.
26051#line 2
26052allow hwservicemanager system_suspend_server:dir search;
26053#line 2
26054allow hwservicemanager system_suspend_server:file { read open map };
26055#line 2
26056allow hwservicemanager system_suspend_server:process getattr;
26057#line 2
26058# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
26059#line 2
26060# all domains in domain.te.
26061#line 2
26062
26063
26064#line 3
26065allow system_suspend_server hwservicemanager_prop:file { getattr open read map };
26066#line 3
26067
26068
26069# To serve ISystemSuspend.hal.
26070
26071#line 6
26072  allow system_suspend_server system_suspend_hwservice:hwservice_manager { add find };
26073#line 6
26074  allow system_suspend_server hidl_base_hwservice:hwservice_manager add;
26075#line 6
26076  neverallow { domain -system_suspend_server } system_suspend_hwservice:hwservice_manager add;
26077#line 6
26078
26079#line 1 "system/sepolicy/prebuilts/api/29.0/public/tee.te"
26080##
26081# trusted execution environment (tee) daemon
26082#
26083type tee, domain;
26084
26085# Device(s) for communicating with the TEE
26086type tee_device, dev_type;
26087
26088allow tee fingerprint_vendor_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
26089allow tee fingerprint_vendor_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
26090
26091#line 1 "system/sepolicy/prebuilts/api/29.0/public/tombstoned.te"
26092# debugger interface
26093type tombstoned, domain, mlstrustedsubject;
26094type tombstoned_exec, system_file_type, exec_type, file_type;
26095
26096# Write to arbitrary pipes given to us.
26097allow tombstoned domain:fd use;
26098allow tombstoned domain:fifo_file write;
26099
26100allow tombstoned domain:dir { open getattr read search ioctl lock };
26101allow tombstoned domain:file { getattr open read ioctl lock map };
26102allow tombstoned tombstone_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
26103allow tombstoned tombstone_data_file:file { { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } } link };
26104
26105# Changes for the new stack dumping mechanism. Each trace goes into a
26106# separate file, and these files are managed by tombstoned.
26107allow tombstoned anr_data_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
26108allow tombstoned anr_data_file:file { append create getattr open link unlink };
26109#line 1 "system/sepolicy/prebuilts/api/29.0/public/toolbox.te"
26110# Any toolbox command run by init.
26111# At present, the only known usage is for running mkswap via fs_mgr.
26112# Do NOT use this domain for toolbox when run by any other domain.
26113type toolbox, domain;
26114type toolbox_exec, system_file_type, exec_type, file_type;
26115
26116# /dev/__null__ created by init prior to policy load,
26117# open fd inherited by fsck.
26118allow toolbox tmpfs:chr_file { read write ioctl };
26119
26120# Inherit and use pty created by android_fork_execvp_ext().
26121allow toolbox devpts:chr_file { read write getattr ioctl };
26122
26123# mkswap-specific.
26124# Read/write block devices used for swap partitions.
26125# Assign swap_block_device type any such partition in your
26126# device/<vendor>/<product>/sepolicy/file_contexts file.
26127allow toolbox block_device:dir search;
26128allow toolbox swap_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
26129
26130# Only allow entry from init via the toolbox binary.
26131neverallow { domain -init } toolbox:process transition;
26132neverallow * toolbox:process dyntransition;
26133neverallow toolbox { file_type fs_type -toolbox_exec}:file entrypoint;
26134#line 1 "system/sepolicy/prebuilts/api/29.0/public/traced.te"
26135type traced, domain, coredomain, mlstrustedsubject;
26136
26137#line 1 "system/sepolicy/prebuilts/api/29.0/public/traced_probes.te"
26138type traced_probes, domain, coredomain, mlstrustedsubject;
26139#line 1 "system/sepolicy/prebuilts/api/29.0/public/traceur_app.te"
26140type traceur_app, domain;
26141
26142allow traceur_app servicemanager:service_manager list;
26143allow traceur_app hwservicemanager:hwservice_manager list;
26144
26145# Allow Traceur to enable traced if necessary.
26146
26147#line 7
26148
26149#line 7
26150allow traceur_app property_socket:sock_file write;
26151#line 7
26152allow traceur_app init:unix_stream_socket connectto;
26153#line 7
26154
26155#line 7
26156allow traceur_app traced_enabled_prop:property_service set;
26157#line 7
26158
26159#line 7
26160allow traceur_app traced_enabled_prop:file { getattr open read map };
26161#line 7
26162
26163#line 7
26164
26165
26166
26167#line 9
26168
26169#line 9
26170allow traceur_app property_socket:sock_file write;
26171#line 9
26172allow traceur_app init:unix_stream_socket connectto;
26173#line 9
26174
26175#line 9
26176allow traceur_app debug_prop:property_service set;
26177#line 9
26178
26179#line 9
26180allow traceur_app debug_prop:file { getattr open read map };
26181#line 9
26182
26183#line 9
26184
26185
26186allow traceur_app {
26187  service_manager_type
26188  -apex_service
26189  -dnsresolver_service
26190  -gatekeeper_service
26191  -incident_service
26192  -installd_service
26193  -iorapd_service
26194  -lpdump_service
26195  -netd_service
26196  -virtual_touchpad_service
26197  -vold_service
26198  -vr_hwc_service
26199}:service_manager find;
26200
26201# Allow traceur_app to use atrace HAL
26202
26203#line 27
26204typeattribute traceur_app halclientdomain;
26205#line 27
26206typeattribute traceur_app hal_atrace_client;
26207#line 27
26208
26209#line 27
26210# TODO(b/34170079): Make the inclusion of the rules below conditional also on
26211#line 27
26212# non-Treble devices. For now, on non-Treble device, always grant clients of a
26213#line 27
26214# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
26215#line 27
26216
26217#line 27
26218
26219
26220dontaudit traceur_app service_manager_type:service_manager find;
26221dontaudit traceur_app hwservice_manager_type:hwservice_manager find;
26222dontaudit traceur_app domain:binder call;
26223#line 1 "system/sepolicy/prebuilts/api/29.0/public/tzdatacheck.te"
26224# The tzdatacheck command run by init.
26225type tzdatacheck, domain;
26226type tzdatacheck_exec, system_file_type, exec_type, file_type;
26227
26228allow tzdatacheck zoneinfo_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
26229allow tzdatacheck zoneinfo_data_file:file unlink;
26230
26231# Below are strong assertion that only init, system_server and tzdatacheck
26232# can modify the /data time zone rules directories. This is to make it very
26233# clear that only these domains should modify the actual time zone rules data.
26234# The tzdatacheck binary itself may be executed by shell for tests but it must
26235# not be able to modify the real rules.
26236# If other users / binaries could modify time zone rules on device this might
26237# have negative implications for users (who may get incorrect local times)
26238# or break assumptions made / invalidate data held by the components actually
26239# responsible for updating time zone rules.
26240neverallow { domain -system_server -init -tzdatacheck } zoneinfo_data_file:file { append create link unlink relabelfrom rename setattr write };
26241neverallow { domain -system_server -init -tzdatacheck } zoneinfo_data_file:dir { add_name create link relabelfrom remove_name rename reparent rmdir setattr write };
26242#line 1 "system/sepolicy/prebuilts/api/29.0/public/ueventd.te"
26243# ueventd seclabel is specified in init.rc since
26244# it lives in the rootfs and has no unique file type.
26245type ueventd, domain;
26246type ueventd_tmpfs, file_type;
26247
26248# Write to /dev/kmsg.
26249allow ueventd kmsg_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
26250
26251allow ueventd self:{ capability cap_userns } { chown mknod net_admin setgid fsetid sys_rawio dac_override dac_read_search fowner };
26252allow ueventd device:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
26253
26254
26255#line 12
26256allow ueventd rootfs:dir { open getattr read search ioctl lock };
26257#line 12
26258allow ueventd rootfs:{ file lnk_file } { getattr open read ioctl lock map };
26259#line 12
26260
26261
26262# ueventd needs write access to files in /sys to regenerate uevents
26263allow ueventd sysfs_type:file { open append write lock map };
26264
26265#line 16
26266allow ueventd sysfs_type:dir { open getattr read search ioctl lock };
26267#line 16
26268allow ueventd sysfs_type:{ file lnk_file } { getattr open read ioctl lock map };
26269#line 16
26270
26271allow ueventd sysfs_type:{ file lnk_file } { relabelfrom relabelto setattr };
26272allow ueventd sysfs_type:dir { relabelfrom relabelto setattr };
26273allow ueventd tmpfs:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
26274allow ueventd dev_type:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
26275allow ueventd dev_type:lnk_file { create unlink };
26276allow ueventd dev_type:chr_file { getattr create setattr unlink };
26277allow ueventd dev_type:blk_file { getattr relabelfrom relabelto create setattr unlink };
26278allow ueventd self:netlink_kobject_uevent_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
26279allow ueventd efs_file:dir search;
26280allow ueventd efs_file:file { getattr open read ioctl lock map };
26281
26282# Get SELinux enforcing status.
26283
26284#line 29
26285allow ueventd selinuxfs:dir { open getattr read search ioctl lock };
26286#line 29
26287allow ueventd selinuxfs:{ file lnk_file } { getattr open read ioctl lock map };
26288#line 29
26289
26290
26291# Access for /vendor/ueventd.rc and /vendor/firmware
26292
26293#line 32
26294allow ueventd { vendor_file_type -vendor_app_file -vendor_overlay_file }:dir { open getattr read search ioctl lock };
26295#line 32
26296allow ueventd { vendor_file_type -vendor_app_file -vendor_overlay_file }:{ file lnk_file } { getattr open read ioctl lock map };
26297#line 32
26298
26299
26300# Get file contexts for new device nodes
26301allow ueventd file_contexts_file:file { getattr open read ioctl lock map };
26302
26303# Use setfscreatecon() to label /dev directories and files.
26304allow ueventd self:process setfscreate;
26305
26306# Allow ueventd to read androidboot.android_dt_dir from kernel cmdline.
26307allow ueventd proc_cmdline:file { getattr open read ioctl lock map };
26308
26309# Everything is labeled as rootfs in recovery mode. ueventd has to execute
26310# the dynamic linker and shared libraries.
26311#line 47
26312
26313
26314# Suppress denials for ueventd to getattr /postinstall. This occurs when the
26315# linker tries to resolve paths in ld.config.txt.
26316dontaudit ueventd postinstall_mnt_dir:dir getattr;
26317
26318# ueventd loads modules in response to modalias events.
26319allow ueventd self:{ capability cap_userns } sys_module;
26320allow ueventd vendor_file:system module_load;
26321allow ueventd kernel:key search;
26322
26323# ueventd is using bootstrap bionic
26324allow ueventd system_bootstrap_lib_file:dir { open getattr read search ioctl lock };
26325allow ueventd system_bootstrap_lib_file:file { execute read open getattr map };
26326
26327#####
26328##### neverallow rules
26329#####
26330
26331# ueventd must never set properties, otherwise deadlocks may occur.
26332# https://android-review.googlesource.com/#/c/133120/6/init/devices.cpp@941
26333# No writing to the property socket, connecting to init, or setting properties.
26334neverallow ueventd property_socket:sock_file write;
26335neverallow ueventd init:unix_stream_socket connectto;
26336neverallow ueventd property_type:property_service set;
26337
26338# Restrict ueventd access on block devices to maintenence operations.
26339neverallow ueventd dev_type:blk_file ~{ getattr relabelfrom relabelto create setattr unlink };
26340
26341# Only relabelto as we would never want to relabelfrom port_device
26342neverallow ueventd port_device:chr_file ~{ getattr create setattr unlink relabelto };
26343
26344# Nobody should be able to ptrace ueventd
26345neverallow * ueventd:process ptrace;
26346#line 1 "system/sepolicy/prebuilts/api/29.0/public/uncrypt.te"
26347# uncrypt
26348type uncrypt, domain, mlstrustedsubject;
26349type uncrypt_exec, system_file_type, exec_type, file_type;
26350
26351allow uncrypt self:{ capability cap_userns } { dac_override dac_read_search };
26352
26353#line 10
26354
26355
26356# Read /cache/recovery/command
26357# Read /cache/recovery/uncrypt_file
26358allow uncrypt cache_file:dir search;
26359allow uncrypt cache_recovery_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
26360allow uncrypt cache_recovery_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
26361
26362# Read OTA zip file at /data/ota_package/.
26363allow uncrypt ota_package_file:dir { open getattr read search ioctl lock };
26364allow uncrypt ota_package_file:file { getattr open read ioctl lock map };
26365
26366# Write to /dev/socket/uncrypt
26367
26368#line 23
26369allow uncrypt uncrypt_socket:sock_file write;
26370#line 23
26371allow uncrypt uncrypt:unix_stream_socket connectto;
26372#line 23
26373
26374
26375# Set a property to reboot the device.
26376
26377#line 26
26378
26379#line 26
26380allow uncrypt property_socket:sock_file write;
26381#line 26
26382allow uncrypt init:unix_stream_socket connectto;
26383#line 26
26384
26385#line 26
26386allow uncrypt powerctl_prop:property_service set;
26387#line 26
26388
26389#line 26
26390allow uncrypt powerctl_prop:file { getattr open read map };
26391#line 26
26392
26393#line 26
26394
26395
26396# Raw writes to block device
26397allow uncrypt self:{ capability cap_userns } sys_rawio;
26398allow uncrypt misc_block_device:blk_file { open append write lock map };
26399allow uncrypt block_device:dir { open getattr read search ioctl lock };
26400
26401# Access userdata block device.
26402allow uncrypt userdata_block_device:blk_file { open append write lock map };
26403
26404
26405#line 36
26406allow uncrypt rootfs:dir { open getattr read search ioctl lock };
26407#line 36
26408allow uncrypt rootfs:{ file lnk_file } { getattr open read ioctl lock map };
26409#line 36
26410
26411
26412# uncrypt reads /proc/cmdline
26413allow uncrypt proc_cmdline:file { getattr open read ioctl lock map };
26414
26415# Read files in /sys
26416
26417#line 42
26418allow uncrypt sysfs_dt_firmware_android:dir { open getattr read search ioctl lock };
26419#line 42
26420allow uncrypt sysfs_dt_firmware_android:{ file lnk_file } { getattr open read ioctl lock map };
26421#line 42
26422
26423#line 1 "system/sepolicy/prebuilts/api/29.0/public/untrusted_app.te"
26424###
26425### Untrusted apps.
26426###
26427### Apps are labeled based on mac_permissions.xml (maps signer and
26428### optionally package name to seinfo value) and seapp_contexts (maps UID
26429### and optionally seinfo value to domain for process and type for data
26430### directory).  The untrusted_app domain is the default assignment in
26431### seapp_contexts for any app with UID between APP_AID (10000)
26432### and AID_ISOLATED_START (99000) if the app has no specific seinfo
26433### value as determined from mac_permissions.xml.  In current AOSP, this
26434### domain is assigned to all non-system apps as well as to any system apps
26435### that are not signed by the platform key.  To move
26436### a system app into a specific domain, add a signer entry for it to
26437### mac_permissions.xml and assign it one of the pre-existing seinfo values
26438### or define and use a new seinfo value in both mac_permissions.xml and
26439### seapp_contexts.
26440###
26441
26442type untrusted_app, domain;
26443type untrusted_app_27, domain;
26444type untrusted_app_25, domain;
26445#line 1 "system/sepolicy/prebuilts/api/29.0/public/update_engine.te"
26446# Domain for update_engine daemon.
26447type update_engine, domain, update_engine_common;
26448type update_engine_exec, system_file_type, exec_type, file_type;
26449
26450
26451#line 5
26452typeattribute update_engine netdomain;
26453#line 5
26454;
26455
26456# Following permissions are needed for update_engine.
26457allow update_engine self:process { setsched };
26458allow update_engine self:{ capability cap_userns } { fowner sys_admin };
26459# Note: fsetid checks are triggered when creating a file in a directory with
26460# the setgid bit set to determine if the file should inherit setgid. In this
26461# case, setgid on the file is undesirable so we should just suppress the
26462# denial.
26463dontaudit update_engine self:{ capability cap_userns } fsetid;
26464
26465allow update_engine kmsg_device:chr_file { getattr { open append write lock map } };
26466allow update_engine update_engine_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
26467
26468#line 18
26469# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
26470#line 18
26471# deprecated.
26472#line 18
26473# Access /sys/power/wake_lock and /sys/power/wake_unlock
26474#line 18
26475allow update_engine sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
26476#line 18
26477# Accessing these files requires CAP_BLOCK_SUSPEND
26478#line 18
26479allow update_engine self:{ capability2 cap2_userns } block_suspend;
26480#line 18
26481# system_suspend permissions
26482#line 18
26483
26484#line 18
26485# Call the server domain and optionally transfer references to it.
26486#line 18
26487allow update_engine system_suspend_server:binder { call transfer };
26488#line 18
26489# Allow the serverdomain to transfer references to the client on the reply.
26490#line 18
26491allow system_suspend_server update_engine:binder transfer;
26492#line 18
26493# Receive and use open files from the server.
26494#line 18
26495allow update_engine system_suspend_server:fd use;
26496#line 18
26497
26498#line 18
26499allow update_engine system_suspend_hwservice:hwservice_manager find;
26500#line 18
26501# halclientdomain permissions
26502#line 18
26503
26504#line 18
26505# Call the hwservicemanager and transfer references to it.
26506#line 18
26507allow update_engine hwservicemanager:binder { call transfer };
26508#line 18
26509# Allow hwservicemanager to send out callbacks
26510#line 18
26511allow hwservicemanager update_engine:binder { call transfer };
26512#line 18
26513# hwservicemanager performs getpidcon on clients.
26514#line 18
26515allow hwservicemanager update_engine:dir search;
26516#line 18
26517allow hwservicemanager update_engine:file { read open map };
26518#line 18
26519allow hwservicemanager update_engine:process getattr;
26520#line 18
26521# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
26522#line 18
26523# all domains in domain.te.
26524#line 18
26525
26526#line 18
26527
26528#line 18
26529allow update_engine hwservicemanager_prop:file { getattr open read map };
26530#line 18
26531
26532#line 18
26533allow update_engine hidl_manager_hwservice:hwservice_manager find;
26534#line 18
26535;
26536
26537# Ignore these denials.
26538dontaudit update_engine kernel:process setsched;
26539dontaudit update_engine self:{ capability cap_userns } sys_rawio;
26540
26541# Allow using persistent storage in /data/misc/update_engine.
26542allow update_engine update_engine_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
26543allow update_engine update_engine_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
26544
26545# Allow using persistent storage in /data/misc/update_engine_log.
26546allow update_engine update_engine_log_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
26547allow update_engine update_engine_log_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
26548
26549# Don't allow kernel module loading, just silence the logs.
26550dontaudit update_engine kernel:system module_request;
26551
26552# Register the service to perform Binder IPC.
26553
26554#line 36
26555# Call the servicemanager and transfer references to it.
26556#line 36
26557allow update_engine servicemanager:binder { call transfer };
26558#line 36
26559# servicemanager performs getpidcon on clients.
26560#line 36
26561allow servicemanager update_engine:dir search;
26562#line 36
26563allow servicemanager update_engine:file { read open };
26564#line 36
26565allow servicemanager update_engine:process getattr;
26566#line 36
26567# rw access to /dev/binder and /dev/ashmem is presently granted to
26568#line 36
26569# all domains in domain.te.
26570#line 36
26571
26572
26573#line 37
26574  allow update_engine update_engine_service:service_manager { add find };
26575#line 37
26576  neverallow { domain -update_engine } update_engine_service:service_manager add;
26577#line 37
26578
26579
26580# Allow update_engine to call the callback function provided by priv_app.
26581
26582#line 40
26583# Call the server domain and optionally transfer references to it.
26584#line 40
26585allow update_engine priv_app:binder { call transfer };
26586#line 40
26587# Allow the serverdomain to transfer references to the client on the reply.
26588#line 40
26589allow priv_app update_engine:binder transfer;
26590#line 40
26591# Receive and use open files from the server.
26592#line 40
26593allow update_engine priv_app:fd use;
26594#line 40
26595
26596
26597# Allow update_engine to call the callback function provided by system_server.
26598
26599#line 43
26600# Call the server domain and optionally transfer references to it.
26601#line 43
26602allow update_engine system_server:binder { call transfer };
26603#line 43
26604# Allow the serverdomain to transfer references to the client on the reply.
26605#line 43
26606allow system_server update_engine:binder transfer;
26607#line 43
26608# Receive and use open files from the server.
26609#line 43
26610allow update_engine system_server:fd use;
26611#line 43
26612
26613
26614# Read OTA zip file at /data/ota_package/.
26615allow update_engine ota_package_file:file { getattr open read ioctl lock map };
26616allow update_engine ota_package_file:dir { open getattr read search ioctl lock };
26617
26618# Use Boot Control HAL
26619
26620#line 50
26621typeattribute update_engine halclientdomain;
26622#line 50
26623typeattribute update_engine hal_bootctl_client;
26624#line 50
26625
26626#line 50
26627# TODO(b/34170079): Make the inclusion of the rules below conditional also on
26628#line 50
26629# non-Treble devices. For now, on non-Treble device, always grant clients of a
26630#line 50
26631# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
26632#line 50
26633
26634#line 50
26635
26636
26637# access /proc/misc
26638allow update_engine proc_misc:file { getattr open read ioctl lock map };
26639
26640# read directories on /system and /vendor
26641allow update_engine system_file:dir { open getattr read search ioctl lock };
26642#line 1 "system/sepolicy/prebuilts/api/29.0/public/update_engine_common.te"
26643# update_engine payload application permissions. These are shared between the
26644# background daemon and the recovery tool to sideload an update.
26645
26646# Allow update_engine to reach block devices in /dev/block.
26647allow update_engine_common block_device:dir search;
26648
26649# Allow read/write on system and boot partitions.
26650allow update_engine_common boot_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
26651allow update_engine_common system_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
26652
26653# Where ioctls are granted via standard allow rules to block devices,
26654# automatically allow common ioctls that are generally needed by
26655# update_engine.
26656allowxperm update_engine_common dev_type:blk_file ioctl {
26657  0x00001277
26658  0x0000127c
26659  0x0000125e
26660  0x0000125d
26661  0x0000127d
26662  0x0000127f
26663};
26664
26665# Allow to set recovery options in the BCB. Used to trigger factory reset when
26666# the update to an older version (channel change) or incompatible version
26667# requires it.
26668allow update_engine_common misc_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
26669
26670# read fstab
26671allow update_engine_common rootfs:dir getattr;
26672allow update_engine_common rootfs:file { getattr open read ioctl lock map };
26673
26674# Allow update_engine_common to mount on the /postinstall directory and reset the
26675# labels on the mounted filesystem to postinstall_file.
26676allow update_engine_common postinstall_mnt_dir:dir { mounton getattr search };
26677allow update_engine_common postinstall_file:filesystem { mount unmount relabelfrom relabelto };
26678allow update_engine_common labeledfs:filesystem relabelfrom;
26679
26680# Allow update_engine_common to read and execute postinstall_file.
26681allow update_engine_common postinstall_file:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
26682allow update_engine_common postinstall_file:lnk_file { getattr open read ioctl lock map };
26683allow update_engine_common postinstall_file:dir { open getattr read search ioctl lock };
26684
26685# install update.zip from cache
26686
26687#line 44
26688allow update_engine_common cache_file:dir { open getattr read search ioctl lock };
26689#line 44
26690allow update_engine_common cache_file:{ file lnk_file } { getattr open read ioctl lock map };
26691#line 44
26692
26693
26694# A postinstall program is typically a shell script (with a #!), so we allow
26695# to execute those.
26696allow update_engine_common shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
26697
26698# Allow update_engine_common to suspend, resume and kill the postinstall program.
26699allow update_engine_common postinstall:process { signal sigstop sigkill };
26700
26701# access /proc/cmdline
26702allow update_engine_common proc_cmdline:file { getattr open read ioctl lock map };
26703
26704# Read files in /sys/firmware/devicetree/base/firmware/android/
26705
26706#line 57
26707allow update_engine_common sysfs_dt_firmware_android:dir { open getattr read search ioctl lock };
26708#line 57
26709allow update_engine_common sysfs_dt_firmware_android:{ file lnk_file } { getattr open read ioctl lock map };
26710#line 57
26711
26712
26713# read / write on /dev/device-mapper to map / unmap devices
26714allow update_engine_common dm_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
26715
26716# apply / verify updates on devices mapped via device mapper
26717allow update_engine_common dm_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
26718
26719# read / write metadata on super device to resize partitions
26720allow update_engine_common super_block_device_type:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
26721
26722# ioctl on super device to get block device alignment and alignment offset
26723allowxperm update_engine_common super_block_device_type:blk_file ioctl { 0x00001278 0x0000127a };
26724
26725# get physical block device to map logical partitions on device mapper
26726allow update_engine_common block_device:dir { open getattr read search ioctl lock };
26727
26728# Allow update_engine_common to write to statsd socket.
26729
26730#line 75
26731allow update_engine_common statsdw_socket:sock_file write;
26732#line 75
26733allow update_engine_common statsd:unix_dgram_socket sendto;
26734#line 75
26735
26736#line 1 "system/sepolicy/prebuilts/api/29.0/public/update_verifier.te"
26737# update_verifier
26738type update_verifier, domain;
26739type update_verifier_exec, system_file_type, exec_type, file_type;
26740
26741# Allow update_verifier to reach block devices in /dev/block.
26742allow update_verifier block_device:dir search;
26743
26744# Read care map in /data/ota_package/.
26745allow update_verifier ota_package_file:dir { open getattr read search ioctl lock };
26746allow update_verifier ota_package_file:file { getattr open read ioctl lock map };
26747
26748# Read /sys/block to find all the DM directories like (/sys/block/dm-X).
26749allow update_verifier sysfs:dir { open getattr read search ioctl lock };
26750
26751# Read /sys/block/dm-X/dm/name (which is a symlink to
26752# /sys/devices/virtual/block/dm-X/dm/name) to identify the mapping between
26753# dm-X and system/vendor partitions.
26754allow update_verifier sysfs_dm:dir { open getattr read search ioctl lock };
26755allow update_verifier sysfs_dm:file { getattr open read ioctl lock map };
26756
26757# Read all blocks in DM wrapped system partition.
26758allow update_verifier dm_device:blk_file { getattr open read ioctl lock map };
26759
26760# Write to kernel message.
26761allow update_verifier kmsg_device:chr_file { getattr { open append write lock map } };
26762
26763# Allow update_verifier to reboot the device.
26764
26765#line 28
26766
26767#line 28
26768allow update_verifier property_socket:sock_file write;
26769#line 28
26770allow update_verifier init:unix_stream_socket connectto;
26771#line 28
26772
26773#line 28
26774allow update_verifier powerctl_prop:property_service set;
26775#line 28
26776
26777#line 28
26778allow update_verifier powerctl_prop:file { getattr open read map };
26779#line 28
26780
26781#line 28
26782
26783
26784# Use Boot Control HAL
26785
26786#line 31
26787typeattribute update_verifier halclientdomain;
26788#line 31
26789typeattribute update_verifier hal_bootctl_client;
26790#line 31
26791
26792#line 31
26793# TODO(b/34170079): Make the inclusion of the rules below conditional also on
26794#line 31
26795# non-Treble devices. For now, on non-Treble device, always grant clients of a
26796#line 31
26797# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
26798#line 31
26799
26800#line 31
26801
26802
26803# Access Checkpoint commands over binder
26804allow update_verifier vold_service:service_manager find;
26805
26806#line 35
26807# Call the server domain and optionally transfer references to it.
26808#line 35
26809allow update_verifier servicemanager:binder { call transfer };
26810#line 35
26811# Allow the serverdomain to transfer references to the client on the reply.
26812#line 35
26813allow servicemanager update_verifier:binder transfer;
26814#line 35
26815# Receive and use open files from the server.
26816#line 35
26817allow update_verifier servicemanager:fd use;
26818#line 35
26819
26820
26821#line 36
26822# Call the server domain and optionally transfer references to it.
26823#line 36
26824allow update_verifier vold:binder { call transfer };
26825#line 36
26826# Allow the serverdomain to transfer references to the client on the reply.
26827#line 36
26828allow vold update_verifier:binder transfer;
26829#line 36
26830# Receive and use open files from the server.
26831#line 36
26832allow update_verifier vold:fd use;
26833#line 36
26834
26835#line 1 "system/sepolicy/prebuilts/api/29.0/public/usbd.te"
26836type usbd, domain;
26837type usbd_exec, system_file_type, exec_type, file_type;
26838
26839# Start/stop adbd via ctl.start adbd
26840
26841#line 5
26842
26843#line 5
26844allow usbd property_socket:sock_file write;
26845#line 5
26846allow usbd init:unix_stream_socket connectto;
26847#line 5
26848
26849#line 5
26850allow usbd ctl_adbd_prop:property_service set;
26851#line 5
26852
26853#line 5
26854allow usbd ctl_adbd_prop:file { getattr open read map };
26855#line 5
26856
26857#line 5
26858
26859#line 1 "system/sepolicy/prebuilts/api/29.0/public/vdc.te"
26860# vdc spawned from init for the following services:
26861#  defaultcrypto
26862#  encrypt
26863#
26864# We also transition into this domain from dumpstate, when
26865# collecting bug reports.
26866
26867type vdc, domain;
26868type vdc_exec, system_file_type, exec_type, file_type;
26869
26870# vdc can be invoked with logwrapper, so let it write to pty
26871allow vdc devpts:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
26872
26873# vdc writes directly to kmsg during the boot process
26874allow vdc kmsg_device:chr_file { getattr { open append write lock map } };
26875
26876# vdc talks to vold over Binder
26877
26878#line 18
26879# Call the servicemanager and transfer references to it.
26880#line 18
26881allow vdc servicemanager:binder { call transfer };
26882#line 18
26883# servicemanager performs getpidcon on clients.
26884#line 18
26885allow servicemanager vdc:dir search;
26886#line 18
26887allow servicemanager vdc:file { read open };
26888#line 18
26889allow servicemanager vdc:process getattr;
26890#line 18
26891# rw access to /dev/binder and /dev/ashmem is presently granted to
26892#line 18
26893# all domains in domain.te.
26894#line 18
26895
26896
26897#line 19
26898# Call the server domain and optionally transfer references to it.
26899#line 19
26900allow vdc vold:binder { call transfer };
26901#line 19
26902# Allow the serverdomain to transfer references to the client on the reply.
26903#line 19
26904allow vold vdc:binder transfer;
26905#line 19
26906# Receive and use open files from the server.
26907#line 19
26908allow vdc vold:fd use;
26909#line 19
26910
26911allow vdc vold_service:service_manager find;
26912#line 1 "system/sepolicy/prebuilts/api/29.0/public/vendor_init.te"
26913# vendor_init is its own domain.
26914type vendor_init, domain, mlstrustedsubject;
26915
26916# Communication to the main init process
26917allow vendor_init init:unix_stream_socket { read write };
26918
26919# Logging to kmsg
26920allow vendor_init kmsg_device:chr_file { open getattr write };
26921
26922# Mount on /dev/usb-ffs/adb.
26923allow vendor_init device:dir mounton;
26924
26925# Create and remove symlinks in /.
26926allow vendor_init rootfs:lnk_file { create unlink };
26927
26928# Create cgroups mount points in tmpfs and mount cgroups on them.
26929allow vendor_init cgroup:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
26930allow vendor_init cgroup:file { open append write lock map };
26931
26932# /config
26933allow vendor_init configfs:dir mounton;
26934allow vendor_init configfs:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
26935allow vendor_init configfs:{ file lnk_file } { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
26936
26937# Create directories under /dev/cpuctl after chowning it to system.
26938allow vendor_init self:{ capability cap_userns } { dac_override dac_read_search };
26939
26940# mkdir, symlink, write, rm/rmdir, chown/chmod, restorecon/restorecon_recursive from init.rc files.
26941# chown/chmod require open+read+setattr required for open()+fchown/fchmod().
26942# system/core/init.rc requires at least cache_file and data_file_type.
26943# init.<board>.rc files often include device-specific types, so
26944# we just allow all file types except /system files here.
26945allow vendor_init self:{ capability cap_userns } { chown fowner fsetid };
26946
26947# mkdir with FBE requires reading /data/unencrypted/{ref,mode}.
26948allow vendor_init unencrypted_data_file:dir search;
26949allow vendor_init unencrypted_data_file:file { getattr open read ioctl lock map };
26950
26951# Set encryption policy on dirs in /data
26952allowxperm vendor_init data_file_type:dir ioctl {
26953  0x400c6615
26954  0x800c6613
26955};
26956
26957allow vendor_init system_data_file:dir getattr;
26958
26959allow vendor_init {
26960  file_type
26961  -core_data_file_type
26962  -exec_type
26963  -system_file_type
26964  -mnt_product_file
26965  -password_slot_metadata_file
26966  -unlabeled
26967  -vendor_file_type
26968  -vold_metadata_file
26969  -gsi_metadata_file
26970  -apex_metadata_file
26971}:dir { create search getattr open read setattr ioctl write add_name remove_name rmdir relabelfrom };
26972
26973allow vendor_init unlabeled:{ dir { file lnk_file sock_file fifo_file } } { getattr relabelfrom };
26974
26975allow vendor_init {
26976  file_type
26977  -core_data_file_type
26978  -exec_type
26979  -password_slot_metadata_file
26980  -runtime_event_log_tags_file
26981  -system_file_type
26982  -unlabeled
26983  -vendor_file_type
26984  -vold_metadata_file
26985  -gsi_metadata_file
26986  -apex_metadata_file
26987}:file { create getattr open read write setattr relabelfrom unlink map };
26988
26989allow vendor_init {
26990  file_type
26991  -core_data_file_type
26992  -exec_type
26993  -password_slot_metadata_file
26994  -system_file_type
26995  -unlabeled
26996  -vendor_file_type
26997  -vold_metadata_file
26998  -gsi_metadata_file
26999  -apex_metadata_file
27000}:{ sock_file fifo_file } { create getattr open read setattr relabelfrom unlink };
27001
27002allow vendor_init {
27003  file_type
27004  -apex_mnt_dir
27005  -core_data_file_type
27006  -exec_type
27007  -password_slot_metadata_file
27008  -system_file_type
27009  -unlabeled
27010  -vendor_file_type
27011  -vold_metadata_file
27012  -gsi_metadata_file
27013  -apex_metadata_file
27014}:lnk_file { create getattr setattr relabelfrom unlink };
27015
27016allow vendor_init {
27017  file_type
27018  -core_data_file_type
27019  -exec_type
27020  -mnt_product_file
27021  -password_slot_metadata_file
27022  -system_file_type
27023  -vendor_file_type
27024  -vold_metadata_file
27025  -gsi_metadata_file
27026  -apex_metadata_file
27027}:{ dir { { chr_file blk_file } { file lnk_file sock_file fifo_file } } } relabelto;
27028
27029allow vendor_init dev_type:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
27030allow vendor_init dev_type:lnk_file create;
27031
27032# Disable tracing by writing to /sys/kernel/debug/tracing/tracing_on
27033allow vendor_init debugfs_tracing:file { open append write lock map };
27034
27035# chown/chmod on pseudo files.
27036allow vendor_init {
27037  fs_type
27038  -contextmount_type
27039  -keychord_device
27040  -sdcard_type
27041  -rootfs
27042  -proc_uid_time_in_state
27043  -proc_uid_concurrent_active_time
27044  -proc_uid_concurrent_policy_time
27045}:file { open read setattr map };
27046
27047allow vendor_init {
27048  fs_type
27049  -contextmount_type
27050  -sdcard_type
27051  -rootfs
27052  -proc_uid_time_in_state
27053  -proc_uid_concurrent_active_time
27054  -proc_uid_concurrent_policy_time
27055}:dir  { open read setattr search };
27056
27057# chown/chmod on devices, e.g. /dev/ttyHS0
27058allow vendor_init {
27059  dev_type
27060  -keychord_device
27061  -port_device
27062  -lowpan_device
27063  -hw_random_device
27064}:chr_file setattr;
27065
27066allow vendor_init dev_type:blk_file getattr;
27067
27068# Write to /proc/sys/net/ping_group_range and other /proc/sys/net files.
27069
27070#line 157
27071allow vendor_init proc_net_type:dir { open getattr read search ioctl lock };
27072#line 157
27073allow vendor_init proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
27074#line 157
27075
27076allow vendor_init proc_net_type:file { open append write lock map };
27077allow vendor_init self:{ capability cap_userns } net_admin;
27078
27079# Write to /proc/sys/vm/page-cluster
27080allow vendor_init proc_page_cluster:file { open append write lock map };
27081
27082# Write to sysfs nodes.
27083allow vendor_init sysfs_type:dir { open getattr read search ioctl lock };
27084allow vendor_init sysfs_type:lnk_file read;
27085allow vendor_init { sysfs_type -sysfs_usermodehelper }:file { { getattr open read ioctl lock map } { open append write lock map } };
27086
27087# setfscreatecon() for labeling directories and socket files.
27088allow vendor_init self:process { setfscreate };
27089
27090
27091#line 172
27092allow vendor_init vendor_file_type:dir { open getattr read search ioctl lock };
27093#line 172
27094allow vendor_init vendor_file_type:{ file lnk_file } { getattr open read ioctl lock map };
27095#line 172
27096
27097
27098# Vendor init can read properties
27099allow vendor_init serialno_prop:file { getattr open read map };
27100
27101# Vendor init can perform operations on trusted and security Extended Attributes
27102allow vendor_init self:{ capability cap_userns } sys_admin;
27103
27104# Raw writes to misc block device
27105allow vendor_init misc_block_device:blk_file { open append write lock map };
27106
27107# vendor_init is using bootstrap bionic
27108allow vendor_init system_bootstrap_lib_file:dir { open getattr read search ioctl lock };
27109allow vendor_init system_bootstrap_lib_file:file { execute read open getattr map };
27110
27111# Everything is labeled as rootfs in recovery mode. Vendor init has to execute
27112# the dynamic linker and shared libraries.
27113#line 191
27114
27115
27116#line 215
27117
27118
27119# Get file context
27120allow vendor_init file_contexts_file:file { getattr open read ioctl lock map };
27121
27122
27123#line 220
27124
27125#line 220
27126allow vendor_init property_socket:sock_file write;
27127#line 220
27128allow vendor_init init:unix_stream_socket connectto;
27129#line 220
27130
27131#line 220
27132allow vendor_init bluetooth_a2dp_offload_prop:property_service set;
27133#line 220
27134
27135#line 220
27136allow vendor_init bluetooth_a2dp_offload_prop:file { getattr open read map };
27137#line 220
27138
27139#line 220
27140
27141
27142#line 221
27143
27144#line 221
27145allow vendor_init property_socket:sock_file write;
27146#line 221
27147allow vendor_init init:unix_stream_socket connectto;
27148#line 221
27149
27150#line 221
27151allow vendor_init bluetooth_audio_hal_prop:property_service set;
27152#line 221
27153
27154#line 221
27155allow vendor_init bluetooth_audio_hal_prop:file { getattr open read map };
27156#line 221
27157
27158#line 221
27159
27160
27161#line 222
27162
27163#line 222
27164allow vendor_init property_socket:sock_file write;
27165#line 222
27166allow vendor_init init:unix_stream_socket connectto;
27167#line 222
27168
27169#line 222
27170allow vendor_init cpu_variant_prop:property_service set;
27171#line 222
27172
27173#line 222
27174allow vendor_init cpu_variant_prop:file { getattr open read map };
27175#line 222
27176
27177#line 222
27178
27179
27180#line 223
27181
27182#line 223
27183allow vendor_init property_socket:sock_file write;
27184#line 223
27185allow vendor_init init:unix_stream_socket connectto;
27186#line 223
27187
27188#line 223
27189allow vendor_init debug_prop:property_service set;
27190#line 223
27191
27192#line 223
27193allow vendor_init debug_prop:file { getattr open read map };
27194#line 223
27195
27196#line 223
27197
27198
27199#line 224
27200
27201#line 224
27202allow vendor_init property_socket:sock_file write;
27203#line 224
27204allow vendor_init init:unix_stream_socket connectto;
27205#line 224
27206
27207#line 224
27208allow vendor_init exported_audio_prop:property_service set;
27209#line 224
27210
27211#line 224
27212allow vendor_init exported_audio_prop:file { getattr open read map };
27213#line 224
27214
27215#line 224
27216
27217
27218#line 225
27219
27220#line 225
27221allow vendor_init property_socket:sock_file write;
27222#line 225
27223allow vendor_init init:unix_stream_socket connectto;
27224#line 225
27225
27226#line 225
27227allow vendor_init exported_bluetooth_prop:property_service set;
27228#line 225
27229
27230#line 225
27231allow vendor_init exported_bluetooth_prop:file { getattr open read map };
27232#line 225
27233
27234#line 225
27235
27236
27237#line 226
27238
27239#line 226
27240allow vendor_init property_socket:sock_file write;
27241#line 226
27242allow vendor_init init:unix_stream_socket connectto;
27243#line 226
27244
27245#line 226
27246allow vendor_init exported_config_prop:property_service set;
27247#line 226
27248
27249#line 226
27250allow vendor_init exported_config_prop:file { getattr open read map };
27251#line 226
27252
27253#line 226
27254
27255
27256#line 227
27257
27258#line 227
27259allow vendor_init property_socket:sock_file write;
27260#line 227
27261allow vendor_init init:unix_stream_socket connectto;
27262#line 227
27263
27264#line 227
27265allow vendor_init exported_dalvik_prop:property_service set;
27266#line 227
27267
27268#line 227
27269allow vendor_init exported_dalvik_prop:file { getattr open read map };
27270#line 227
27271
27272#line 227
27273
27274
27275#line 228
27276
27277#line 228
27278allow vendor_init property_socket:sock_file write;
27279#line 228
27280allow vendor_init init:unix_stream_socket connectto;
27281#line 228
27282
27283#line 228
27284allow vendor_init exported_default_prop:property_service set;
27285#line 228
27286
27287#line 228
27288allow vendor_init exported_default_prop:file { getattr open read map };
27289#line 228
27290
27291#line 228
27292
27293
27294#line 229
27295
27296#line 229
27297allow vendor_init property_socket:sock_file write;
27298#line 229
27299allow vendor_init init:unix_stream_socket connectto;
27300#line 229
27301
27302#line 229
27303allow vendor_init exported_ffs_prop:property_service set;
27304#line 229
27305
27306#line 229
27307allow vendor_init exported_ffs_prop:file { getattr open read map };
27308#line 229
27309
27310#line 229
27311
27312
27313#line 230
27314
27315#line 230
27316allow vendor_init property_socket:sock_file write;
27317#line 230
27318allow vendor_init init:unix_stream_socket connectto;
27319#line 230
27320
27321#line 230
27322allow vendor_init exported_overlay_prop:property_service set;
27323#line 230
27324
27325#line 230
27326allow vendor_init exported_overlay_prop:file { getattr open read map };
27327#line 230
27328
27329#line 230
27330
27331
27332#line 231
27333
27334#line 231
27335allow vendor_init property_socket:sock_file write;
27336#line 231
27337allow vendor_init init:unix_stream_socket connectto;
27338#line 231
27339
27340#line 231
27341allow vendor_init exported_pm_prop:property_service set;
27342#line 231
27343
27344#line 231
27345allow vendor_init exported_pm_prop:file { getattr open read map };
27346#line 231
27347
27348#line 231
27349
27350
27351#line 232
27352
27353#line 232
27354allow vendor_init property_socket:sock_file write;
27355#line 232
27356allow vendor_init init:unix_stream_socket connectto;
27357#line 232
27358
27359#line 232
27360allow vendor_init exported_radio_prop:property_service set;
27361#line 232
27362
27363#line 232
27364allow vendor_init exported_radio_prop:file { getattr open read map };
27365#line 232
27366
27367#line 232
27368
27369
27370#line 233
27371
27372#line 233
27373allow vendor_init property_socket:sock_file write;
27374#line 233
27375allow vendor_init init:unix_stream_socket connectto;
27376#line 233
27377
27378#line 233
27379allow vendor_init exported_system_radio_prop:property_service set;
27380#line 233
27381
27382#line 233
27383allow vendor_init exported_system_radio_prop:file { getattr open read map };
27384#line 233
27385
27386#line 233
27387
27388
27389#line 234
27390
27391#line 234
27392allow vendor_init property_socket:sock_file write;
27393#line 234
27394allow vendor_init init:unix_stream_socket connectto;
27395#line 234
27396
27397#line 234
27398allow vendor_init exported_wifi_prop:property_service set;
27399#line 234
27400
27401#line 234
27402allow vendor_init exported_wifi_prop:file { getattr open read map };
27403#line 234
27404
27405#line 234
27406
27407
27408#line 235
27409
27410#line 235
27411allow vendor_init property_socket:sock_file write;
27412#line 235
27413allow vendor_init init:unix_stream_socket connectto;
27414#line 235
27415
27416#line 235
27417allow vendor_init exported2_config_prop:property_service set;
27418#line 235
27419
27420#line 235
27421allow vendor_init exported2_config_prop:file { getattr open read map };
27422#line 235
27423
27424#line 235
27425
27426
27427#line 236
27428
27429#line 236
27430allow vendor_init property_socket:sock_file write;
27431#line 236
27432allow vendor_init init:unix_stream_socket connectto;
27433#line 236
27434
27435#line 236
27436allow vendor_init exported2_system_prop:property_service set;
27437#line 236
27438
27439#line 236
27440allow vendor_init exported2_system_prop:file { getattr open read map };
27441#line 236
27442
27443#line 236
27444
27445
27446#line 237
27447
27448#line 237
27449allow vendor_init property_socket:sock_file write;
27450#line 237
27451allow vendor_init init:unix_stream_socket connectto;
27452#line 237
27453
27454#line 237
27455allow vendor_init exported2_vold_prop:property_service set;
27456#line 237
27457
27458#line 237
27459allow vendor_init exported2_vold_prop:file { getattr open read map };
27460#line 237
27461
27462#line 237
27463
27464
27465#line 238
27466
27467#line 238
27468allow vendor_init property_socket:sock_file write;
27469#line 238
27470allow vendor_init init:unix_stream_socket connectto;
27471#line 238
27472
27473#line 238
27474allow vendor_init exported3_default_prop:property_service set;
27475#line 238
27476
27477#line 238
27478allow vendor_init exported3_default_prop:file { getattr open read map };
27479#line 238
27480
27481#line 238
27482
27483
27484#line 239
27485
27486#line 239
27487allow vendor_init property_socket:sock_file write;
27488#line 239
27489allow vendor_init init:unix_stream_socket connectto;
27490#line 239
27491
27492#line 239
27493allow vendor_init exported3_radio_prop:property_service set;
27494#line 239
27495
27496#line 239
27497allow vendor_init exported3_radio_prop:file { getattr open read map };
27498#line 239
27499
27500#line 239
27501
27502
27503#line 240
27504
27505#line 240
27506allow vendor_init property_socket:sock_file write;
27507#line 240
27508allow vendor_init init:unix_stream_socket connectto;
27509#line 240
27510
27511#line 240
27512allow vendor_init logd_prop:property_service set;
27513#line 240
27514
27515#line 240
27516allow vendor_init logd_prop:file { getattr open read map };
27517#line 240
27518
27519#line 240
27520
27521
27522#line 241
27523
27524#line 241
27525allow vendor_init property_socket:sock_file write;
27526#line 241
27527allow vendor_init init:unix_stream_socket connectto;
27528#line 241
27529
27530#line 241
27531allow vendor_init log_tag_prop:property_service set;
27532#line 241
27533
27534#line 241
27535allow vendor_init log_tag_prop:file { getattr open read map };
27536#line 241
27537
27538#line 241
27539
27540
27541#line 242
27542
27543#line 242
27544allow vendor_init property_socket:sock_file write;
27545#line 242
27546allow vendor_init init:unix_stream_socket connectto;
27547#line 242
27548
27549#line 242
27550allow vendor_init log_prop:property_service set;
27551#line 242
27552
27553#line 242
27554allow vendor_init log_prop:file { getattr open read map };
27555#line 242
27556
27557#line 242
27558
27559
27560#line 243
27561
27562#line 243
27563allow vendor_init property_socket:sock_file write;
27564#line 243
27565allow vendor_init init:unix_stream_socket connectto;
27566#line 243
27567
27568#line 243
27569allow vendor_init serialno_prop:property_service set;
27570#line 243
27571
27572#line 243
27573allow vendor_init serialno_prop:file { getattr open read map };
27574#line 243
27575
27576#line 243
27577
27578
27579#line 244
27580
27581#line 244
27582allow vendor_init property_socket:sock_file write;
27583#line 244
27584allow vendor_init init:unix_stream_socket connectto;
27585#line 244
27586
27587#line 244
27588allow vendor_init vendor_default_prop:property_service set;
27589#line 244
27590
27591#line 244
27592allow vendor_init vendor_default_prop:file { getattr open read map };
27593#line 244
27594
27595#line 244
27596
27597
27598#line 245
27599
27600#line 245
27601allow vendor_init property_socket:sock_file write;
27602#line 245
27603allow vendor_init init:unix_stream_socket connectto;
27604#line 245
27605
27606#line 245
27607allow vendor_init vendor_security_patch_level_prop:property_service set;
27608#line 245
27609
27610#line 245
27611allow vendor_init vendor_security_patch_level_prop:file { getattr open read map };
27612#line 245
27613
27614#line 245
27615
27616
27617#line 246
27618
27619#line 246
27620allow vendor_init property_socket:sock_file write;
27621#line 246
27622allow vendor_init init:unix_stream_socket connectto;
27623#line 246
27624
27625#line 246
27626allow vendor_init wifi_log_prop:property_service set;
27627#line 246
27628
27629#line 246
27630allow vendor_init wifi_log_prop:file { getattr open read map };
27631#line 246
27632
27633#line 246
27634
27635
27636
27637#line 248
27638allow vendor_init exported2_radio_prop:file { getattr open read map };
27639#line 248
27640
27641
27642#line 249
27643allow vendor_init exported3_system_prop:file { getattr open read map };
27644#line 249
27645
27646
27647#line 250
27648allow vendor_init theme_prop:file { getattr open read map };
27649#line 250
27650
27651
27652###
27653### neverallow rules
27654###
27655
27656# Vendor init shouldn't communicate with any vendor process, nor most system processes.
27657
27658#line 257
27659  neverallow vendor_init { domain -init -logd -su -vendor_init }:{ socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket unix_stream_socket unix_dgram_socket appletalk_socket netlink_route_socket netlink_tcpdiag_socket netlink_nflog_socket netlink_xfrm_socket netlink_selinux_socket netlink_audit_socket netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket xdp_socket } { connect sendto };
27660#line 257
27661  neverallow vendor_init { domain -init -logd -su -vendor_init }:unix_stream_socket connectto;
27662#line 257
27663;
27664
27665# The vendor_init domain is only entered via an exec based transition from the
27666# init domain, never via setcon().
27667neverallow domain vendor_init:process dyntransition;
27668neverallow { domain -init } vendor_init:process transition;
27669neverallow vendor_init { file_type fs_type -init_exec }:file entrypoint;
27670
27671# Never read/follow symlinks created by shell or untrusted apps.
27672neverallow vendor_init { app_data_file privapp_data_file }:lnk_file read;
27673neverallow vendor_init shell_data_file:lnk_file read;
27674# Init should not be creating subdirectories in /data/local/tmp
27675neverallow vendor_init shell_data_file:dir { write add_name remove_name };
27676
27677# init should never execute a program without changing to another domain.
27678neverallow vendor_init { file_type fs_type }:file execute_no_trans;
27679
27680# Init never adds or uses services via service_manager.
27681neverallow vendor_init service_manager_type:service_manager { add find };
27682neverallow vendor_init servicemanager:service_manager list;
27683
27684# vendor_init should never be ptraced
27685neverallow * vendor_init:process ptrace;
27686#line 1 "system/sepolicy/prebuilts/api/29.0/public/vendor_misc_writer.te"
27687# vendor_misc_writer
27688type vendor_misc_writer, domain;
27689type vendor_misc_writer_exec, vendor_file_type, exec_type, file_type;
27690
27691# Raw writes to misc_block_device
27692allow vendor_misc_writer misc_block_device:blk_file { open append write lock map };
27693allow vendor_misc_writer block_device:dir { open getattr read search ioctl lock };
27694
27695# Silence the denial when calling libfstab's ReadDefaultFstab, which tries to
27696# load DT fstab.
27697dontaudit vendor_misc_writer proc_cmdline:file read;
27698dontaudit vendor_misc_writer metadata_file:dir search;
27699dontaudit vendor_misc_writer sysfs_dt_firmware_android:dir search;
27700#line 1 "system/sepolicy/prebuilts/api/29.0/public/vendor_shell.te"
27701type vendor_shell, domain;
27702type vendor_shell_exec, exec_type, vendor_file_type, file_type;
27703
27704allow vendor_shell vendor_shell_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
27705allow vendor_shell vendor_toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
27706
27707# Use fd from shell when vendor_shell is started from shell
27708allow vendor_shell shell:fd use;
27709
27710# adbd: allow `adb shell /vendor/bin/sh` and `adb shell` then `/vendor/bin/sh`
27711allow vendor_shell adbd:fd use;
27712allow vendor_shell adbd:process sigchld;
27713allow vendor_shell adbd:unix_stream_socket { getattr ioctl read write };
27714
27715allow vendor_shell devpts:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27716allow vendor_shell tty_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27717allow vendor_shell console_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27718allow vendor_shell input_device:dir { open getattr read search ioctl lock };
27719allow vendor_shell input_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27720#line 1 "system/sepolicy/prebuilts/api/29.0/public/vendor_toolbox.te"
27721# Toolbox installation for vendor binaries / scripts
27722# Non-vendor processes are not allowed to execute the binary
27723# and is always executed without transition.
27724type vendor_toolbox_exec, exec_type, vendor_file_type, file_type;
27725
27726# Do not allow domains to transition to vendor toolbox
27727# or read, execute the vendor_toolbox file.
27728
27729#line 8
27730    # Do not allow non-vendor domains to transition
27731#line 8
27732    # to vendor toolbox except for the allowlisted domains.
27733#line 8
27734    neverallow {
27735#line 8
27736        coredomain
27737#line 8
27738        -init
27739#line 8
27740        -modprobe
27741#line 8
27742    } vendor_toolbox_exec:file { entrypoint execute execute_no_trans };
27743#line 16
27744
27745#line 1 "system/sepolicy/prebuilts/api/29.0/public/virtual_touchpad.te"
27746type virtual_touchpad, domain;
27747type virtual_touchpad_exec, system_file_type, exec_type, file_type;
27748
27749
27750#line 4
27751# Call the servicemanager and transfer references to it.
27752#line 4
27753allow virtual_touchpad servicemanager:binder { call transfer };
27754#line 4
27755# servicemanager performs getpidcon on clients.
27756#line 4
27757allow servicemanager virtual_touchpad:dir search;
27758#line 4
27759allow servicemanager virtual_touchpad:file { read open };
27760#line 4
27761allow servicemanager virtual_touchpad:process getattr;
27762#line 4
27763# rw access to /dev/binder and /dev/ashmem is presently granted to
27764#line 4
27765# all domains in domain.te.
27766#line 4
27767
27768
27769#line 5
27770typeattribute virtual_touchpad binderservicedomain;
27771#line 5
27772
27773
27774#line 6
27775  allow virtual_touchpad virtual_touchpad_service:service_manager { add find };
27776#line 6
27777  neverallow { domain -virtual_touchpad } virtual_touchpad_service:service_manager add;
27778#line 6
27779
27780
27781# Needed to check app permissions.
27782
27783#line 9
27784# Call the server domain and optionally transfer references to it.
27785#line 9
27786allow virtual_touchpad system_server:binder { call transfer };
27787#line 9
27788# Allow the serverdomain to transfer references to the client on the reply.
27789#line 9
27790allow system_server virtual_touchpad:binder transfer;
27791#line 9
27792# Receive and use open files from the server.
27793#line 9
27794allow virtual_touchpad system_server:fd use;
27795#line 9
27796
27797
27798# Requires access to /dev/uinput to create and feed the virtual device.
27799allow virtual_touchpad uhid_device:chr_file { { open append write lock map } ioctl };
27800
27801# Requires access to the permission service to validate that clients have the
27802# appropriate VR permissions.
27803allow virtual_touchpad permission_service:service_manager find;
27804#line 1 "system/sepolicy/prebuilts/api/29.0/public/vndservice.te"
27805type default_android_vndservice, vndservice_manager_type;
27806#line 1 "system/sepolicy/prebuilts/api/29.0/public/vndservicemanager.te"
27807# vndservicemanager - the Binder context manager for vendor processes
27808type vndservicemanager, domain;
27809#line 1 "system/sepolicy/prebuilts/api/29.0/public/vold.te"
27810# volume manager
27811type vold, domain;
27812type vold_exec, exec_type, file_type, system_file_type;
27813
27814# Read already opened /cache files.
27815allow vold cache_file:dir { open getattr read search ioctl lock };
27816allow vold cache_file:file { getattr read };
27817allow vold cache_file:lnk_file { getattr open read ioctl lock map };
27818
27819
27820#line 10
27821allow vold { sysfs_type -sysfs_batteryinfo }:dir { open getattr read search ioctl lock };
27822#line 10
27823allow vold { sysfs_type -sysfs_batteryinfo }:{ file lnk_file } { getattr open read ioctl lock map };
27824#line 10
27825
27826# XXX Label sysfs files with a specific type?
27827allow vold {
27828  sysfs # writing to /sys/*/uevent during coldboot.
27829  sysfs_devices_block
27830  sysfs_dm
27831  sysfs_loop # writing to /sys/block/loop*/uevent during coldboot.
27832  sysfs_usb
27833  sysfs_zram_uevent
27834  sysfs_fs_f2fs
27835}:file { open append write lock map };
27836
27837
27838#line 22
27839allow vold rootfs:dir { open getattr read search ioctl lock };
27840#line 22
27841allow vold rootfs:{ file lnk_file } { getattr open read ioctl lock map };
27842#line 22
27843
27844
27845#line 23
27846allow vold metadata_file:dir { open getattr read search ioctl lock };
27847#line 23
27848allow vold metadata_file:{ file lnk_file } { getattr open read ioctl lock map };
27849#line 23
27850
27851allow vold {
27852  proc # b/67049235 processes /proc/<pid>/* files are mislabeled.
27853  proc_cmdline
27854  proc_drop_caches
27855  proc_filesystems
27856  proc_meminfo
27857  proc_mounts
27858}:file { getattr open read ioctl lock map };
27859
27860#Get file contexts
27861allow vold file_contexts_file:file { getattr open read ioctl lock map };
27862
27863# Allow us to jump into execution domains of above tools
27864allow vold self:process setexec;
27865
27866# For formatting adoptable storage devices
27867allow vold e2fs_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
27868
27869# Run fstrim on mounted partitions
27870# allowxperm still requires the ioctl permission for the individual type
27871allowxperm vold { fs_type file_type }:dir ioctl 0xc0185879;
27872
27873# Get encryption policy for dirs in /data
27874allowxperm vold data_file_type:dir ioctl {
27875  0x400c6615
27876  0x800c6613
27877};
27878
27879# Find the location on the raw block device where the
27880# crypto key is stored so it can be destroyed
27881allowxperm vold vold_data_file:file ioctl {
27882  0xc020660b
27883};
27884
27885typeattribute vold mlstrustedsubject;
27886allow vold self:process setfscreate;
27887allow vold system_file:file { getattr execute execute_no_trans map };
27888
27889allow vold block_device:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
27890allow vold device:dir write;
27891allow vold devpts:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27892allow vold rootfs:dir mounton;
27893allow vold sdcard_type:dir mounton; # TODO: deprecated in M
27894allow vold sdcard_type:filesystem { mount remount unmount }; # TODO: deprecated in M
27895allow vold sdcard_type:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } }; # TODO: deprecated in M
27896allow vold sdcard_type:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } }; # TODO: deprecated in M
27897
27898# Manage locations where storage is mounted
27899allow vold { mnt_media_rw_file storage_file sdcard_type }:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
27900allow vold { mnt_media_rw_file storage_file sdcard_type }:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
27901
27902# Access to storage that backs emulated FUSE daemons for migration optimization
27903allow vold media_rw_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
27904allow vold media_rw_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
27905
27906# Allow mounting of storage devices
27907allow vold { mnt_media_rw_stub_file storage_stub_file }:dir { mounton create rmdir getattr setattr };
27908
27909# Manage per-user primary symlinks
27910allow vold mnt_user_file:dir { { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } } mounton };
27911allow vold mnt_user_file:lnk_file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
27912allow vold mnt_user_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
27913
27914# Allow to create and mount expanded storage
27915allow vold mnt_expand_file:dir { { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } } mounton };
27916allow vold apk_data_file:dir { create getattr setattr };
27917allow vold shell_data_file:dir { create getattr setattr };
27918
27919allow vold tmpfs:filesystem { mount unmount };
27920allow vold tmpfs:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
27921allow vold tmpfs:dir mounton;
27922allow vold self:{ capability cap_userns } { net_admin dac_override dac_read_search mknod sys_admin chown fowner fsetid };
27923allow vold self:netlink_kobject_uevent_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
27924allow vold loop_control_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27925allow vold loop_device:blk_file { create setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
27926allowxperm vold loop_device:blk_file ioctl {
27927  0x00004c01
27928  0x00004c82
27929  0x00004c05
27930  0x00004c00
27931  0x00004c04
27932};
27933allow vold vold_device:blk_file { create setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
27934allowxperm vold vold_device:blk_file ioctl { 0x00001277 0x00001260 };
27935allow vold dm_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27936allow vold dm_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
27937allowxperm vold dm_device:blk_file ioctl 0x0000127d;
27938# For vold Process::killProcessesWithOpenFiles function.
27939allow vold domain:dir { open getattr read search ioctl lock };
27940allow vold domain:{ file lnk_file } { getattr open read ioctl lock map };
27941allow vold domain:process { signal sigkill };
27942allow vold self:{ capability cap_userns } { sys_ptrace kill };
27943
27944allow vold kmsg_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
27945
27946# Run fsck in the fsck domain.
27947allow vold fsck_exec:file { { getattr open read ioctl lock map } execute };
27948
27949# Log fsck results
27950allow vold fscklogs:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
27951allow vold fscklogs:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
27952
27953#
27954# Rules to support encrypted fs support.
27955#
27956
27957# Unmount and mount the fs.
27958allow vold labeledfs:filesystem { mount unmount remount };
27959
27960# Access /efs/userdata_footer.
27961# XXX Split into a separate type?
27962allow vold efs_file:file { { getattr open read ioctl lock map } { open append write lock map } };
27963
27964# Create and mount on /data/tmp_mnt and management of expansion mounts
27965allow vold system_data_file:dir { create { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } mounton setattr rmdir };
27966allow vold system_data_file:lnk_file getattr;
27967
27968# Vold create users in /data/vendor_{ce,de}/[0-9]+
27969allow vold vendor_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
27970
27971# for secdiscard
27972allow vold system_data_file:file read;
27973
27974# Set scheduling policy of kernel processes
27975allow vold kernel:process setsched;
27976
27977# Property Service
27978
27979#line 151
27980
27981#line 151
27982allow vold property_socket:sock_file write;
27983#line 151
27984allow vold init:unix_stream_socket connectto;
27985#line 151
27986
27987#line 151
27988allow vold vold_prop:property_service set;
27989#line 151
27990
27991#line 151
27992allow vold vold_prop:file { getattr open read map };
27993#line 151
27994
27995#line 151
27996
27997
27998#line 152
27999
28000#line 152
28001allow vold property_socket:sock_file write;
28002#line 152
28003allow vold init:unix_stream_socket connectto;
28004#line 152
28005
28006#line 152
28007allow vold exported_vold_prop:property_service set;
28008#line 152
28009
28010#line 152
28011allow vold exported_vold_prop:file { getattr open read map };
28012#line 152
28013
28014#line 152
28015
28016
28017#line 153
28018
28019#line 153
28020allow vold property_socket:sock_file write;
28021#line 153
28022allow vold init:unix_stream_socket connectto;
28023#line 153
28024
28025#line 153
28026allow vold exported2_vold_prop:property_service set;
28027#line 153
28028
28029#line 153
28030allow vold exported2_vold_prop:file { getattr open read map };
28031#line 153
28032
28033#line 153
28034
28035
28036#line 154
28037
28038#line 154
28039allow vold property_socket:sock_file write;
28040#line 154
28041allow vold init:unix_stream_socket connectto;
28042#line 154
28043
28044#line 154
28045allow vold powerctl_prop:property_service set;
28046#line 154
28047
28048#line 154
28049allow vold powerctl_prop:file { getattr open read map };
28050#line 154
28051
28052#line 154
28053
28054
28055#line 155
28056
28057#line 155
28058allow vold property_socket:sock_file write;
28059#line 155
28060allow vold init:unix_stream_socket connectto;
28061#line 155
28062
28063#line 155
28064allow vold ctl_fuse_prop:property_service set;
28065#line 155
28066
28067#line 155
28068allow vold ctl_fuse_prop:file { getattr open read map };
28069#line 155
28070
28071#line 155
28072
28073
28074#line 156
28075
28076#line 156
28077allow vold property_socket:sock_file write;
28078#line 156
28079allow vold init:unix_stream_socket connectto;
28080#line 156
28081
28082#line 156
28083allow vold restorecon_prop:property_service set;
28084#line 156
28085
28086#line 156
28087allow vold restorecon_prop:file { getattr open read map };
28088#line 156
28089
28090#line 156
28091
28092
28093# ASEC
28094allow vold asec_image_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
28095allow vold asec_image_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
28096allow vold asec_apk_file:dir { { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } } mounton relabelfrom relabelto };
28097allow vold asec_public_file:dir { relabelto setattr };
28098allow vold asec_apk_file:file { { getattr open read ioctl lock map } setattr relabelfrom relabelto };
28099allow vold asec_public_file:file { relabelto setattr };
28100# restorecon files in asec containers created on 4.2 or earlier.
28101allow vold unlabeled:dir { { open getattr read search ioctl lock } setattr relabelfrom };
28102allow vold unlabeled:file { { getattr open read ioctl lock map } setattr relabelfrom };
28103
28104# Handle wake locks (used for device encryption)
28105
28106#line 170
28107# TODO(b/115946999): Remove /sys/power/* permissions once CONFIG_PM_WAKELOCKS is
28108#line 170
28109# deprecated.
28110#line 170
28111# Access /sys/power/wake_lock and /sys/power/wake_unlock
28112#line 170
28113allow vold sysfs_wake_lock:file { { getattr open read ioctl lock map } { open append write lock map } };
28114#line 170
28115# Accessing these files requires CAP_BLOCK_SUSPEND
28116#line 170
28117allow vold self:{ capability2 cap2_userns } block_suspend;
28118#line 170
28119# system_suspend permissions
28120#line 170
28121
28122#line 170
28123# Call the server domain and optionally transfer references to it.
28124#line 170
28125allow vold system_suspend_server:binder { call transfer };
28126#line 170
28127# Allow the serverdomain to transfer references to the client on the reply.
28128#line 170
28129allow system_suspend_server vold:binder transfer;
28130#line 170
28131# Receive and use open files from the server.
28132#line 170
28133allow vold system_suspend_server:fd use;
28134#line 170
28135
28136#line 170
28137allow vold system_suspend_hwservice:hwservice_manager find;
28138#line 170
28139# halclientdomain permissions
28140#line 170
28141
28142#line 170
28143# Call the hwservicemanager and transfer references to it.
28144#line 170
28145allow vold hwservicemanager:binder { call transfer };
28146#line 170
28147# Allow hwservicemanager to send out callbacks
28148#line 170
28149allow hwservicemanager vold:binder { call transfer };
28150#line 170
28151# hwservicemanager performs getpidcon on clients.
28152#line 170
28153allow hwservicemanager vold:dir search;
28154#line 170
28155allow hwservicemanager vold:file { read open map };
28156#line 170
28157allow hwservicemanager vold:process getattr;
28158#line 170
28159# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
28160#line 170
28161# all domains in domain.te.
28162#line 170
28163
28164#line 170
28165
28166#line 170
28167allow vold hwservicemanager_prop:file { getattr open read map };
28168#line 170
28169
28170#line 170
28171allow vold hidl_manager_hwservice:hwservice_manager find;
28172#line 170
28173
28174
28175# Allow vold to publish a binder service and make binder calls.
28176
28177#line 173
28178# Call the servicemanager and transfer references to it.
28179#line 173
28180allow vold servicemanager:binder { call transfer };
28181#line 173
28182# servicemanager performs getpidcon on clients.
28183#line 173
28184allow servicemanager vold:dir search;
28185#line 173
28186allow servicemanager vold:file { read open };
28187#line 173
28188allow servicemanager vold:process getattr;
28189#line 173
28190# rw access to /dev/binder and /dev/ashmem is presently granted to
28191#line 173
28192# all domains in domain.te.
28193#line 173
28194
28195
28196#line 174
28197  allow vold vold_service:service_manager { add find };
28198#line 174
28199  neverallow { domain -vold } vold_service:service_manager add;
28200#line 174
28201
28202
28203# Allow vold to call into the system server so it can check permissions.
28204
28205#line 177
28206# Call the server domain and optionally transfer references to it.
28207#line 177
28208allow vold system_server:binder { call transfer };
28209#line 177
28210# Allow the serverdomain to transfer references to the client on the reply.
28211#line 177
28212allow system_server vold:binder transfer;
28213#line 177
28214# Receive and use open files from the server.
28215#line 177
28216allow vold system_server:fd use;
28217#line 177
28218
28219allow vold permission_service:service_manager find;
28220
28221# talk to batteryservice
28222
28223#line 181
28224# Call the server domain and optionally transfer references to it.
28225#line 181
28226allow vold healthd:binder { call transfer };
28227#line 181
28228# Allow the serverdomain to transfer references to the client on the reply.
28229#line 181
28230allow healthd vold:binder transfer;
28231#line 181
28232# Receive and use open files from the server.
28233#line 181
28234allow vold healthd:fd use;
28235#line 181
28236
28237
28238# talk to keymaster
28239
28240#line 184
28241typeattribute vold halclientdomain;
28242#line 184
28243typeattribute vold hal_keymaster_client;
28244#line 184
28245
28246#line 184
28247# TODO(b/34170079): Make the inclusion of the rules below conditional also on
28248#line 184
28249# non-Treble devices. For now, on non-Treble device, always grant clients of a
28250#line 184
28251# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
28252#line 184
28253
28254#line 184
28255
28256
28257# talk to health storage HAL
28258
28259#line 187
28260typeattribute vold halclientdomain;
28261#line 187
28262typeattribute vold hal_health_storage_client;
28263#line 187
28264
28265#line 187
28266# TODO(b/34170079): Make the inclusion of the rules below conditional also on
28267#line 187
28268# non-Treble devices. For now, on non-Treble device, always grant clients of a
28269#line 187
28270# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
28271#line 187
28272
28273#line 187
28274
28275
28276# talk to bootloader HAL
28277
28278#line 190
28279typeattribute vold halclientdomain;
28280#line 190
28281typeattribute vold hal_bootctl_client;
28282#line 190
28283
28284#line 190
28285# TODO(b/34170079): Make the inclusion of the rules below conditional also on
28286#line 190
28287# non-Treble devices. For now, on non-Treble device, always grant clients of a
28288#line 190
28289# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
28290#line 190
28291
28292#line 190
28293
28294
28295# Access userdata block device.
28296allow vold userdata_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
28297allowxperm vold userdata_block_device:blk_file ioctl 0x0000127d;
28298
28299# Access metadata block device used for encryption meta-data.
28300allow vold metadata_block_device:blk_file { { getattr open read ioctl lock map } { open append write lock map } };
28301
28302# Allow vold to manipulate /data/unencrypted
28303allow vold unencrypted_data_file:{ file } { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
28304allow vold unencrypted_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
28305
28306# Write to /proc/sys/vm/drop_caches
28307allow vold proc_drop_caches:file { open append write lock map };
28308
28309# Give vold a place where only vold can store files; everyone else is off limits
28310allow vold vold_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
28311allow vold vold_data_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
28312
28313# And a similar place in the metadata partition
28314allow vold vold_metadata_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
28315allow vold vold_metadata_file:file { create rename setattr unlink { { getattr open read ioctl lock map } { open append write lock map } } };
28316
28317# linux keyring configuration
28318allow vold init:key { write search setattr };
28319allow vold vold:key { write search setattr };
28320
28321# vold temporarily changes its priority when running benchmarks
28322allow vold self:{ capability cap_userns } sys_nice;
28323
28324# vold needs to chroot into app namespaces to remount when runtime permissions change
28325allow vold self:{ capability cap_userns } sys_chroot;
28326allow vold storage_file:dir mounton;
28327
28328# For AppFuse.
28329allow vold fuse_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
28330allow vold fuse:filesystem { relabelfrom };
28331allow vold app_fusefs:filesystem { relabelfrom relabelto };
28332allow vold app_fusefs:filesystem { mount unmount };
28333allow vold app_fuse_file:dir { { open getattr read search ioctl lock } { open search write add_name remove_name lock } };
28334allow vold app_fuse_file:file { read write open getattr append };
28335
28336# MoveTask.cpp executes cp and rm
28337allow vold toolbox_exec:file { { getattr open read ioctl lock map } { getattr execute execute_no_trans map } };
28338
28339# Prepare profile dir for users.
28340allow vold user_profile_data_file:dir { create reparent rename rmdir setattr { { open getattr read search ioctl lock } { open search write add_name remove_name lock } } };
28341
28342# Raw writes to misc block device
28343allow vold misc_block_device:blk_file { open append write lock map };
28344
28345# vold might need to search or mount /mnt/vendor/*
28346allow vold mnt_vendor_file:dir search;
28347
28348dontaudit vold self:{ capability cap_userns } sys_resource;
28349
28350# vold needs to know whether we're running a GSI.
28351allow vold gsi_metadata_file:dir { open getattr read search ioctl lock };
28352allow vold gsi_metadata_file:file { getattr open read ioctl lock map };
28353
28354neverallow {
28355    domain
28356    -vold
28357    -vold_prepare_subdirs
28358} vold_data_file:dir ~{ open create read getattr setattr search relabelfrom relabelto ioctl };
28359
28360neverallow {
28361    domain
28362    -init
28363    -vold
28364    -vold_prepare_subdirs
28365} vold_data_file:dir *;
28366
28367neverallow {
28368    domain
28369    -init
28370    -vold
28371} vold_metadata_file:dir *;
28372
28373neverallow {
28374    domain
28375    -kernel
28376    -vold
28377    -vold_prepare_subdirs
28378} vold_data_file:{ file lnk_file sock_file fifo_file } ~{ relabelto getattr };
28379
28380neverallow {
28381    domain
28382    -init
28383    -vold
28384    -vold_prepare_subdirs
28385} vold_metadata_file:{ file lnk_file sock_file fifo_file } ~{ relabelto getattr };
28386
28387neverallow {
28388    domain
28389    -init
28390    -kernel
28391    -vold
28392    -vold_prepare_subdirs
28393} { vold_data_file vold_metadata_file }:{ file lnk_file sock_file fifo_file } *;
28394
28395neverallow { domain -vold -init } restorecon_prop:property_service set;
28396
28397neverallow {
28398    domain
28399    -system_server
28400    -vdc
28401    -vold
28402    -update_verifier
28403    -apexd
28404} vold_service:service_manager find;
28405
28406neverallow vold {
28407  domain
28408  -ashmemd
28409  -hal_health_storage_server
28410  -hal_keymaster_server
28411  -system_suspend_server
28412  -hal_bootctl_server
28413  -healthd
28414  -hwservicemanager
28415  -iorapd_service
28416  -servicemanager
28417  -system_server
28418
28419}:binder call;
28420
28421neverallow vold fsck_exec:file execute_no_trans;
28422neverallow { domain -init } vold:process { transition dyntransition };
28423neverallow vold *:process ptrace;
28424neverallow vold *:rawip_socket *;
28425#line 1 "system/sepolicy/prebuilts/api/29.0/public/vold_prepare_subdirs.te"
28426# SELinux directory creation and labelling for vold-managed directories
28427
28428type vold_prepare_subdirs, domain;
28429type vold_prepare_subdirs_exec, system_file_type, exec_type, file_type;
28430
28431typeattribute vold_prepare_subdirs coredomain;
28432#line 1 "system/sepolicy/prebuilts/api/29.0/public/vr_hwc.te"
28433type vr_hwc, domain;
28434type vr_hwc_exec, system_file_type, exec_type, file_type;
28435
28436# Get buffer metadata.
28437
28438#line 5
28439typeattribute vr_hwc halclientdomain;
28440#line 5
28441typeattribute vr_hwc hal_graphics_allocator_client;
28442#line 5
28443
28444#line 5
28445# TODO(b/34170079): Make the inclusion of the rules below conditional also on
28446#line 5
28447# non-Treble devices. For now, on non-Treble device, always grant clients of a
28448#line 5
28449# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
28450#line 5
28451
28452#line 5
28453
28454
28455
28456#line 7
28457# Call the servicemanager and transfer references to it.
28458#line 7
28459allow vr_hwc servicemanager:binder { call transfer };
28460#line 7
28461# servicemanager performs getpidcon on clients.
28462#line 7
28463allow servicemanager vr_hwc:dir search;
28464#line 7
28465allow servicemanager vr_hwc:file { read open };
28466#line 7
28467allow servicemanager vr_hwc:process getattr;
28468#line 7
28469# rw access to /dev/binder and /dev/ashmem is presently granted to
28470#line 7
28471# all domains in domain.te.
28472#line 7
28473
28474
28475#line 8
28476typeattribute vr_hwc binderservicedomain;
28477#line 8
28478
28479
28480
28481#line 10
28482# Call the server domain and optionally transfer references to it.
28483#line 10
28484allow vr_hwc surfaceflinger:binder { call transfer };
28485#line 10
28486# Allow the serverdomain to transfer references to the client on the reply.
28487#line 10
28488allow surfaceflinger vr_hwc:binder transfer;
28489#line 10
28490# Receive and use open files from the server.
28491#line 10
28492allow vr_hwc surfaceflinger:fd use;
28493#line 10
28494
28495# Needed to check for app permissions.
28496
28497#line 12
28498# Call the server domain and optionally transfer references to it.
28499#line 12
28500allow vr_hwc system_server:binder { call transfer };
28501#line 12
28502# Allow the serverdomain to transfer references to the client on the reply.
28503#line 12
28504allow system_server vr_hwc:binder transfer;
28505#line 12
28506# Receive and use open files from the server.
28507#line 12
28508allow vr_hwc system_server:fd use;
28509#line 12
28510
28511
28512
28513#line 14
28514  allow vr_hwc vr_hwc_service:service_manager { add find };
28515#line 14
28516  neverallow { domain -vr_hwc } vr_hwc_service:service_manager add;
28517#line 14
28518
28519
28520# Hosts the VR HWC implementation and provides a simple Binder interface for VR
28521# Window Manager to receive the layers/buffers.
28522
28523#line 18
28524# Call the hwservicemanager and transfer references to it.
28525#line 18
28526allow vr_hwc hwservicemanager:binder { call transfer };
28527#line 18
28528# Allow hwservicemanager to send out callbacks
28529#line 18
28530allow hwservicemanager vr_hwc:binder { call transfer };
28531#line 18
28532# hwservicemanager performs getpidcon on clients.
28533#line 18
28534allow hwservicemanager vr_hwc:dir search;
28535#line 18
28536allow hwservicemanager vr_hwc:file { read open map };
28537#line 18
28538allow hwservicemanager vr_hwc:process getattr;
28539#line 18
28540# rw access to /dev/hwbinder and /dev/ashmem is presently granted to
28541#line 18
28542# all domains in domain.te.
28543#line 18
28544
28545
28546# Load vendor libraries.
28547allow vr_hwc system_file:dir { open getattr read search ioctl lock };
28548
28549allow vr_hwc ion_device:chr_file { getattr open read ioctl lock map };
28550
28551# Allow connection to VR DisplayClient to get the primary display metadata
28552# (ie: size).
28553
28554#line 27
28555
28556#line 27
28557# Allow client to open the service endpoint file.
28558#line 27
28559allow vr_hwc pdx_display_client_endpoint_dir_type:dir { open getattr read search ioctl lock };
28560#line 27
28561allow vr_hwc pdx_display_client_endpoint_socket_type:sock_file { { getattr open read ioctl lock map } { open append write lock map } };
28562#line 27
28563# Allow the client to connect to endpoint socket.
28564#line 27
28565allow vr_hwc pdx_display_client_endpoint_socket_type:unix_stream_socket { connectto read write shutdown };
28566#line 27
28567
28568#line 27
28569
28570#line 27
28571# Allow the client to use the PDX channel socket.
28572#line 27
28573# Not using macro like "rw_socket_perms_no_ioctl" because it provides more rights
28574#line 27
28575# than we need (e.g. we don"t need "bind" or "connect").
28576#line 27
28577allow vr_hwc pdx_display_client_channel_socket_type:unix_stream_socket { read getattr write setattr lock append getopt setopt shutdown };
28578#line 27
28579# Client needs to use an channel event fd from the server.
28580#line 27
28581allow vr_hwc pdx_display_client_server_type:fd use;
28582#line 27
28583# Servers may receive sync fences, gralloc buffers, etc, from clients.
28584#line 27
28585# This could be tightened on a per-server basis, but keeping track of service
28586#line 27
28587# clients is error prone.
28588#line 27
28589allow pdx_display_client_server_type vr_hwc:fd use;
28590#line 27
28591
28592#line 27
28593
28594
28595# Requires access to the permission service to validate that clients have the
28596# appropriate VR permissions.
28597allow vr_hwc permission_service:service_manager find;
28598
28599allow vr_hwc vrflinger_vsync_service:service_manager find;
28600#line 1 "system/sepolicy/prebuilts/api/29.0/public/watchdogd.te"
28601# watchdogd seclabel is specified in init.<board>.rc
28602type watchdogd, domain;
28603type watchdogd_exec, system_file_type, exec_type, file_type;
28604
28605allow watchdogd watchdog_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
28606allow watchdogd kmsg_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
28607#line 1 "system/sepolicy/prebuilts/api/29.0/public/webview_zygote.te"
28608# webview_zygote is an auxiliary zygote process that is used to spawn
28609# isolated_app processes for rendering untrusted web content.
28610
28611type webview_zygote, domain;
28612type webview_zygote_exec, exec_type, file_type;
28613type webview_zygote_tmpfs, file_type;
28614#line 1 "system/sepolicy/prebuilts/api/29.0/public/wificond.te"
28615# wificond
28616type wificond, domain;
28617type wificond_exec, system_file_type, exec_type, file_type;
28618
28619
28620#line 5
28621# Call the servicemanager and transfer references to it.
28622#line 5
28623allow wificond servicemanager:binder { call transfer };
28624#line 5
28625# servicemanager performs getpidcon on clients.
28626#line 5
28627allow servicemanager wificond:dir search;
28628#line 5
28629allow servicemanager wificond:file { read open };
28630#line 5
28631allow servicemanager wificond:process getattr;
28632#line 5
28633# rw access to /dev/binder and /dev/ashmem is presently granted to
28634#line 5
28635# all domains in domain.te.
28636#line 5
28637
28638
28639#line 6
28640# Call the server domain and optionally transfer references to it.
28641#line 6
28642allow wificond system_server:binder { call transfer };
28643#line 6
28644# Allow the serverdomain to transfer references to the client on the reply.
28645#line 6
28646allow system_server wificond:binder transfer;
28647#line 6
28648# Receive and use open files from the server.
28649#line 6
28650allow wificond system_server:fd use;
28651#line 6
28652
28653
28654
28655#line 8
28656  allow wificond wificond_service:service_manager { add find };
28657#line 8
28658  neverallow { domain -wificond } wificond_service:service_manager add;
28659#line 8
28660
28661
28662
28663#line 10
28664
28665#line 10
28666allow wificond property_socket:sock_file write;
28667#line 10
28668allow wificond init:unix_stream_socket connectto;
28669#line 10
28670
28671#line 10
28672allow wificond exported_wifi_prop:property_service set;
28673#line 10
28674
28675#line 10
28676allow wificond exported_wifi_prop:file { getattr open read map };
28677#line 10
28678
28679#line 10
28680
28681
28682#line 11
28683
28684#line 11
28685allow wificond property_socket:sock_file write;
28686#line 11
28687allow wificond init:unix_stream_socket connectto;
28688#line 11
28689
28690#line 11
28691allow wificond wifi_prop:property_service set;
28692#line 11
28693
28694#line 11
28695allow wificond wifi_prop:file { getattr open read map };
28696#line 11
28697
28698#line 11
28699
28700
28701#line 12
28702
28703#line 12
28704allow wificond property_socket:sock_file write;
28705#line 12
28706allow wificond init:unix_stream_socket connectto;
28707#line 12
28708
28709#line 12
28710allow wificond ctl_default_prop:property_service set;
28711#line 12
28712
28713#line 12
28714allow wificond ctl_default_prop:file { getattr open read map };
28715#line 12
28716
28717#line 12
28718
28719
28720# create sockets to set interfaces up and down
28721allow wificond self:udp_socket { create { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } };
28722# setting interface state up/down is a privileged ioctl
28723allowxperm wificond self:udp_socket ioctl { 0x00008914 0x00008924 };
28724allow wificond self:{ capability cap_userns } { net_admin net_raw };
28725# allow wificond to speak to nl80211 in the kernel
28726allow wificond self:netlink_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
28727# newer kernels (e.g. 4.4 but not 4.1) have a new class for sockets
28728allow wificond self:netlink_generic_socket { create { read getattr write setattr lock append bind connect getopt setopt shutdown map } };
28729
28730
28731#line 24
28732allow wificond proc_net_type:dir { open getattr read search ioctl lock };
28733#line 24
28734allow wificond proc_net_type:{ file lnk_file } { getattr open read ioctl lock map };
28735#line 24
28736
28737
28738# allow wificond to check permission for dumping logs
28739allow wificond permission_service:service_manager find;
28740
28741# dumpstate support
28742allow wificond dumpstate:fd use;
28743allow wificond dumpstate:fifo_file write;
28744#line 1 "system/sepolicy/prebuilts/api/29.0/public/wpantund.te"
28745type wpantund, domain;
28746type wpantund_exec, system_file_type, exec_type, file_type;
28747
28748
28749#line 4
28750typeattribute wpantund halclientdomain;
28751#line 4
28752typeattribute wpantund hal_lowpan_client;
28753#line 4
28754
28755#line 4
28756# TODO(b/34170079): Make the inclusion of the rules below conditional also on
28757#line 4
28758# non-Treble devices. For now, on non-Treble device, always grant clients of a
28759#line 4
28760# HAL sufficient access to run the HAL in passthrough mode (i.e., in-process).
28761#line 4
28762
28763#line 4
28764
28765
28766#line 5
28767typeattribute wpantund netdomain;
28768#line 5
28769
28770
28771
28772#line 7
28773# Call the servicemanager and transfer references to it.
28774#line 7
28775allow wpantund servicemanager:binder { call transfer };
28776#line 7
28777# servicemanager performs getpidcon on clients.
28778#line 7
28779allow servicemanager wpantund:dir search;
28780#line 7
28781allow servicemanager wpantund:file { read open };
28782#line 7
28783allow servicemanager wpantund:process getattr;
28784#line 7
28785# rw access to /dev/binder and /dev/ashmem is presently granted to
28786#line 7
28787# all domains in domain.te.
28788#line 7
28789
28790
28791#line 8
28792# Call the server domain and optionally transfer references to it.
28793#line 8
28794allow wpantund system_server:binder { call transfer };
28795#line 8
28796# Allow the serverdomain to transfer references to the client on the reply.
28797#line 8
28798allow system_server wpantund:binder transfer;
28799#line 8
28800# Receive and use open files from the server.
28801#line 8
28802allow wpantund system_server:fd use;
28803#line 8
28804
28805
28806# wpantund needs to be able to check in with the lowpan_service
28807allow wpantund lowpan_service:service_manager find;
28808
28809# Allow wpantund to call any callbacks that have been registered with it.
28810# Generally, only privileged apps are able to register callbacks with
28811# wpantund, so we are limiting the scope for callbacks to only privileged
28812# apps. We also add shell to allow the command-line utility `lowpanctl`
28813# to work properly from `adb shell`.
28814allow wpantund {priv_app shell}:binder call;
28815
28816# create sockets to set interfaces up and down, add multicast groups, etc.
28817allow wpantund self:udp_socket { create { ioctl read getattr write setattr lock append bind connect getopt setopt shutdown map } };
28818
28819# setting interface state up/down and changing MTU are privileged ioctls
28820allowxperm wpantund self:udp_socket ioctl { 0x00008914 0x00008922 };
28821
28822# Allow us to bring up a TUN network interface.
28823allow wpantund tun_device:chr_file { { getattr open read ioctl lock map } { open append write lock map } };
28824allow wpantund self:{ capability cap_userns } { net_admin net_raw };
28825allow wpantund self:tun_socket create;
28826#line 1 "system/sepolicy/prebuilts/api/29.0/public/zygote.te"
28827# zygote
28828type zygote, domain;
28829type zygote_tmpfs, file_type;
28830type zygote_exec, system_file_type, exec_type, file_type;
28831#line 1 "system/sepolicy/reqd_mask/reqd_mask.te"
28832type reqd_mask_type;
28833#line 1 "system/sepolicy/reqd_mask/roles_decl"
28834role r;
28835#line 1 "system/sepolicy/prebuilts/api/29.0/public/roles"
28836role r types domain;
28837#line 1 "system/sepolicy/reqd_mask/roles"
28838role r types reqd_mask_type;
28839#line 1 "system/sepolicy/reqd_mask/users"
28840user u roles { r } level s0 range s0 - s0:c0.c1023;
28841#line 1 "system/sepolicy/reqd_mask/initial_sid_contexts"
28842sid reqd_mask u:r:reqd_mask_type:s0
28843