Skip to content

Commit

Permalink
Allow syscalls relevant for dynamic startup when sanitizers are used
Browse files Browse the repository at this point in the history
Static linking with sanitizers is not possible on ELF platforms.

PiperOrigin-RevId: 640128022
Change-Id: I3cfdb0737b12803c9682a0994bf0fce272929652
  • Loading branch information
Liblor authored and copybara-github committed Jun 4, 2024
1 parent ad5c5cf commit 7ed1080
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sandboxed_api/sandbox2/policybuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ PolicyBuilder& PolicyBuilder::AllowLlvmSanitizers() {
// https://github.com/llvm/llvm-project/blob/9aa39481d9eb718e872993791547053a3c1f16d5/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp#L150
// https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/pthread_getattr_np.c;h=de7edfa0928224eb8375e2fe894d6677570fbb3b;hb=HEAD#l188
AllowSyscall(__NR_sched_getaffinity);
// https://github.com/llvm/llvm-project/blob/3cabbf60393cc8d55fe635e35e89e5973162de33/compiler-rt/lib/interception/interception.h#L352
#ifdef __ELF__
AllowDynamicStartup();
#endif
// https://github.com/llvm/llvm-project/blob/02c2b472b510ff55679844c087b66e7837e13dc2/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp#L434
#ifdef __NR_readlink
OverridableBlockSyscallWithErrno(__NR_readlink, ENOENT);
Expand Down

0 comments on commit 7ed1080

Please sign in to comment.