Skip to content

Commit

Permalink
Run child process with ASAN_OPTIONS=verify_asan_link_order=0.
Browse files Browse the repository at this point in the history
libasan.so checks if it is the first loaded shared library
and exists if not.

In some tests rr records another rr process which gets then
as first library librrpage.so.

Visible in tests:
ignore_nested nested_detach nested_detach_kill nested_detach_wait

==1913200==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
  • Loading branch information
bernhardu committed Jun 10, 2021
1 parent 2350ad4 commit 23fafc1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/RecordSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,10 @@ static string lookup_by_path(const string& name) {
env.push_back("SYSTEMD_RDRAND=0");
}

#if defined(__SANITIZE_ADDRESS__)
env.push_back("ASAN_OPTIONS=verify_asan_link_order=0");
#endif

shr_ptr session(
new RecordSession(full_path, argv, env, disable_cpuid_features,
syscallbuf, syscallbuf_desched_sig, bind_cpu,
Expand Down
10 changes: 8 additions & 2 deletions src/test/ignore_nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@
// environment. The runner uses this to test
// --nested=ignore in the absence of RR_UNDER_RR
// environment variable.
int main(int argc, char *argv[]) {
int main(int argc, char *argv[], char *envp[]) {
if (argc > 1 && strcmp(argv[1], "--inner") == 0) {
atomic_puts("EXIT-SUCCESS");
return 0;
}
char *newenv[] = { NULL };
char *newenv[2] = {};
for (int i = 0; envp[i] != NULL; i++) {
if (strncmp(envp[i], "ASAN_OPTIONS=", 13) == 0) {
newenv[0] = envp[i];
break;
}
}
return execve(argv[1], &argv[1], newenv);
}

0 comments on commit 23fafc1

Please sign in to comment.