[PATCH] Clear LD_PRELOAD when forking external symbolizer.

Sergey Matveev earthdok at google.com
Tue Apr 23 03:50:14 PDT 2013


    - removed custom unsetenv implementation
    - added a fixme

Hi kcc, glider, samsonov,

http://llvm-reviews.chandlerc.com/D704

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D704?vs=1712&id=1725#toc

Files:
  lib/sanitizer_common/sanitizer_symbolizer_linux.cc

Index: lib/sanitizer_common/sanitizer_symbolizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_symbolizer_linux.cc
+++ lib/sanitizer_common/sanitizer_symbolizer_linux.cc
@@ -23,6 +23,7 @@
 #include <elf.h>
 #include <errno.h>
 #include <poll.h>
+#include <stdlib.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -100,6 +101,11 @@
     internal_close(infd[1]);
     for (int fd = getdtablesize(); fd > 2; fd--)
       internal_close(fd);
+    // If the parent tool is used as a preloadable library, do not apply it to
+    // the symbolizer.
+    // FIXME: If LD_PRELOAD contains more than one object, we should keep those
+    // that have nothing to do with us.
+    unsetenv("LD_PRELOAD");
     execl(path_to_symbolizer, path_to_symbolizer, (char*)0);
     internal__exit(1);
   }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D704.2.patch
Type: text/x-patch
Size: 878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130423/34f27f4f/attachment.bin>


More information about the llvm-commits mailing list