summaryrefslogtreecommitdiff
path: root/compiler-rt/include
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2017-12-13 20:41:35 +0000
committerKostya Kortchinsky <kostyak@google.com>2017-12-13 20:41:35 +0000
commit3e34832900e3b9c355d28dcf2aaa28ea7188f213 (patch)
tree7cdfdb4c871bdee9874d39a139c5739db66e5d48 /compiler-rt/include
parentf1e19c7bb811a0febbbbb2f0c08b651d368492b8 (diff)
[scudo] Adding a public Scudo interface
Summary: The first and only function to start with allows to set the soft or hard RSS limit at runtime. Add associated tests. Reviewers: alekseyshl Reviewed By: alekseyshl Subscribers: mgorny, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D41128
Diffstat (limited to 'compiler-rt/include')
-rw-r--r--compiler-rt/include/CMakeLists.txt1
-rw-r--r--compiler-rt/include/sanitizer/scudo_interface.h34
2 files changed, 35 insertions, 0 deletions
diff --git a/compiler-rt/include/CMakeLists.txt b/compiler-rt/include/CMakeLists.txt
index f964e16df66..f5cb09fd8cc 100644
--- a/compiler-rt/include/CMakeLists.txt
+++ b/compiler-rt/include/CMakeLists.txt
@@ -10,6 +10,7 @@ if (COMPILER_RT_BUILD_SANITIZERS)
sanitizer/linux_syscall_hooks.h
sanitizer/lsan_interface.h
sanitizer/msan_interface.h
+ sanitizer/scudo_interface.h
sanitizer/tsan_interface.h
sanitizer/tsan_interface_atomic.h)
endif(COMPILER_RT_BUILD_SANITIZERS)
diff --git a/compiler-rt/include/sanitizer/scudo_interface.h b/compiler-rt/include/sanitizer/scudo_interface.h
new file mode 100644
index 00000000000..cab7e0f5f34
--- /dev/null
+++ b/compiler-rt/include/sanitizer/scudo_interface.h
@@ -0,0 +1,34 @@
+//===-- sanitizer/scudo_interface.h -----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+/// Public Scudo interface header.
+//
+//===----------------------------------------------------------------------===//
+#ifndef SANITIZER_SCUDO_INTERFACE_H_
+#define SANITIZER_SCUDO_INTERFACE_H_
+
+#include <sanitizer/common_interface_defs.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ // This function may be optionally provided by a user and should return
+ // a string containing Scudo runtime options. See scudo_flags.h for details.
+ const char* __scudo_default_options();
+
+ // This function allows to set the RSS limit at runtime. This can be either
+ // the hard limit (HardLimit=1) or the soft limit (HardLimit=0). The limit
+ // can be removed by setting LimitMb to 0. This function's parameters should
+ // be fully trusted to avoid security mishaps.
+ void __scudo_set_rss_limit(unsigned long LimitMb, int HardLimit);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // SANITIZER_SCUDO_INTERFACE_H_