Enable Scudo for mediaswcodec
Scudo is a hardened usermode allocator that aims at mitigating
heap-based vulnerabilities (heap overflow, double free, etc).
See go/scudo-allocator for more information.
This change enables the allocator for the mediaswcodec service,
effectively linking in the Scudo dynamic library to the binary.
Allocation functions will be serviced by the allocator.
The observed impact on the memory footprint of the service is about a
500k increase to the RSS (due to the Quarantine and chunk headers
overhead), and the MediaCts tests pass without any issue I could see.
In the event of a heap bug detected, the allocator will abort the
process with a 'Scudo ERROR' message in the log followed by the cause
(corrupted header, invalid state & so on) and the stack trace.
Test: CtsMediaTestCases on a marlin
Bug: 63907455
Change-Id: I751af455c002a59ccc4d89cd1e29743036f27708
diff --git a/services/mediacodec/Android.mk b/services/mediacodec/Android.mk
index 789548d..3b6dc80 100644
--- a/services/mediacodec/Android.mk
+++ b/services/mediacodec/Android.mk
@@ -108,6 +108,7 @@
LOCAL_MODULE := mediaswcodec
LOCAL_INIT_RC := mediaswcodec.rc
LOCAL_32_BIT_ONLY := true
+LOCAL_SANITIZE := scudo
sanitizer_runtime_libraries :=
llndk_libraries :=