blob: 5dc75b8b97152cf9b36bf8c3e4e18a5da2b96acd [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)
Hongguang Chen91a5f4e2020-04-23 23:43:13 -070012system_internal_prop(fastbootd_protocol_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090013system_internal_prop(gsid_prop)
14system_internal_prop(init_perf_lsm_hooks_prop)
Inseob Kim15e5e0a2020-05-14 19:43:08 +090015system_internal_prop(init_service_status_private_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090016system_internal_prop(init_svc_debug_prop)
17system_internal_prop(last_boot_reason_prop)
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +020018system_internal_prop(localization_prop)
Primiano Tuccicd452302020-10-09 09:15:10 +010019system_internal_prop(lower_kptr_restrict_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090020system_internal_prop(netd_stable_secret_prop)
21system_internal_prop(pm_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090022system_internal_prop(setupwizard_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090023system_internal_prop(system_adbd_prop)
Benjamin Schwartz3e4d97b2020-10-30 13:55:21 -070024system_internal_prop(suspend_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090025system_internal_prop(traced_perf_enabled_prop)
26system_internal_prop(userspace_reboot_log_prop)
27system_internal_prop(userspace_reboot_test_prop)
Inseob Kimd5a04482020-11-05 22:17:26 +090028system_internal_prop(verity_status_prop)
29system_internal_prop(zygote_wrap_prop)
Inseob Kimbbae4a92020-03-19 17:49:08 +090030
Janis Danisevskis202e8632020-10-23 11:16:34 -070031# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
32system_internal_prop(keystore2_enable_prop)
33
Inseob Kim55e5c9b2020-03-04 17:20:35 +090034###
35### Neverallow rules
36###
37
38treble_sysprop_neverallow(`
39
Inseob Kimafc09932020-09-28 13:32:43 +090040enforce_sysprop_owner(`
41 neverallow domain {
42 property_type
43 -system_property_type
44 -product_property_type
45 -vendor_property_type
46 }:file no_rw_file_perms;
47')
Inseob Kim55e5c9b2020-03-04 17:20:35 +090048
49neverallow { domain -coredomain } {
50 system_property_type
51 system_internal_property_type
52 -system_restricted_property_type
53 -system_public_property_type
54}:file no_rw_file_perms;
55
56neverallow { domain -coredomain } {
57 system_property_type
58 -system_public_property_type
59}:property_service set;
60
61# init is in coredomain, but should be able to read/write all props.
62# dumpstate is also in coredomain, but should be able to read all props.
63neverallow { coredomain -init -dumpstate } {
64 vendor_property_type
65 vendor_internal_property_type
66 -vendor_restricted_property_type
67 -vendor_public_property_type
68}:file no_rw_file_perms;
69
70neverallow { coredomain -init } {
71 vendor_property_type
72 -vendor_public_property_type
73}:property_service set;
74
75')
76
77# There is no need to perform ioctl or advisory locking operations on
78# property files. If this neverallow is being triggered, it is
79# likely that the policy is using r_file_perms directly instead of
80# the get_prop() macro.
81neverallow domain property_type:file { ioctl lock };
82
83neverallow * {
84 core_property_type
85 -audio_prop
86 -config_prop
87 -cppreopt_prop
88 -dalvik_prop
89 -debuggerd_prop
90 -debug_prop
Inseob Kim55e5c9b2020-03-04 17:20:35 +090091 -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
Mitch Phillipseaf14042020-12-03 17:23:06 -0800379# Allow the shell to set MTE props, so that non-root users with adb shell
380# access can control the settings on their device.
381neverallow {
382 -init
383 -shell
384} {
385 arm64_memtag_prop
386}:property_service set;
387
Inseob Kim36aeb162020-05-08 20:42:25 +0900388neverallow {
389 -init
390 -system_server
391 -vendor_init
392} zram_control_prop:property_service set;
Inseob Kim1337e152020-05-12 22:51:48 +0900393
394neverallow {
395 -init
396 -system_server
397 -vendor_init
398} dalvik_runtime_prop:property_service set;
Inseob Kimdc1e5012020-04-27 21:13:01 +0900399
400neverallow {
401 -coredomain
402 -vendor_init
403} {
404 usb_config_prop
405 usb_control_prop
406}:property_service set;
Inseob Kim3b82aec2020-05-14 01:38:40 +0900407
408neverallow {
409 -init
410 -system_server
411} {
412 provisioned_prop
413 retaildemo_prop
414}:property_service set;
415
416neverallow {
417 -coredomain
418 -vendor_init
419} {
420 provisioned_prop
421 retaildemo_prop
422}:file no_rw_file_perms;
Inseob Kim15e5e0a2020-05-14 19:43:08 +0900423
424neverallow {
425 -init
426} {
427 init_service_status_private_prop
428 init_service_status_prop
429}:property_service set;
Inseob Kimad631702020-05-14 21:47:43 +0900430
431neverallow {
432 -init
433 -radio
434 -appdomain
435 -hal_telephony_server
Inseob Kim285da2f2020-06-04 20:29:43 +0900436 not_compatible_property(`-vendor_init')
Inseob Kimad631702020-05-14 21:47:43 +0900437} telephony_status_prop:property_service set;
Peiyong Lin37dea072020-06-03 12:20:41 -0700438
439neverallow {
440 -init
441 -vendor_init
442} {
443 graphics_config_prop
444}:property_service set;
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900445
446neverallow {
Amy Hsu0f352fb2020-06-15 17:04:12 +0800447 -init
Midas Chien0d0391f2020-06-17 22:13:21 +0800448 -surfaceflinger
Amy Hsu0f352fb2020-06-15 17:04:12 +0800449} {
450 surfaceflinger_display_prop
451}:property_service set;
452
Inseob Kim072b0142020-06-16 20:00:41 +0900453neverallow {
Inseob Kim5eacf722020-07-01 01:27:49 +0900454 -coredomain
455 -appdomain
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900456 -vendor_init
Inseob Kim6ffdf1b2020-06-16 20:00:41 +0900457} packagemanager_config_prop:file no_rw_file_perms;
Inseob Kim04f435c2020-07-07 12:46:24 +0900458
459neverallow {
460 -coredomain
461 -vendor_init
462} keyguard_config_prop:file no_rw_file_perms;
Alexander Mishkovetsf0be89b2020-07-08 23:11:03 +0200463
464neverallow {
465 -init
466} {
467 localization_prop
468}:property_service set;
Inseob Kimc80b0242020-07-16 22:25:47 +0900469
470neverallow {
471 -init
472 -vendor_init
473 -dumpstate
474 -system_app
475} oem_unlock_prop:file no_rw_file_perms;
476
477neverallow {
478 -coredomain
479 -vendor_init
480} storagemanager_config_prop:file no_rw_file_perms;
481
482neverallow {
483 -init
484 -vendor_init
485 -dumpstate
486 -appdomain
487} sendbug_config_prop:file no_rw_file_perms;
Inseob Kimc97a97c2020-07-20 20:26:07 +0900488
489neverallow {
490 -init
491 -vendor_init
492 -dumpstate
493 -appdomain
494} camera_calibration_prop:file no_rw_file_perms;
Inseob Kim46dd4be2020-08-18 11:25:32 +0900495
496neverallow {
497 -init
498 -dumpstate
Jeff Vander Stoep684d25b2020-08-25 11:41:00 +0200499 -hal_dumpstate_server
Inseob Kim46dd4be2020-08-18 11:25:32 +0900500 not_compatible_property(`-vendor_init')
501} hal_dumpstate_config_prop:file no_rw_file_perms;
Primiano Tuccicd452302020-10-09 09:15:10 +0100502
503neverallow {
504 -init
505 userdebug_or_eng(`-traced_probes')
Florian Mayer167407d2020-11-11 11:01:36 +0000506 userdebug_or_eng(`-traced_perf')
Primiano Tuccicd452302020-10-09 09:15:10 +0100507} {
508 lower_kptr_restrict_prop
509}:property_service set;
Janis Danisevskis202e8632020-10-23 11:16:34 -0700510
511# TODO Remove this property when Keystore 2.0 migration is complete b/171563717
512neverallow {
513 -init
514 -dumpstate
515 -system_app
516 -system_server
517 -zygote
518} keystore2_enable_prop:file no_rw_file_perms;
Inseob Kimd5a04482020-11-05 22:17:26 +0900519
520neverallow {
521 -init
522} zygote_wrap_prop:property_service set;
523
524neverallow {
525 -init
526} verity_status_prop:property_service set;
527
528neverallow {
529 -init
530} setupwizard_prop:property_service set;
Inseob Kim99855662020-11-12 22:21:51 +0900531
532# ro.product.property_source_order is useless after initialization of ro.product.* props.
533# So making it accessible only from init and vendor_init.
534neverallow {
535 -init
536 -dumpstate
537 -vendor_init
538} build_config_prop:file no_rw_file_perms;
Inseob Kim0cef0fe2020-11-17 13:54:52 +0900539
540neverallow {
541 -init
542 -shell
543} sqlite_log_prop:property_service set;
544
545neverallow {
546 -coredomain
547 -appdomain
548} sqlite_log_prop:file no_rw_file_perms;
Inseob Kim4c110ff2020-11-26 21:50:23 +0900549
Inseob Kim5c011e52021-01-14 04:08:16 +0000550neverallow {
551 -init
552} default_prop:property_service set;
553
Inseob Kim4c110ff2020-11-26 21:50:23 +0900554# Only one of system_property_type and vendor_property_type can be assigned.
555# Property types having both attributes won't be accessible from anywhere.
556neverallow domain system_and_vendor_property_type:{file property_service} *;