[compiler-rt] 2dc5862 - [scudo] Limit stack depot size on Trusty
Chia-hung Duan via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 21 11:33:19 PDT 2023
Author: Andrei Homescu
Date: 2023-08-21T18:32:34Z
New Revision: 2dc5862cfe226467b1f1a42a6bf47e99c8561e80
URL: https://github.com/llvm/llvm-project/commit/2dc5862cfe226467b1f1a42a6bf47e99c8561e80
DIFF: https://github.com/llvm/llvm-project/commit/2dc5862cfe226467b1f1a42a6bf47e99c8561e80.diff
LOG: [scudo] Limit stack depot size on Trusty
The stack depot uses several megabytes of memory
which is a lot for Trusty.
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D156392
Added:
Modified:
compiler-rt/lib/scudo/standalone/platform.h
compiler-rt/lib/scudo/standalone/stack_depot.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/platform.h b/compiler-rt/lib/scudo/standalone/platform.h
index 7c7024ff570e42..8cd1fd8d43f3f1 100644
--- a/compiler-rt/lib/scudo/standalone/platform.h
+++ b/compiler-rt/lib/scudo/standalone/platform.h
@@ -63,6 +63,12 @@
#define SCUDO_CAN_USE_MTE (SCUDO_LINUX || SCUDO_TRUSTY)
#endif
+// Use smaller table sizes for fuzzing in order to reduce input size.
+// Trusty just has less available memory.
+#ifndef SCUDO_SMALL_STACK_DEPOT
+#define SCUDO_SMALL_STACK_DEPOT (SCUDO_FUZZ || SCUDO_TRUSTY)
+#endif
+
#ifndef SCUDO_MIN_ALIGNMENT_LOG
// We force malloc-type functions to be aligned to std::max_align_t, but there
// is no reason why the minimum alignment for all other functions can't be 8
diff --git a/compiler-rt/lib/scudo/standalone/stack_depot.h b/compiler-rt/lib/scudo/standalone/stack_depot.h
index 458198fcb7aa52..12c35eb2a4f338 100644
--- a/compiler-rt/lib/scudo/standalone/stack_depot.h
+++ b/compiler-rt/lib/scudo/standalone/stack_depot.h
@@ -62,8 +62,7 @@ class StackDepot {
// This is achieved by re-checking the hash of the stack trace before
// returning the trace.
-#ifdef SCUDO_FUZZ
- // Use smaller table sizes for fuzzing in order to reduce input size.
+#if SCUDO_SMALL_STACK_DEPOT
static const uptr TabBits = 4;
#else
static const uptr TabBits = 16;
@@ -72,7 +71,7 @@ class StackDepot {
static const uptr TabMask = TabSize - 1;
atomic_u32 Tab[TabSize] = {};
-#ifdef SCUDO_FUZZ
+#if SCUDO_SMALL_STACK_DEPOT
static const uptr RingBits = 4;
#else
static const uptr RingBits = 19;
More information about the llvm-commits
mailing list