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

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


================
@@ -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));
----------------
cferris1000 wrote:

Would it be better to leave this a long, and then do the cast down below?

Also, if you plan to allow this to be set, I think you need extra verification. For example, the number has to >= 0, and because the value is treated as a u32, you should make sure the number doesn't overflow that value. It might be better to have a maximum value for this.

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


More information about the llvm-commits mailing list