[PATCH] D35421: [scudo] Support log_to_syslog in dieWithMessage

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 09:58:45 PDT 2017


cryptoad created this revision.
Herald added a subscriber: srhines.

`log_to_syslog` is a sanitizer common option, that had no effect in Scudo's
`dieWithMessage`. It turns out to be quite useful on Android, so add the few
lines needed to support it.


https://reviews.llvm.org/D35421

Files:
  lib/scudo/scudo_allocator.cpp
  lib/scudo/scudo_utils.cpp


Index: lib/scudo/scudo_utils.cpp
===================================================================
--- lib/scudo/scudo_utils.cpp
+++ lib/scudo/scudo_utils.cpp
@@ -45,6 +45,8 @@
   __sanitizer::VSNPrintf(Message, sizeof(Message), Format, Args);
   va_end(Args);
   RawWrite(Message);
+  RemoveANSIEscapeSequencesFromString(Message);
+  LogMessageOnPrintf(Message);
   Die();
 }
 
Index: lib/scudo/scudo_allocator.cpp
===================================================================
--- lib/scudo/scudo_allocator.cpp
+++ lib/scudo/scudo_allocator.cpp
@@ -300,6 +300,8 @@
       FallbackQuarantineCache(LINKER_INITIALIZED) {}
 
   void init(const AllocatorOptions &Options) {
+    CacheBinaryName();
+    AndroidLogInit();
     // Verify that the header offset field can hold the maximum offset. In the
     // case of the Secondary allocator, it takes care of alignment and the
     // offset will always be 0. In the case of the Primary, the worst case


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35421.106656.patch
Type: text/x-patch
Size: 957 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170714/c39b378c/attachment-0001.bin>


More information about the llvm-commits mailing list