Skip to content

Commit 2dc5862

Browse files
ahomescuChiaHungDuan
authored andcommitted
[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
1 parent 6e8db66 commit 2dc5862

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compiler-rt/lib/scudo/standalone/platform.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
#define SCUDO_CAN_USE_MTE (SCUDO_LINUX || SCUDO_TRUSTY)
6464
#endif
6565

66+
// Use smaller table sizes for fuzzing in order to reduce input size.
67+
// Trusty just has less available memory.
68+
#ifndef SCUDO_SMALL_STACK_DEPOT
69+
#define SCUDO_SMALL_STACK_DEPOT (SCUDO_FUZZ || SCUDO_TRUSTY)
70+
#endif
71+
6672
#ifndef SCUDO_MIN_ALIGNMENT_LOG
6773
// We force malloc-type functions to be aligned to std::max_align_t, but there
6874
// is no reason why the minimum alignment for all other functions can't be 8

compiler-rt/lib/scudo/standalone/stack_depot.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ class StackDepot {
6262
// This is achieved by re-checking the hash of the stack trace before
6363
// returning the trace.
6464

65-
#ifdef SCUDO_FUZZ
66-
// Use smaller table sizes for fuzzing in order to reduce input size.
65+
#if SCUDO_SMALL_STACK_DEPOT
6766
static const uptr TabBits = 4;
6867
#else
6968
static const uptr TabBits = 16;
@@ -72,7 +71,7 @@ class StackDepot {
7271
static const uptr TabMask = TabSize - 1;
7372
atomic_u32 Tab[TabSize] = {};
7473

75-
#ifdef SCUDO_FUZZ
74+
#if SCUDO_SMALL_STACK_DEPOT
7675
static const uptr RingBits = 4;
7776
#else
7877
static const uptr RingBits = 19;

0 commit comments

Comments
 (0)