Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h @@ -224,6 +224,7 @@ void ReExec(); void CheckASLR(); char **GetArgv(); +char **GetEnviron(); void PrintCmdline(); bool StackSizeIsUnlimited(); uptr GetStackSizeLimitInBytes(); Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc @@ -451,6 +451,7 @@ char **StoredEnviron; char **GetArgv() { return StoredArgv; } +char **GetEnviron() { return StoredEnviron; } const char *GetEnv(const char *name) { if (StoredEnviron) { Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc @@ -623,8 +623,13 @@ return argv; } -void ReExec() { +char **GetEnviron() { char **argv, **envp; + GetArgsAndEnv(&argv, &envp); + return envp; +} + +void ReExec() { const char *pathname = "/proc/self/exe"; #if SANITIZER_NETBSD @@ -646,8 +651,7 @@ pathname = reinterpret_cast(getauxval(AT_EXECFN)); #endif - GetArgsAndEnv(&argv, &envp); - uptr rv = internal_execve(pathname, argv, envp); + uptr rv = internal_execve(pathname, GetArgv(), GetEnviron()); int rverrno; CHECK_EQ(internal_iserror(rv, &rverrno), true); Printf("execve failed, errno %d\n", rverrno); Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc @@ -99,6 +99,12 @@ return argv; } +char **GetEnviron() { + char **argv, **envp; + GetArgsAndEnv(&argv, &envp); + return envp; +} + void ReExec() { UNIMPLEMENTED(); } Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc @@ -240,6 +240,7 @@ } char **GetArgv() { return nullptr; } +char **GetEnviron() { return nullptr; } const char *GetEnv(const char *name) { return getenv(name); Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc @@ -1021,6 +1021,11 @@ return 0; } +char **GetEnviron() { + // FIXME: Actually implement this function. + return 0; +} + pid_t StartSubprocess(const char *program, const char *const argv[], fd_t stdin_fd, fd_t stdout_fd, fd_t stderr_fd) { // FIXME: implement on this platform