[compiler-rt] r180599 - [sanitizer] Clear LD_PRELOAD when forking an external symbolizer.
Sergey Matveev
earthdok at google.com
Fri Apr 26 05:39:11 PDT 2013
Yes, I'm investigating this.
On Fri, Apr 26, 2013 at 4:34 PM, Rafael EspĂndola <
rafael.espindola at gmail.com> wrote:
> looks like this broke the bots:
>
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-debian-fast/builds/1929
>
> On 26 April 2013 07:35, Sergey Matveev <earthdok at google.com> wrote:
> > Author: smatveev
> > Date: Fri Apr 26 06:35:05 2013
> > New Revision: 180599
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=180599&view=rev
> > Log:
> > [sanitizer] Clear LD_PRELOAD when forking an external symbolizer.
> >
> > Modified:
> > compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
> > compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
> > compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
> >
> > Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
> > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=180599&r1=180598&r2=180599&view=diff
> >
> ==============================================================================
> > --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
> > +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Fri Apr 26
> 06:35:05 2013
> > @@ -131,6 +131,7 @@ void DumpProcessMap();
> > bool FileExists(const char *filename);
> > const char *GetEnv(const char *name);
> > bool SetEnv(const char *name, const char *value);
> > +void UnsetEnv(const char *name);
> > const char *GetPwd();
> > u32 GetUid();
> > void ReExec();
> >
> > Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
> > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=180599&r1=180598&r2=180599&view=diff
> >
> ==============================================================================
> > --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
> > +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Fri Apr 26
> 06:35:05 2013
> > @@ -278,6 +278,20 @@ bool SetEnv(const char *name, const char
> > }
> > #endif
> >
> > +void UnsetEnv(const char *name) {
> > + uptr name_length = internal_strlen(name);
> > + uptr last = 0;
> > + while (environ[last]) last++;
> > + for (uptr i = 0; environ[i]; i++)
> > + if (internal_strlen(environ[i]) >= name_length + 1 &&
> > + internal_strncmp(environ[i], name, name_length) == 0 &&
> > + environ[i][name_length] == '=') {
> > + last--;
> > + environ[i] = environ[last];
> > + environ[last] = 0;
> > + }
> > +}
> > +
> > #ifdef __GLIBC__
> >
> > extern "C" {
> >
> > Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
> > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc?rev=180599&r1=180598&r2=180599&view=diff
> >
> ==============================================================================
> > --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
> (original)
> > +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_linux.cc
> Fri Apr 26 06:35:05 2013
> > @@ -100,6 +100,11 @@ bool StartSymbolizerSubprocess(const cha
> > 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);
> > }
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130426/afcc1b3c/attachment.html>
More information about the llvm-commits
mailing list