blob: 1163a3c6a7266e9478c0cd89adcac7c8d19778ae [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)
Hongguang Chen91a5f4e2020-04-23 23:43:13 -070011system_internal_prop(fastbootd_protocol_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090012system_internal_prop(gsid_prop)
13system_internal_prop(init_perf_lsm_hooks_prop)
Inseob Kim15e5e0a2020-05-14 19:43:08 +090014system_internal_prop(init_service_status_private_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090015system_internal_prop(init_svc_debug_prop)
16system_internal_prop(last_boot_reason_prop)
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +020017system_internal_prop(localization_prop)
Primiano Tuccicd452302020-10-09 09:15:10 +010018system_internal_prop(lower_kptr_restrict_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090019system_internal_prop(netd_stable_secret_prop)
20system_internal_prop(pm_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090021system_internal_prop(setupwizard_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090022system_internal_prop(system_adbd_prop)
Benjamin Schwartz3e4d97b2020-10-30 13:55:21 -070023system_internal_prop(suspend_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090024system_internal_prop(traced_perf_enabled_prop)
25system_internal_prop(userspace_reboot_log_prop)
26system_internal_prop(userspace_reboot_test_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090027system_internal_prop(verity_status_prop)
28system_internal_prop(zygote_wrap_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090029
Janis Danisevskis202e8632020-10-23 11:16:34 -070030# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
31system_internal_prop(keystore2_enable_prop)
32
Inseob Kim55e5c9b2020-03-04 17:20:35 +090033###
34### Neverallow rules
35###
36
37treble_sysprop_neverallow(`
38
Inseob Kimafc09932020-09-28 13:32:43 +090039enforce_sysprop_owner(`
40 neverallow domain {
41 property_type
42 -system_property_type
43 -product_property_type
44 -vendor_property_type
45 }:file no_rw_file_perms;
46')
Inseob Kim55e5c9b2020-03-04 17:20:35 +090047
48neverallow { domain -coredomain } {
49 system_property_type
50 system_internal_property_type
51 -system_restricted_property_type
52 -system_public_property_type
53}:file no_rw_file_perms;
54
55neverallow { domain -coredomain } {
56 system_property_type
57 -system_public_property_type
58}:property_service set;
59
60# init is in coredomain, but should be able to read/write all props.
61# dumpstate is also in coredomain, but should be able to read all props.
62neverallow { coredomain -init -dumpstate } {
63 vendor_property_type
64 vendor_internal_property_type
65 -vendor_restricted_property_type
66 -vendor_public_property_type
67}:file no_rw_file_perms;
68
69neverallow { coredomain -init } {
70 vendor_property_type
71 -vendor_public_property_type
72}:property_service set;
73
74')
75
76# There is no need to perform ioctl or advisory locking operations on
77# property files. If this neverallow is being triggered, it is
78# likely that the policy is using r_file_perms directly instead of
79# the get_prop() macro.
80neverallow domain property_type:file { ioctl lock };
81
82neverallow * {
83 core_property_type
84 -audio_prop
85 -config_prop
86 -cppreopt_prop
87 -dalvik_prop
88 -debuggerd_prop
89 -debug_prop
90 -default_prop
91 -dhcp_prop
92 -dumpstate_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +090093 -fingerprint_prop
94 -logd_prop
95 -net_radio_prop
96 -nfc_prop
97 -ota_prop
98 -pan_result_prop
99 -persist_debug_prop
100 -powerctl_prop
101 -radio_prop
102 -restorecon_prop
103 -shell_prop
104 -system_prop
Inseob Kimdc1e5012020-04-27 21:13:01 +0900105 -usb_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900106 -vold_prop
107}:file no_rw_file_perms;
108
109# sigstop property is only used for debugging; should only be set by su which is permissive
110# for userdebug/eng
111neverallow {
112 domain
113 -init
114 -vendor_init
115} ctl_sigstop_prop:property_service set;
116
117# Don't audit legacy ctl. property handling. We only want the newer permission check to appear
118# in the audit log
119dontaudit domain {
120 ctl_bootanim_prop
121 ctl_bugreport_prop
122 ctl_console_prop
123 ctl_default_prop
124 ctl_dumpstate_prop
125 ctl_fuse_prop
126 ctl_mdnsd_prop
127 ctl_rildaemon_prop
128}:property_service set;
129
130neverallow {
131 domain
132 -init
133} init_svc_debug_prop:property_service set;
134
135neverallow {
136 domain
137 -init
138 -dumpstate
139 userdebug_or_eng(`-su')
140} init_svc_debug_prop:file no_rw_file_perms;
141
142compatible_property_only(`
143# Prevent properties from being set
144 neverallow {
145 domain
146 -coredomain
147 -appdomain
148 -vendor_init
149 } {
150 core_property_type
151 extended_core_property_type
152 exported_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900153 exported_default_prop
154 exported_dumpstate_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900155 exported_system_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900156 exported3_system_prop
Inseob Kimdc1e5012020-04-27 21:13:01 +0900157 usb_control_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900158 -nfc_prop
159 -powerctl_prop
160 -radio_prop
161 }:property_service set;
162
163 neverallow {
164 domain
165 -coredomain
166 -appdomain
167 -hal_nfc_server
168 } {
169 nfc_prop
170 }:property_service set;
171
172 neverallow {
173 domain
174 -coredomain
175 -appdomain
176 -hal_telephony_server
177 -vendor_init
178 } {
Inseob Kimacd02fc2020-07-28 15:17:24 +0900179 radio_control_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900180 }:property_service set;
181
182 neverallow {
183 domain
184 -coredomain
185 -appdomain
186 -hal_telephony_server
187 } {
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900188 radio_prop
189 }:property_service set;
190
191 neverallow {
192 domain
193 -coredomain
194 -bluetooth
195 -hal_bluetooth_server
196 } {
197 bluetooth_prop
198 }:property_service set;
199
200 neverallow {
201 domain
202 -coredomain
203 -bluetooth
204 -hal_bluetooth_server
205 -vendor_init
206 } {
207 exported_bluetooth_prop
208 }:property_service set;
209
210 neverallow {
211 domain
212 -coredomain
213 -hal_camera_server
214 -cameraserver
215 -vendor_init
216 } {
217 exported_camera_prop
218 }:property_service set;
219
220 neverallow {
221 domain
222 -coredomain
223 -hal_wifi_server
224 -wificond
225 } {
226 wifi_prop
227 }:property_service set;
228
229 neverallow {
230 domain
Inseob Kim3dbf3d82020-06-25 21:20:42 +0900231 -init
232 -dumpstate
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900233 -hal_wifi_server
234 -wificond
235 -vendor_init
236 } {
Inseob Kim3dbf3d82020-06-25 21:20:42 +0900237 wifi_hal_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900238 }:property_service set;
239
240# Prevent properties from being read
241 neverallow {
242 domain
243 -coredomain
244 -appdomain
245 -vendor_init
246 } {
247 core_property_type
Inseob Kimd8c39d92020-04-20 19:36:33 +0900248 dalvik_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900249 extended_core_property_type
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900250 exported3_system_prop
Inseob Kimfd2d6ec2020-04-01 10:01:16 +0900251 systemsound_config_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900252 -debug_prop
253 -logd_prop
254 -nfc_prop
255 -powerctl_prop
256 -radio_prop
257 }:file no_rw_file_perms;
258
259 neverallow {
260 domain
261 -coredomain
262 -appdomain
263 -hal_nfc_server
264 } {
265 nfc_prop
266 }:file no_rw_file_perms;
267
268 neverallow {
269 domain
270 -coredomain
271 -appdomain
272 -hal_telephony_server
273 } {
274 radio_prop
275 }:file no_rw_file_perms;
276
277 neverallow {
278 domain
279 -coredomain
280 -bluetooth
281 -hal_bluetooth_server
282 } {
283 bluetooth_prop
284 }:file no_rw_file_perms;
285
286 neverallow {
287 domain
288 -coredomain
289 -hal_wifi_server
290 -wificond
291 } {
292 wifi_prop
293 }:file no_rw_file_perms;
Benjamin Schwartz3e4d97b2020-10-30 13:55:21 -0700294
295 neverallow {
296 domain
297 -init
298 } {
299 suspend_prop
300 }:property_service set;
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900301')
302
303compatible_property_only(`
304 # Neverallow coredomain to set vendor properties
305 neverallow {
306 coredomain
307 -init
308 -system_writes_vendor_properties_violators
309 } {
310 property_type
311 -system_property_type
312 -extended_core_property_type
313 }:property_service set;
314')
315
316neverallow {
Inseob Kimbfb37082020-04-27 23:49:15 +0900317 -coredomain
318 -vendor_init
319} {
320 ffs_config_prop
321 ffs_control_prop
322}:file no_rw_file_perms;
323
324neverallow {
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900325 -init
326 -system_server
327} {
328 userspace_reboot_log_prop
329}:property_service set;
330
331neverallow {
332 # Only allow init and system_server to set system_adbd_prop
333 -init
334 -system_server
335} {
336 system_adbd_prop
337}:property_service set;
338
Josh Gao0cac6fd2020-10-28 13:56:23 -0700339# Let (vendor_)init, adbd, and system_server set service.adb.tcp.port
340neverallow {
341 -init
342 -vendor_init
343 -adbd
344 -system_server
345} {
346 adbd_config_prop
347}:property_service set;
348
Inseob Kim55e5c9b2020-03-04 17:20:35 +0900349neverallow {
350 # Only allow init and adbd to set adbd_prop
351 -init
352 -adbd
353} {
354 adbd_prop
355}:property_service set;
356
357neverallow {
358 # Only allow init and shell to set userspace_reboot_test_prop
359 -init
360 -shell
361} {
362 userspace_reboot_test_prop
363}:property_service set;
Inseob Kim721d9212020-04-24 21:25:17 +0900364
365neverallow {
366 -init
367 -system_server
368 -vendor_init
369} {
370 surfaceflinger_color_prop
371}:property_service set;
Inseob Kim9add20f2020-05-06 22:20:35 +0900372
373neverallow {
374 -init
375} {
376 libc_debug_prop
377}:property_service set;
Inseob Kim36aeb162020-05-08 20:42:25 +0900378
379neverallow {
380 -init
381 -system_server
382 -vendor_init
383} zram_control_prop:property_service set;
Inseob Kim1337e152020-05-12 22:51:48 +0900384
385neverallow {
386 -init
387 -system_server
388 -vendor_init
389} dalvik_runtime_prop:property_service set;
Inseob Kimdc1e5012020-04-27 21:13:01 +0900390
391neverallow {
392 -coredomain
393 -vendor_init
394} {
395 usb_config_prop
396 usb_control_prop
397}:property_service set;
Inseob Kim3b82aec2020-05-14 01:38:40 +0900398
399neverallow {
400 -init
401 -system_server
402} {
403 provisioned_prop
404 retaildemo_prop
405}:property_service set;
406
407neverallow {
408 -coredomain
409 -vendor_init
410} {
411 provisioned_prop
412 retaildemo_prop
413}:file no_rw_file_perms;
Inseob Kim15e5e0a2020-05-14 19:43:08 +0900414
415neverallow {
416 -init
417} {
418 init_service_status_private_prop
419 init_service_status_prop
420}:property_service set;
Inseob Kimad631702020-05-14 21:47:43 +0900421
422neverallow {
423 -init
424 -radio
425 -appdomain
426 -hal_telephony_server
Inseob Kim285da2f2020-06-04 20:29:43 +0900427 not_compatible_property(`-vendor_init')
Inseob Kimad631702020-05-14 21:47:43 +0900428} telephony_status_prop:property_service set;
Peiyong Lin37dea072020-06-03 12:20:41 -0700429
430neverallow {
431 -init
432 -vendor_init
433} {
434 graphics_config_prop
435}:property_service set;
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900436
437neverallow {
Amy Hsu0f352fb2020-06-15 17:04:12 +0800438 -init
Midas Chien0d0391f2020-06-17 22:13:21 +0800439 -surfaceflinger
Amy Hsu0f352fb2020-06-15 17:04:12 +0800440} {
441 surfaceflinger_display_prop
442}:property_service set;
443
Inseob Kim072b0142020-06-16 20:00:41 +0900444neverallow {
Inseob Kim5eacf722020-07-01 01:27:49 +0900445 -coredomain
446 -appdomain
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900447 -vendor_init
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900448} packagemanager_config_prop:file no_rw_file_perms;
Inseob Kim04f435c2020-07-07 12:46:24 +0900449
450neverallow {
451 -coredomain
452 -vendor_init
453} keyguard_config_prop:file no_rw_file_perms;
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +0200454
455neverallow {
456 -init
457} {
458 localization_prop
459}:property_service set;
Inseob Kimc80b0242020-07-16 22:25:47 +0900460
461neverallow {
462 -init
463 -vendor_init
464 -dumpstate
465 -system_app
466} oem_unlock_prop:file no_rw_file_perms;
467
468neverallow {
469 -coredomain
470 -vendor_init
471} storagemanager_config_prop:file no_rw_file_perms;
472
473neverallow {
474 -init
475 -vendor_init
476 -dumpstate
477 -appdomain
478} sendbug_config_prop:file no_rw_file_perms;
Inseob Kimc97a97c2020-07-20 20:26:07 +0900479
480neverallow {
481 -init
482 -vendor_init
483 -dumpstate
484 -appdomain
485} camera_calibration_prop:file no_rw_file_perms;
Inseob Kim46dd4be2020-08-18 11:25:32 +0900486
487neverallow {
488 -init
489 -dumpstate
Jeff Vander Stoep684d25b2020-08-25 11:41:00 +0200490 -hal_dumpstate_server
Inseob Kim46dd4be2020-08-18 11:25:32 +0900491 not_compatible_property(`-vendor_init')
492} hal_dumpstate_config_prop:file no_rw_file_perms;
Primiano Tuccicd452302020-10-09 09:15:10 +0100493
494neverallow {
495 -init
496 userdebug_or_eng(`-traced_probes')
Florian Mayer167407d2020-11-11 11:01:36 +0000497 userdebug_or_eng(`-traced_perf')
Primiano Tuccicd452302020-10-09 09:15:10 +0100498} {
499 lower_kptr_restrict_prop
500}:property_service set;
Janis Danisevskis202e8632020-10-23 11:16:34 -0700501
502# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
503neverallow {
504 -init
505 -dumpstate
506 -system_app
507 -system_server
508 -zygote
509} keystore2_enable_prop:file no_rw_file_perms;
Inseob Kimd5a04482020-11-05 22:17:26 +0900510
511neverallow {
512 -init
513} zygote_wrap_prop:property_service set;
514
515neverallow {
516 -init
517} verity_status_prop:property_service set;
518
519neverallow {
520 -init
521} setupwizard_prop:property_service set;
Inseob Kim99855662020-11-12 22:21:51 +0900522
523# ro.product.property_source_order is useless after initialization of ro.product.* props.
524# So making it accessible only from init and vendor_init.
525neverallow {
526 -init
527 -dumpstate
528 -vendor_init
529} build_config_prop:file no_rw_file_perms;
Inseob Kim0cef0fe2020-11-17 13:54:52 +0900530
531neverallow {
532 -init
533 -shell
534} sqlite_log_prop:property_service set;
535
536neverallow {
537 -coredomain
538 -appdomain
539} sqlite_log_prop:file no_rw_file_perms;
Inseob Kim4c110ff2020-11-26 21:50:23 +0900540
541# Only one of system_property_type and vendor_property_type can be assigned.
542# Property types having both attributes won't be accessible from anywhere.
543neverallow domain system_and_vendor_property_type:{file property_service} *;