/* Escape the Gentoo sandbox. Needed for ASAN tests to work. */ /* (c) 2016 Michał Górny, 2-clause BSD license */ #include #include #include #include #include #include int main(int argc, char* argv[]) { pid_t pid; int exitst; void* libc; int (*execvp_func)(const char *, char *const[]); assert(argv[1]); unsetenv("LD_PRELOAD"); libc = dlopen("libc.so.6", RTLD_NOW); if (!libc) { perror("dlopen() failed"); return EXIT_FAILURE; } execvp_func = dlsym(libc, "execvp"); assert(execvp_func); execvp_func(argv[1], &argv[1]); perror("execvp() failed"); dlclose(libc); return EXIT_FAILURE; }