Don't let ro.log.file_logger.path to be set
ro.log.file_logger.path is a system property that liblog uses to
determine if file_logger should be used (instead of logd) and what file
the logs should be emitted to. It is primarily meant for non-Android
environment like Microdroid, and doesn't need to be set in Android. In
fact, setting it to a wrong value can break the system logging
functionality. This change prevents such a problem by assigning a
dedicated property context (log_file_logger_prop) to the property and
making it non-writable. (Note that it still has to be readable because
liblog reads it and liblog can be loaded in any process)
Bug: 222592894
Test: try to set ro.log.file_logger.path
Change-Id: Ic6b527327f5bd4ca70a58b6e45f7be382e093318
diff --git a/private/property_contexts b/private/property_contexts
index f55e99b..a67ea73 100644
--- a/private/property_contexts
+++ b/private/property_contexts
@@ -43,7 +43,7 @@
log. u:object_r:log_prop:s0
log.tag u:object_r:log_tag_prop:s0
log.tag.WifiHAL u:object_r:wifi_log_prop:s0
-ro.log.file_logger.path u:object_r:log_prop:s0 exact string
+ro.log.file_logger.path u:object_r:log_file_logger_prop:s0 exact string
security.perf_harden u:object_r:shell_prop:s0
persist.simpleperf.profile_app_uid u:object_r:shell_prop:s0
persist.simpleperf.profile_app_expiration_time u:object_r:shell_prop:s0