Thread stacks are sized in code (explicitly by most callers, by the default * above otherwise), so RLIMIT_STACK does NOT reach them and a sanitizer lane * cannot size them with ulimit. MemorySanitizer's origin tracking inflates * every frame enough that deep parser recursion overflows the normal worker * stack, and without this hook that lane cannot run the parsing suites at all. * * The flo
| 32 | * exactly the threads that overflow. Diagnostic builds only: the shipping |
| 33 | * binary keeps its fixed, predictable stack sizes. */ |
| 34 | static size_t cbm_thread_stack_floor(size_t requested) { |
| 35 | #if CBM_SANITIZED |
| 36 | const char *env = getenv("CBM_THREAD_STACK_MB"); |
| 37 | if (env && env[0]) { |
| 38 | char *end = NULL; |
| 39 | unsigned long mb = strtoul(env, &end, 10); |
| 40 | if (end && *end == '\0' && mb > 0 && mb <= 1024) { |
| 41 | size_t floor_bytes = (size_t)mb * CBM_SZ_1K * CBM_SZ_1K; |
| 42 | if (floor_bytes > requested) { |
| 43 | return floor_bytes; |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | #endif |
| 48 | return requested; |
| 49 | } |
| 50 | |
| 51 | static size_t cbm_thread_default_stack_size(void) { |
| 52 | return cbm_thread_stack_floor(CBM_DEFAULT_STACK_SIZE); |
no outgoing calls
no test coverage detected