diff --git a/private/compat/28.0/28.0.ignore.cil b/private/compat/28.0/28.0.ignore.cil index 9f4f8004bc4ec67c74acf4123c864e4cf7c78abb..cfc2c1a2f1c4fce1ea0e83d6b8dc2ce67deb7ce9 100644 --- a/private/compat/28.0/28.0.ignore.cil +++ b/private/compat/28.0/28.0.ignore.cil @@ -37,6 +37,7 @@ hal_system_suspend_default_tmpfs heapprofd heapprofd_exec + heapprofd_prop heapprofd_socket idmap_service intelligence_service diff --git a/private/domain.te b/private/domain.te index 850635b64f14e57c58cdea186f8954706ef4e83f..6a71a140b813eaaafa5512218f95f55f05bb3066 100644 --- a/private/domain.te +++ b/private/domain.te @@ -5,6 +5,12 @@ domain_auto_trans({ domain userdebug_or_eng(`-su') }, crash_dump_exec, crash_dump); allow domain crash_dump:process sigchld; +# Allow every process to check the heapprofd.enable properties to determine +# whether to load the heap profiling library. This does not necessarily enable +# heap profiling, as initialization will fail if it does not have the +# necessary SELinux permissions. +get_prop(domain, heapprofd_prop); + # Limit ability to ptrace or read sensitive /proc/pid files of processes # with other UIDs to these whitelisted domains. neverallow { diff --git a/private/heapprofd.te b/private/heapprofd.te index 79249b360a0cc07b466530bc932f38c54e980866..30ad7f12d357f4aa1e8513d4afc5a1e25cbd36e0 100644 --- a/private/heapprofd.te +++ b/private/heapprofd.te @@ -3,6 +3,8 @@ type heapprofd_exec, exec_type, file_type, system_file_type; init_daemon_domain(heapprofd) +set_prop(heapprofd, heapprofd_prop); + userdebug_or_eng(` # Allow to send signal to processes. # This excludes SIGKILL, SIGSTOP and SIGCHLD, diff --git a/private/property_contexts b/private/property_contexts index 0fc3de6705c8675639caaa387199d8bbcd3bc3da..adede99b522725270f399c1e536845f82a03aa64 100644 --- a/private/property_contexts +++ b/private/property_contexts @@ -143,6 +143,9 @@ wlan. u:object_r:wifi_prop:s0 lowpan. u:object_r:lowpan_prop:s0 ro.lowpan. u:object_r:lowpan_prop:s0 +# heapprofd properties +heapprofd. u:object_r:heapprofd_prop:s0 + # hwservicemanager properties hwservicemanager. u:object_r:hwservicemanager_prop:s0 diff --git a/public/property.te b/public/property.te index 0704b9a000e1c8171f8603b278e4d46a74001a97..fcbf365561cf4b5cde010d7cf73845938170b340 100644 --- a/public/property.te +++ b/public/property.te @@ -38,6 +38,7 @@ type exported_secure_prop, property_type; type ffs_prop, property_type, core_property_type; type fingerprint_prop, property_type, core_property_type; type firstboot_prop, property_type; +type heapprofd_prop, property_type; type hwservicemanager_prop, property_type; type last_boot_reason_prop, property_type; type system_lmk_prop, property_type; @@ -396,6 +397,7 @@ compatible_property_only(` -device_config_reset_performed_prop -device_config_boot_count_prop -device_config_flags_health_check_prop + -heapprofd_prop -hwservicemanager_prop -last_boot_reason_prop -system_lmk_prop