[compiler-rt] Allow to override allocation buffer size with a separate env var (PR #71703)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 09:13:30 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Florian Mayer (fmayer)

<details>
<summary>Changes</summary>

We don't allow SCUDO_OPTIONS to be preserved across SELinux transitions, so introducing a more constrained one that we can preserve.

---
Full diff: https://github.com/llvm/llvm-project/pull/71703.diff


1 Files Affected:

- (modified) compiler-rt/lib/scudo/standalone/flags.cpp (+8) 


``````````diff
diff --git a/compiler-rt/lib/scudo/standalone/flags.cpp b/compiler-rt/lib/scudo/standalone/flags.cpp
index de5153b288b14e3..a3095d4f655ff3d 100644
--- a/compiler-rt/lib/scudo/standalone/flags.cpp
+++ b/compiler-rt/lib/scudo/standalone/flags.cpp
@@ -11,6 +11,7 @@
 #include "flags_parser.h"
 
 #include "scudo/interface.h"
+#include <stdlib.h>
 
 namespace scudo {
 
@@ -68,6 +69,13 @@ void initFlags() {
   Parser.parseString(getCompileDefinitionScudoDefaultOptions());
   Parser.parseString(getScudoDefaultOptions());
   Parser.parseString(getEnv("SCUDO_OPTIONS"));
+  if (const char* V = getEnv("SCUDO_ALLOCATION_RING_BUFFER_SIZE")) {
+    char* End = nullptr;
+    int I = static_cast<int>(strtol(V, &End, 10));
+    if (End && *End == '\0') {
+      F->allocation_ring_buffer_size = I;
+    }
+  }
 }
 
 } // namespace scudo

``````````

</details>


https://github.com/llvm/llvm-project/pull/71703


More information about the llvm-commits mailing list