From 13df2fafda5c7e8e378362683a09437641388729 Mon Sep 17 00:00:00 2001 From: Mitch Phillips Date: Wed, 20 Jan 2021 16:20:38 -0800 Subject: [PATCH] [MemInit] Use new MemInit API. The system property will only disable heap memory initialization. If you want to disable MTE (which I don't think was the subject of the original patch), you can use the MTE sysprops: 'arm64.memtag.process. = "off"'. Bug: 135772972 Test: Device boots. Change-Id: I180be76ff2f776f1ec1a607de848ff6c81da852d --- camera/provider/2.4/default/service.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp index 84f48393fa..0a4f7874a6 100644 --- a/camera/provider/2.4/default/service.cpp +++ b/camera/provider/2.4/default/service.cpp @@ -22,9 +22,9 @@ #include #include -#include #include #include +#include using android::status_t; using android::hardware::defaultLazyPassthroughServiceImplementation; @@ -46,7 +46,13 @@ int main() // b/166675194 if (property_get_bool("ro.vendor.camera.provider24.disable_mem_init", false)) { - process_disable_memory_mitigations(); + if (mallopt(M_BIONIC_ZERO_INIT, 0) == 0) { + // Note - heap initialization is only present on devices with Scudo. + // Devices with jemalloc don't have heap-init, and thus the mallopt + // will fail. On these devices, you probably just want to remove the + // property. + ALOGE("Disabling heap initialization failed."); + } } status_t status;