blob: f36eb0dcf766259df983ce63166300feeaad0751 [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)
18system_internal_prop(last_boot_reason_prop)
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +020019system_internal_prop(localization_prop)
Primiano Tuccicd452302020-10-09 09:15:10 +010020system_internal_prop(lower_kptr_restrict_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090021system_internal_prop(netd_stable_secret_prop)
22system_internal_prop(pm_prop)
JW Wang0f8cf042021-02-24 14:29:06 +080023system_internal_prop(rollback_test_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090024system_internal_prop(setupwizard_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090025system_internal_prop(system_adbd_prop)
Benjamin Schwartz3e4d97b2020-10-30 13:55:21 -070026system_internal_prop(suspend_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090027system_internal_prop(traced_perf_enabled_prop)
28system_internal_prop(userspace_reboot_log_prop)
29system_internal_prop(userspace_reboot_test_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090030system_internal_prop(verity_status_prop)
31system_internal_prop(zygote_wrap_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090032
Janis Danisevskis202e8632020-10-23 11:16:34 -070033# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
34system_internal_prop(keystore2_enable_prop)
35
Inseob Kim55e5c9b2020-03-04 17:20:35 +090036###
37### Neverallow rules
38###
39
40treble_sysprop_neverallow(`
41
Inseob Kimafc09932020-09-28 13:32:43 +090042enforce_sysprop_owner(`
43 neverallow domain {
44 property_type
45 -system_property_type
46 -product_property_type
47 -vendor_property_type
48 }:file no_rw_file_perms;
49')
Inseob Kim55e5c9b2020-03-04 17:20:35 +090050
51neverallow { domain -coredomain } {
52 system_property_type
53 system_internal_property_type
54 -system_restricted_property_type
55 -system_public_property_type
56}:file no_rw_file_perms;
57
58neverallow { domain -coredomain } {
59 system_property_type
60 -system_public_property_type
61}:property_service set;
62
63# init is in coredomain, but should be able to read/write all props.
64# dumpstate is also in coredomain, but should be able to read all props.
65neverallow { coredomain -init -dumpstate } {
66 vendor_property_type
67 vendor_internal_property_type
68 -vendor_restricted_property_type
69 -vendor_public_property_type
70}:file no_rw_file_perms;
71
72neverallow { coredomain -init } {
73 vendor_property_type
74 -vendor_public_property_type
75}:property_service set;
76
77')
78
79# There is no need to perform ioctl or advisory locking operations on
80# property files. If this neverallow is being triggered, it is
81# likely that the policy is using r_file_perms directly instead of
82# the get_prop() macro.
83neverallow domain property_type:file { ioctl lock };
84
85neverallow * {
86 core_property_type
87 -audio_prop
88 -config_prop
89 -cppreopt_prop
90 -dalvik_prop
91 -debuggerd_prop
92 -debug_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +090093 -dhcp_prop
94 -dumpstate_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +090095 -fingerprint_prop
96 -logd_prop
97 -net_radio_prop
98 -nfc_prop
99 -ota_prop
100 -pan_result_prop
101 -persist_debug_prop
102 -powerctl_prop
103 -radio_prop
104 -restorecon_prop
105 -shell_prop
106 -system_prop
Inseob Kimdc1e5012020-04-27 21:13:01 +0900107 -usb_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900108 -vold_prop
109}:file no_rw_file_perms;
110
111# sigstop property is only used for debugging; should only be set by su which is permissive
112# for userdebug/eng
113neverallow {
114 domain
115 -init
116 -vendor_init
117} ctl_sigstop_prop:property_service set;
118
119# Don't audit legacy ctl. property handling. We only want the newer permission check to appear
120# in the audit log
121dontaudit domain {
122 ctl_bootanim_prop
123 ctl_bugreport_prop
124 ctl_console_prop
125 ctl_default_prop
126 ctl_dumpstate_prop
127 ctl_fuse_prop
128 ctl_mdnsd_prop
129 ctl_rildaemon_prop
130}:property_service set;
131
132neverallow {
133 domain
134 -init
135} init_svc_debug_prop:property_service set;
136
137neverallow {
138 domain
139 -init
140 -dumpstate
141 userdebug_or_eng(`-su')
142} init_svc_debug_prop:file no_rw_file_perms;
143
144compatible_property_only(`
145# Prevent properties from being set
146 neverallow {
147 domain
148 -coredomain
149 -appdomain
150 -vendor_init
151 } {
152 core_property_type
153 extended_core_property_type
154 exported_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900155 exported_default_prop
156 exported_dumpstate_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900157 exported_system_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900158 exported3_system_prop
Inseob Kimdc1e5012020-04-27 21:13:01 +0900159 usb_control_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900160 -nfc_prop
161 -powerctl_prop
162 -radio_prop
163 }:property_service set;
164
165 neverallow {
166 domain
167 -coredomain
168 -appdomain
169 -hal_nfc_server
170 } {
171 nfc_prop
172 }:property_service set;
173
174 neverallow {
175 domain
176 -coredomain
177 -appdomain
178 -hal_telephony_server
179 -vendor_init
180 } {
Inseob Kimacd02fc2020-07-28 15:17:24 +0900181 radio_control_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900182 }:property_service set;
183
184 neverallow {
185 domain
186 -coredomain
187 -appdomain
188 -hal_telephony_server
189 } {
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900190 radio_prop
191 }:property_service set;
192
193 neverallow {
194 domain
195 -coredomain
196 -bluetooth
197 -hal_bluetooth_server
198 } {
199 bluetooth_prop
200 }:property_service set;
201
202 neverallow {
203 domain
204 -coredomain
205 -bluetooth
206 -hal_bluetooth_server
207 -vendor_init
208 } {
209 exported_bluetooth_prop
210 }:property_service set;
211
212 neverallow {
213 domain
214 -coredomain
215 -hal_camera_server
216 -cameraserver
217 -vendor_init
218 } {
219 exported_camera_prop
220 }:property_service set;
221
222 neverallow {
223 domain
224 -coredomain
225 -hal_wifi_server
226 -wificond
227 } {
228 wifi_prop
229 }:property_service set;
230
231 neverallow {
232 domain
Inseob Kim3dbf3d82020-06-25 21:20:42 +0900233 -init
234 -dumpstate
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900235 -hal_wifi_server
236 -wificond
237 -vendor_init
238 } {
Inseob Kim3dbf3d82020-06-25 21:20:42 +0900239 wifi_hal_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900240 }:property_service set;
241
242# Prevent properties from being read
243 neverallow {
244 domain
245 -coredomain
246 -appdomain
247 -vendor_init
248 } {
249 core_property_type
Inseob Kimd8c39d92020-04-20 19:36:33 +0900250 dalvik_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900251 extended_core_property_type
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900252 exported3_system_prop
Inseob Kimfd2d6ec2020-04-01 10:01:16 +0900253 systemsound_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900254 -debug_prop
255 -logd_prop
256 -nfc_prop
257 -powerctl_prop
258 -radio_prop
259 }:file no_rw_file_perms;
260
261 neverallow {
262 domain
263 -coredomain
264 -appdomain
265 -hal_nfc_server
266 } {
267 nfc_prop
268 }:file no_rw_file_perms;
269
270 neverallow {
271 domain
272 -coredomain
273 -appdomain
274 -hal_telephony_server
275 } {
276 radio_prop
277 }:file no_rw_file_perms;
278
279 neverallow {
280 domain
281 -coredomain
282 -bluetooth
283 -hal_bluetooth_server
284 } {
285 bluetooth_prop
286 }:file no_rw_file_perms;
287
288 neverallow {
289 domain
290 -coredomain
291 -hal_wifi_server
292 -wificond
293 } {
294 wifi_prop
295 }:file no_rw_file_perms;
Benjamin Schwartz3e4d97b2020-10-30 13:55:21 -0700296
297 neverallow {
298 domain
299 -init
300 } {
301 suspend_prop
302 }:property_service set;
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900303')
304
305compatible_property_only(`
306 # Neverallow coredomain to set vendor properties
307 neverallow {
308 coredomain
309 -init
310 -system_writes_vendor_properties_violators
311 } {
312 property_type
313 -system_property_type
314 -extended_core_property_type
315 }:property_service set;
316')
317
318neverallow {
Inseob Kimbfb37082020-04-27 23:49:15 +0900319 -coredomain
320 -vendor_init
321} {
322 ffs_config_prop
323 ffs_control_prop
324}:file no_rw_file_perms;
325
326neverallow {
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900327 -init
328 -system_server
329} {
330 userspace_reboot_log_prop
331}:property_service set;
332
333neverallow {
334 # Only allow init and system_server to set system_adbd_prop
335 -init
336 -system_server
337} {
338 system_adbd_prop
339}:property_service set;
340
Josh Gao0cac6fd2020-10-28 13:56:23 -0700341# Let (vendor_)init, adbd, and system_server set service.adb.tcp.port
342neverallow {
343 -init
344 -vendor_init
345 -adbd
346 -system_server
347} {
348 adbd_config_prop
349}:property_service set;
350
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900351neverallow {
352 # Only allow init and adbd to set adbd_prop
353 -init
354 -adbd
355} {
356 adbd_prop
357}:property_service set;
358
359neverallow {
360 # Only allow init and shell to set userspace_reboot_test_prop
361 -init
362 -shell
363} {
364 userspace_reboot_test_prop
365}:property_service set;
Inseob Kim721d9212020-04-24 21:25:17 +0900366
367neverallow {
368 -init
369 -system_server
370 -vendor_init
371} {
372 surfaceflinger_color_prop
373}:property_service set;
Inseob Kim9add20f2020-05-06 22:20:35 +0900374
375neverallow {
376 -init
377} {
378 libc_debug_prop
379}:property_service set;
Inseob Kim36aeb162020-05-08 20:42:25 +0900380
Mitch Phillipseaf14042020-12-03 17:23:06 -0800381# Allow the shell to set MTE props, so that non-root users with adb shell
382# access can control the settings on their device.
383neverallow {
384 -init
385 -shell
386} {
387 arm64_memtag_prop
388}:property_service set;
389
Inseob Kim36aeb162020-05-08 20:42:25 +0900390neverallow {
391 -init
392 -system_server
393 -vendor_init
394} zram_control_prop:property_service set;
Inseob Kim1337e152020-05-12 22:51:48 +0900395
396neverallow {
397 -init
398 -system_server
399 -vendor_init
400} dalvik_runtime_prop:property_service set;
Inseob Kimdc1e5012020-04-27 21:13:01 +0900401
402neverallow {
403 -coredomain
404 -vendor_init
405} {
406 usb_config_prop
407 usb_control_prop
408}:property_service set;
Inseob Kim3b82aec2020-05-14 01:38:40 +0900409
410neverallow {
411 -init
412 -system_server
413} {
414 provisioned_prop
415 retaildemo_prop
416}:property_service set;
417
418neverallow {
419 -coredomain
420 -vendor_init
421} {
422 provisioned_prop
423 retaildemo_prop
424}:file no_rw_file_perms;
Inseob Kim15e5e0a2020-05-14 19:43:08 +0900425
426neverallow {
427 -init
428} {
429 init_service_status_private_prop
430 init_service_status_prop
431}:property_service set;
Inseob Kimad631702020-05-14 21:47:43 +0900432
433neverallow {
434 -init
435 -radio
436 -appdomain
437 -hal_telephony_server
Inseob Kim285da2f2020-06-04 20:29:43 +0900438 not_compatible_property(`-vendor_init')
Inseob Kimad631702020-05-14 21:47:43 +0900439} telephony_status_prop:property_service set;
Peiyong Lin37dea072020-06-03 12:20:41 -0700440
441neverallow {
442 -init
443 -vendor_init
444} {
445 graphics_config_prop
446}:property_service set;
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900447
448neverallow {
Amy Hsu0f352fb2020-06-15 17:04:12 +0800449 -init
Midas Chien0d0391f2020-06-17 22:13:21 +0800450 -surfaceflinger
Amy Hsu0f352fb2020-06-15 17:04:12 +0800451} {
452 surfaceflinger_display_prop
453}:property_service set;
454
Inseob Kim072b0142020-06-16 20:00:41 +0900455neverallow {
Inseob Kim5eacf722020-07-01 01:27:49 +0900456 -coredomain
457 -appdomain
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900458 -vendor_init
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900459} packagemanager_config_prop:file no_rw_file_perms;
Inseob Kim04f435c2020-07-07 12:46:24 +0900460
461neverallow {
462 -coredomain
463 -vendor_init
464} keyguard_config_prop:file no_rw_file_perms;
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +0200465
466neverallow {
467 -init
468} {
469 localization_prop
470}:property_service set;
Inseob Kimc80b0242020-07-16 22:25:47 +0900471
472neverallow {
473 -init
474 -vendor_init
475 -dumpstate
476 -system_app
477} oem_unlock_prop:file no_rw_file_perms;
478
479neverallow {
480 -coredomain
481 -vendor_init
482} storagemanager_config_prop:file no_rw_file_perms;
483
484neverallow {
485 -init
486 -vendor_init
487 -dumpstate
488 -appdomain
489} sendbug_config_prop:file no_rw_file_perms;
Inseob Kimc97a97c2020-07-20 20:26:07 +0900490
491neverallow {
492 -init
493 -vendor_init
494 -dumpstate
495 -appdomain
496} camera_calibration_prop:file no_rw_file_perms;
Inseob Kim46dd4be2020-08-18 11:25:32 +0900497
498neverallow {
499 -init
500 -dumpstate
Jeff Vander Stoep684d25b2020-08-25 11:41:00 +0200501 -hal_dumpstate_server
Inseob Kim46dd4be2020-08-18 11:25:32 +0900502 not_compatible_property(`-vendor_init')
503} hal_dumpstate_config_prop:file no_rw_file_perms;
Primiano Tuccicd452302020-10-09 09:15:10 +0100504
505neverallow {
506 -init
507 userdebug_or_eng(`-traced_probes')
Florian Mayer167407d2020-11-11 11:01:36 +0000508 userdebug_or_eng(`-traced_perf')
Primiano Tuccicd452302020-10-09 09:15:10 +0100509} {
510 lower_kptr_restrict_prop
511}:property_service set;
Janis Danisevskis202e8632020-10-23 11:16:34 -0700512
513# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
514neverallow {
515 -init
516 -dumpstate
517 -system_app
518 -system_server
519 -zygote
520} keystore2_enable_prop:file no_rw_file_perms;
Inseob Kimd5a04482020-11-05 22:17:26 +0900521
522neverallow {
523 -init
524} zygote_wrap_prop:property_service set;
525
526neverallow {
527 -init
528} verity_status_prop:property_service set;
529
530neverallow {
531 -init
532} setupwizard_prop:property_service set;
Inseob Kim99855662020-11-12 22:21:51 +0900533
534# ro.product.property_source_order is useless after initialization of ro.product.* props.
535# So making it accessible only from init and vendor_init.
536neverallow {
537 -init
538 -dumpstate
539 -vendor_init
540} build_config_prop:file no_rw_file_perms;
Inseob Kim0cef0fe2020-11-17 13:54:52 +0900541
542neverallow {
543 -init
544 -shell
545} sqlite_log_prop:property_service set;
546
547neverallow {
548 -coredomain
549 -appdomain
550} sqlite_log_prop:file no_rw_file_perms;
Inseob Kim4c110ff2020-11-26 21:50:23 +0900551
Inseob Kim5c011e52021-01-14 04:08:16 +0000552neverallow {
553 -init
554} default_prop:property_service set;
555
Inseob Kim4c110ff2020-11-26 21:50:23 +0900556# Only one of system_property_type and vendor_property_type can be assigned.
557# Property types having both attributes won't be accessible from anywhere.
558neverallow domain system_and_vendor_property_type:{file property_service} *;
JW Wang0f8cf042021-02-24 14:29:06 +0800559
560neverallow {
561 # Only allow init and shell to set rollback_test_prop
562 -init
563 -shell
564} rollback_test_prop:property_service set;