Skip to content

Commit 3d63950

Browse files
committed
[msan] Increase kNumStackOriginDescrs constant
This increases the constant size of kNumStackOriginDescrs to 64M (1GB of BSS across two arrays), which ought to be enough for anybody. This is the easier alternative suggested by eugenis@ in llvm#92826.
1 parent 888e087 commit 3d63950

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler-rt/lib/msan/msan.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ int msan_report_count = 0;
100100

101101
// Array of stack origins.
102102
// FIXME: make it resizable.
103-
static const uptr kNumStackOriginDescrs = 1024 * 1024;
103+
// Although BSS memory doesn't cost anything until used, it is limited to 2GB
104+
// in some configurations (e.g., relocation R_X86_64_PC32 out of range:
105+
// 8600110908 is not in [-2147483648, 2147483647]; references section '.bss')
106+
// hence kNumStackOriginDescrs is limited to roughly 2GB / sizeof(uptr) / 2
107+
// == 128M per array (StackOriginDescr, StackOriginPC). We set it at 64M each
108+
// in case other parts of MSan want more BSS space in the future.
109+
static const uptr kNumStackOriginDescrs = 64 * 1024 * 1024;
104110
static const char *StackOriginDescr[kNumStackOriginDescrs];
105111
static uptr StackOriginPC[kNumStackOriginDescrs];
106112
static atomic_uint32_t NumStackOriginDescrs;

0 commit comments

Comments
 (0)