[compiler-rt] r346257 - [sanitizer] Add char **GetEnviron() on all other platforms
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 6 11:23:12 PST 2018
Author: vitalybuka
Date: Tue Nov 6 11:23:12 2018
New Revision: 346257
URL: http://llvm.org/viewvc/llvm-project?rev=346257&view=rev
Log:
[sanitizer] Add char **GetEnviron() on all other platforms
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D54165
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.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=346257&r1=346256&r2=346257&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Tue Nov 6 11:23:12 2018
@@ -224,6 +224,7 @@ u32 GetUid();
void ReExec();
void CheckASLR();
char **GetArgv();
+char **GetEnviron();
void PrintCmdline();
bool StackSizeIsUnlimited();
uptr GetStackSizeLimitInBytes();
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc?rev=346257&r1=346256&r2=346257&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc Tue Nov 6 11:23:12 2018
@@ -451,6 +451,7 @@ char **StoredArgv;
char **StoredEnviron;
char **GetArgv() { return StoredArgv; }
+char **GetEnviron() { return StoredEnviron; }
const char *GetEnv(const char *name) {
if (StoredEnviron) {
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=346257&r1=346256&r2=346257&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Tue Nov 6 11:23:12 2018
@@ -623,8 +623,13 @@ char **GetArgv() {
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 @@ void ReExec() {
pathname = reinterpret_cast<const char *>(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);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc?rev=346257&r1=346256&r2=346257&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_openbsd.cc Tue Nov 6 11:23:12 2018
@@ -99,6 +99,12 @@ char **GetArgv() {
return argv;
}
+char **GetEnviron() {
+ char **argv, **envp;
+ GetArgsAndEnv(&argv, &envp);
+ return envp;
+}
+
void ReExec() {
UNIMPLEMENTED();
}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc?rev=346257&r1=346256&r2=346257&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_rtems.cc Tue Nov 6 11:23:12 2018
@@ -240,6 +240,7 @@ bool IsAccessibleMemoryRange(uptr beg, u
}
char **GetArgv() { return nullptr; }
+char **GetEnviron() { return nullptr; }
const char *GetEnv(const char *name) {
return getenv(name);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=346257&r1=346256&r2=346257&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Tue Nov 6 11:23:12 2018
@@ -1021,6 +1021,11 @@ char **GetArgv() {
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
More information about the llvm-commits
mailing list