summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2012-12-10 13:10:40 +0000
committerAlexander Potapenko <glider@google.com>2012-12-10 13:10:40 +0000
commit1746f555ee5eb19893c2aa64599d48b7273a6ded (patch)
treeab3849a6ae72123ac3a3dc48ab3d2a19e2917003 /compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
parent0f5855810170f1d286b5b0812370c6c36cbbe82f (diff)
downloadbcm5719-llvm-1746f555ee5eb19893c2aa64599d48b7273a6ded.tar.gz
bcm5719-llvm-1746f555ee5eb19893c2aa64599d48b7273a6ded.zip
Add a libsanitizer API __sanitizer_sandbox_on_notify(void* reserved), which should be used by
the client programs to notify the tools that sandboxing is about to be turned on. llvm-svn: 169732
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_linux.cc')
-rw-r--r--compiler-rt/lib/sanitizer_common/sanitizer_linux.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
index 4e9f7de99b5..5be76e9e6a6 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
@@ -218,6 +218,14 @@ void ReExec() {
execv(argv[0], argv.data());
}
+void PrepareForSandboxing() {
+ // Some kinds of sandboxes may forbid filesystem access, so we won't be able
+ // to read the file mappings from /proc/self/maps. Luckily, neither the
+ // process will be able to load additional libraries, so it's fine to use the
+ // cached mappings.
+ MemoryMappingLayout::CacheMemoryMappings();
+}
+
// ----------------- sanitizer_procmaps.h
// Linker initialized.
ProcSelfMapsBuff MemoryMappingLayout::cached_proc_self_maps_;
OpenPOWER on IntegriCloud