blob: 5d7dc2f080d2b5dd3640297749d42d980b89a5da [file] [log] [blame]
Inseob Kimbbae4a92020-03-19 17:49:08 +09001# Properties used only in /system
2system_internal_prop(adbd_prop)
David Anderson09bb9442020-11-13 00:45:59 -08003system_internal_prop(ctl_snapuserd_prop)
Yi Kong0ac00722020-10-27 02:29:52 +08004system_internal_prop(device_config_profcollect_native_boot_prop)
Tej Singhdd0988f2020-11-17 19:26:23 -08005system_internal_prop(device_config_statsd_native_prop)
6system_internal_prop(device_config_statsd_native_boot_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +09007system_internal_prop(device_config_storage_native_boot_prop)
8system_internal_prop(device_config_sys_traced_prop)
9system_internal_prop(device_config_window_manager_native_boot_prop)
10system_internal_prop(device_config_configuration_prop)
Xiao Ma2d6c9f02021-02-02 10:27:38 +000011system_internal_prop(device_config_connectivity_prop)
Nick Chalko81a4dd42021-02-11 09:12:51 -080012system_internal_prop(device_config_swcodec_native_prop)
Hongguang Chen91a5f4e2020-04-23 23:43:13 -070013system_internal_prop(fastbootd_protocol_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090014system_internal_prop(gsid_prop)
15system_internal_prop(init_perf_lsm_hooks_prop)
Inseob Kim15e5e0a2020-05-14 19:43:08 +090016system_internal_prop(init_service_status_private_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090017system_internal_prop(init_svc_debug_prop)
Paul Crowleyb0c55712021-02-23 08:40:05 -080018system_internal_prop(keystore_listen_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090019system_internal_prop(last_boot_reason_prop)
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +020020system_internal_prop(localization_prop)
Primiano Tuccicd452302020-10-09 09:15:10 +010021system_internal_prop(lower_kptr_restrict_prop)
Lorenzo Colitti082ebd22021-03-10 14:45:07 +090022system_internal_prop(net_464xlat_fromvendor_prop)
Lorenzo Colitti26d3d4a2021-03-10 15:31:36 +090023system_internal_prop(net_connectivity_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090024system_internal_prop(netd_stable_secret_prop)
25system_internal_prop(pm_prop)
JW Wang0f8cf042021-02-24 14:29:06 +080026system_internal_prop(rollback_test_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090027system_internal_prop(setupwizard_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090028system_internal_prop(system_adbd_prop)
Benjamin Schwartz3e4d97b2020-10-30 13:55:21 -070029system_internal_prop(suspend_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090030system_internal_prop(traced_perf_enabled_prop)
31system_internal_prop(userspace_reboot_log_prop)
32system_internal_prop(userspace_reboot_test_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090033system_internal_prop(verity_status_prop)
34system_internal_prop(zygote_wrap_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090035
Janis Danisevskis202e8632020-10-23 11:16:34 -070036# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
37system_internal_prop(keystore2_enable_prop)
38
Inseob Kim55e5c9b2020-03-04 17:20:35 +090039###
40### Neverallow rules
41###
42
43treble_sysprop_neverallow(`
44
Inseob Kimafc09932020-09-28 13:32:43 +090045enforce_sysprop_owner(`
46 neverallow domain {
47 property_type
48 -system_property_type
49 -product_property_type
50 -vendor_property_type
51 }:file no_rw_file_perms;
52')
Inseob Kim55e5c9b2020-03-04 17:20:35 +090053
54neverallow { domain -coredomain } {
55 system_property_type
56 system_internal_property_type
57 -system_restricted_property_type
58 -system_public_property_type
59}:file no_rw_file_perms;
60
61neverallow { domain -coredomain } {
62 system_property_type
63 -system_public_property_type
64}:property_service set;
65
66# init is in coredomain, but should be able to read/write all props.
67# dumpstate is also in coredomain, but should be able to read all props.
68neverallow { coredomain -init -dumpstate } {
69 vendor_property_type
70 vendor_internal_property_type
71 -vendor_restricted_property_type
72 -vendor_public_property_type
73}:file no_rw_file_perms;
74
75neverallow { coredomain -init } {
76 vendor_property_type
77 -vendor_public_property_type
78}:property_service set;
79
80')
81
82# There is no need to perform ioctl or advisory locking operations on
83# property files. If this neverallow is being triggered, it is
84# likely that the policy is using r_file_perms directly instead of
85# the get_prop() macro.
86neverallow domain property_type:file { ioctl lock };
87
88neverallow * {
89 core_property_type
90 -audio_prop
91 -config_prop
92 -cppreopt_prop
93 -dalvik_prop
94 -debuggerd_prop
95 -debug_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +090096 -dhcp_prop
97 -dumpstate_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +090098 -fingerprint_prop
99 -logd_prop
100 -net_radio_prop
101 -nfc_prop
102 -ota_prop
103 -pan_result_prop
104 -persist_debug_prop
105 -powerctl_prop
106 -radio_prop
107 -restorecon_prop
108 -shell_prop
109 -system_prop
Inseob Kimdc1e5012020-04-27 21:13:01 +0900110 -usb_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900111 -vold_prop
112}:file no_rw_file_perms;
113
114# sigstop property is only used for debugging; should only be set by su which is permissive
115# for userdebug/eng
116neverallow {
117 domain
118 -init
119 -vendor_init
120} ctl_sigstop_prop:property_service set;
121
122# Don't audit legacy ctl. property handling. We only want the newer permission check to appear
123# in the audit log
124dontaudit domain {
125 ctl_bootanim_prop
126 ctl_bugreport_prop
127 ctl_console_prop
128 ctl_default_prop
129 ctl_dumpstate_prop
130 ctl_fuse_prop
131 ctl_mdnsd_prop
132 ctl_rildaemon_prop
133}:property_service set;
134
135neverallow {
136 domain
137 -init
138} init_svc_debug_prop:property_service set;
139
140neverallow {
141 domain
142 -init
143 -dumpstate
144 userdebug_or_eng(`-su')
145} init_svc_debug_prop:file no_rw_file_perms;
146
147compatible_property_only(`
148# Prevent properties from being set
149 neverallow {
150 domain
151 -coredomain
152 -appdomain
153 -vendor_init
154 } {
155 core_property_type
156 extended_core_property_type
157 exported_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900158 exported_default_prop
159 exported_dumpstate_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900160 exported_system_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900161 exported3_system_prop
Inseob Kimdc1e5012020-04-27 21:13:01 +0900162 usb_control_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900163 -nfc_prop
164 -powerctl_prop
165 -radio_prop
166 }:property_service set;
167
168 neverallow {
169 domain
170 -coredomain
171 -appdomain
172 -hal_nfc_server
173 } {
174 nfc_prop
175 }:property_service set;
176
177 neverallow {
178 domain
179 -coredomain
180 -appdomain
181 -hal_telephony_server
182 -vendor_init
183 } {
Inseob Kimacd02fc2020-07-28 15:17:24 +0900184 radio_control_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900185 }:property_service set;
186
187 neverallow {
188 domain
189 -coredomain
190 -appdomain
191 -hal_telephony_server
192 } {
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900193 radio_prop
194 }:property_service set;
195
196 neverallow {
197 domain
198 -coredomain
199 -bluetooth
200 -hal_bluetooth_server
201 } {
202 bluetooth_prop
203 }:property_service set;
204
205 neverallow {
206 domain
207 -coredomain
208 -bluetooth
209 -hal_bluetooth_server
210 -vendor_init
211 } {
212 exported_bluetooth_prop
213 }:property_service set;
214
215 neverallow {
216 domain
217 -coredomain
218 -hal_camera_server
219 -cameraserver
220 -vendor_init
221 } {
222 exported_camera_prop
223 }:property_service set;
224
225 neverallow {
226 domain
227 -coredomain
228 -hal_wifi_server
229 -wificond
230 } {
231 wifi_prop
232 }:property_service set;
233
234 neverallow {
235 domain
Inseob Kim3dbf3d82020-06-25 21:20:42 +0900236 -init
237 -dumpstate
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900238 -hal_wifi_server
239 -wificond
240 -vendor_init
241 } {
Inseob Kim3dbf3d82020-06-25 21:20:42 +0900242 wifi_hal_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900243 }:property_service set;
244
245# Prevent properties from being read
246 neverallow {
247 domain
248 -coredomain
249 -appdomain
250 -vendor_init
251 } {
252 core_property_type
Inseob Kimd8c39d92020-04-20 19:36:33 +0900253 dalvik_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900254 extended_core_property_type
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900255 exported3_system_prop
Inseob Kimfd2d6ec2020-04-01 10:01:16 +0900256 systemsound_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900257 -debug_prop
258 -logd_prop
259 -nfc_prop
260 -powerctl_prop
261 -radio_prop
262 }:file no_rw_file_perms;
263
264 neverallow {
265 domain
266 -coredomain
267 -appdomain
268 -hal_nfc_server
269 } {
270 nfc_prop
271 }:file no_rw_file_perms;
272
273 neverallow {
274 domain
275 -coredomain
276 -appdomain
277 -hal_telephony_server
278 } {
279 radio_prop
280 }:file no_rw_file_perms;
281
282 neverallow {
283 domain
284 -coredomain
285 -bluetooth
286 -hal_bluetooth_server
287 } {
288 bluetooth_prop
289 }:file no_rw_file_perms;
290
291 neverallow {
292 domain
293 -coredomain
294 -hal_wifi_server
295 -wificond
296 } {
297 wifi_prop
298 }:file no_rw_file_perms;
Benjamin Schwartz3e4d97b2020-10-30 13:55:21 -0700299
300 neverallow {
301 domain
302 -init
303 } {
304 suspend_prop
305 }:property_service set;
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900306')
307
308compatible_property_only(`
309 # Neverallow coredomain to set vendor properties
310 neverallow {
311 coredomain
312 -init
313 -system_writes_vendor_properties_violators
314 } {
315 property_type
316 -system_property_type
317 -extended_core_property_type
318 }:property_service set;
319')
320
321neverallow {
Inseob Kimbfb37082020-04-27 23:49:15 +0900322 -coredomain
323 -vendor_init
324} {
325 ffs_config_prop
326 ffs_control_prop
327}:file no_rw_file_perms;
328
329neverallow {
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900330 -init
331 -system_server
332} {
333 userspace_reboot_log_prop
334}:property_service set;
335
336neverallow {
337 # Only allow init and system_server to set system_adbd_prop
338 -init
339 -system_server
340} {
341 system_adbd_prop
342}:property_service set;
343
Josh Gao0cac6fd2020-10-28 13:56:23 -0700344# Let (vendor_)init, adbd, and system_server set service.adb.tcp.port
345neverallow {
346 -init
347 -vendor_init
348 -adbd
349 -system_server
350} {
351 adbd_config_prop
352}:property_service set;
353
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900354neverallow {
355 # Only allow init and adbd to set adbd_prop
356 -init
357 -adbd
358} {
359 adbd_prop
360}:property_service set;
361
362neverallow {
363 # Only allow init and shell to set userspace_reboot_test_prop
364 -init
365 -shell
366} {
367 userspace_reboot_test_prop
368}:property_service set;
Inseob Kim721d9212020-04-24 21:25:17 +0900369
370neverallow {
371 -init
372 -system_server
373 -vendor_init
374} {
375 surfaceflinger_color_prop
376}:property_service set;
Inseob Kim9add20f2020-05-06 22:20:35 +0900377
378neverallow {
379 -init
380} {
381 libc_debug_prop
382}:property_service set;
Inseob Kim36aeb162020-05-08 20:42:25 +0900383
Mitch Phillipseaf14042020-12-03 17:23:06 -0800384# Allow the shell to set MTE props, so that non-root users with adb shell
385# access can control the settings on their device.
386neverallow {
387 -init
388 -shell
389} {
390 arm64_memtag_prop
391}:property_service set;
392
Inseob Kim36aeb162020-05-08 20:42:25 +0900393neverallow {
394 -init
395 -system_server
396 -vendor_init
397} zram_control_prop:property_service set;
Inseob Kim1337e152020-05-12 22:51:48 +0900398
399neverallow {
400 -init
401 -system_server
402 -vendor_init
403} dalvik_runtime_prop:property_service set;
Inseob Kimdc1e5012020-04-27 21:13:01 +0900404
405neverallow {
406 -coredomain
407 -vendor_init
408} {
409 usb_config_prop
410 usb_control_prop
411}:property_service set;
Inseob Kim3b82aec2020-05-14 01:38:40 +0900412
413neverallow {
414 -init
415 -system_server
416} {
417 provisioned_prop
418 retaildemo_prop
419}:property_service set;
420
421neverallow {
422 -coredomain
423 -vendor_init
424} {
425 provisioned_prop
426 retaildemo_prop
427}:file no_rw_file_perms;
Inseob Kim15e5e0a2020-05-14 19:43:08 +0900428
429neverallow {
430 -init
431} {
432 init_service_status_private_prop
433 init_service_status_prop
434}:property_service set;
Inseob Kimad631702020-05-14 21:47:43 +0900435
436neverallow {
437 -init
438 -radio
439 -appdomain
440 -hal_telephony_server
Inseob Kim285da2f2020-06-04 20:29:43 +0900441 not_compatible_property(`-vendor_init')
Inseob Kimad631702020-05-14 21:47:43 +0900442} telephony_status_prop:property_service set;
Peiyong Lin37dea072020-06-03 12:20:41 -0700443
444neverallow {
445 -init
446 -vendor_init
447} {
448 graphics_config_prop
449}:property_service set;
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900450
451neverallow {
Amy Hsu0f352fb2020-06-15 17:04:12 +0800452 -init
Midas Chien0d0391f2020-06-17 22:13:21 +0800453 -surfaceflinger
Amy Hsu0f352fb2020-06-15 17:04:12 +0800454} {
455 surfaceflinger_display_prop
456}:property_service set;
457
Inseob Kim072b0142020-06-16 20:00:41 +0900458neverallow {
Inseob Kim5eacf722020-07-01 01:27:49 +0900459 -coredomain
460 -appdomain
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900461 -vendor_init
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900462} packagemanager_config_prop:file no_rw_file_perms;
Inseob Kim04f435c2020-07-07 12:46:24 +0900463
464neverallow {
465 -coredomain
466 -vendor_init
467} keyguard_config_prop:file no_rw_file_perms;
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +0200468
469neverallow {
470 -init
471} {
472 localization_prop
473}:property_service set;
Inseob Kimc80b0242020-07-16 22:25:47 +0900474
475neverallow {
476 -init
477 -vendor_init
478 -dumpstate
479 -system_app
480} oem_unlock_prop:file no_rw_file_perms;
481
482neverallow {
483 -coredomain
484 -vendor_init
485} storagemanager_config_prop:file no_rw_file_perms;
486
487neverallow {
488 -init
489 -vendor_init
490 -dumpstate
491 -appdomain
492} sendbug_config_prop:file no_rw_file_perms;
Inseob Kimc97a97c2020-07-20 20:26:07 +0900493
494neverallow {
495 -init
496 -vendor_init
497 -dumpstate
498 -appdomain
499} camera_calibration_prop:file no_rw_file_perms;
Inseob Kim46dd4be2020-08-18 11:25:32 +0900500
501neverallow {
502 -init
503 -dumpstate
Jeff Vander Stoep684d25b2020-08-25 11:41:00 +0200504 -hal_dumpstate_server
Inseob Kim46dd4be2020-08-18 11:25:32 +0900505 not_compatible_property(`-vendor_init')
506} hal_dumpstate_config_prop:file no_rw_file_perms;
Primiano Tuccicd452302020-10-09 09:15:10 +0100507
508neverallow {
509 -init
510 userdebug_or_eng(`-traced_probes')
Florian Mayer167407d2020-11-11 11:01:36 +0000511 userdebug_or_eng(`-traced_perf')
Primiano Tuccicd452302020-10-09 09:15:10 +0100512} {
513 lower_kptr_restrict_prop
514}:property_service set;
Janis Danisevskis202e8632020-10-23 11:16:34 -0700515
516# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
517neverallow {
518 -init
519 -dumpstate
520 -system_app
521 -system_server
522 -zygote
523} keystore2_enable_prop:file no_rw_file_perms;
Inseob Kimd5a04482020-11-05 22:17:26 +0900524
525neverallow {
526 -init
527} zygote_wrap_prop:property_service set;
528
529neverallow {
530 -init
531} verity_status_prop:property_service set;
532
533neverallow {
534 -init
535} setupwizard_prop:property_service set;
Inseob Kim99855662020-11-12 22:21:51 +0900536
537# ro.product.property_source_order is useless after initialization of ro.product.* props.
538# So making it accessible only from init and vendor_init.
539neverallow {
540 -init
541 -dumpstate
542 -vendor_init
543} build_config_prop:file no_rw_file_perms;
Inseob Kim0cef0fe2020-11-17 13:54:52 +0900544
545neverallow {
546 -init
547 -shell
548} sqlite_log_prop:property_service set;
549
550neverallow {
551 -coredomain
552 -appdomain
553} sqlite_log_prop:file no_rw_file_perms;
Inseob Kim4c110ff2020-11-26 21:50:23 +0900554
Inseob Kim5c011e52021-01-14 04:08:16 +0000555neverallow {
556 -init
557} default_prop:property_service set;
558
Inseob Kim4c110ff2020-11-26 21:50:23 +0900559# Only one of system_property_type and vendor_property_type can be assigned.
560# Property types having both attributes won't be accessible from anywhere.
561neverallow domain system_and_vendor_property_type:{file property_service} *;
JW Wang0f8cf042021-02-24 14:29:06 +0800562
563neverallow {
564 # Only allow init and shell to set rollback_test_prop
565 -init
566 -shell
567} rollback_test_prop:property_service set;