[PATCH] D30222: [compiler-rt] Prevent symbolizer from starting itself.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 13:51:07 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295771: [compiler-rt] Prevent symbolizer from starting itself. (authored by vitalybuka).

Changed prior to commit:
  https://reviews.llvm.org/D30222?vs=89273&id=89274#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30222

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc


Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc
@@ -385,7 +385,23 @@
   CHECK_NE(path_[0], '\0');
 }
 
+static bool IsSameModule(const char* path) {
+  if (const char* ProcessName = GetProcessName()) {
+    if (const char* SymbolizerName = StripModuleName(path)) {
+      return !internal_strcmp(ProcessName, SymbolizerName);
+    }
+  }
+  return false;
+}
+
 const char *SymbolizerProcess::SendCommand(const char *command) {
+  if (failed_to_start_)
+    return nullptr;
+  if (IsSameModule(path_)) {
+    Report("WARNING: Symbolizer was blocked from starting itself!\n");
+    failed_to_start_ = true;
+    return nullptr;
+  }
   for (; times_restarted_ < kMaxTimesRestarted; times_restarted_++) {
     // Start or restart symbolizer if we failed to send command to it.
     if (const char *res = SendCommandImpl(command))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30222.89274.patch
Type: text/x-patch
Size: 1075 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170221/646f0e2e/attachment.bin>


More information about the llvm-commits mailing list