Skip to content

Commit b0a1287

Browse files
committed
test(so): document the POSIX GLR-cap branch as a bounded smoke, per falsification
Follow-up correcting d8a78e8, whose message claimed a broken merge cap crashes "within the first second" so the 10s alarm could not mask it. Falsification disproved that claim AND found the guard was vacuous on POSIX from the start: - With CBM_TS_STACK_MERGE_MAX_DEPTH deleted outright, the ORIGINAL unbounded test stayed GREEN (220s full grind, no crash) on macOS ASan. - Small thread stacks (2 MB, then 512 KB) did not change that. - Instrumenting the vendored recursion showed why: the recursive merge path is NEVER ENTERED for this input in the observable window — max depth stays 0. There is nothing for a stack bound to catch here. So the cap-regression DETECTION lives in the Windows in-process branch (real ~1 MB native stack, where DeusData#913 actually manifested — exercised by the windows CI leg). The POSIX branch is, and always was, a bounded no-crash smoke of the pathological parse; the 10s alarm makes it deterministic (12-15s across three runs, was 2-218s machine-dependent) without any detection loss, because there was no POSIX detection to lose. The experimental pthread machinery is dropped; the test comment now carries the falsification data so no future reader mistakes the POSIX branch for a cap guard. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent d8a78e8 commit b0a1287

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

‎tests/test_stack_overflow.c‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ static void so_parse_alarm_exit(int sig) {
448448
(void)sig;
449449
_exit(0);
450450
}
451+
451452
#endif
452453

453454
/* Parse `content` with tree-sitter DIRECTLY in a forked child — bypassing
@@ -480,13 +481,18 @@ static bool so_parse_crashes(const char *content, CBMLanguage lang) {
480481
return false;
481482
}
482483
if (pid == 0) {
483-
/* Deterministic ceiling: past the merge cap the ambiguity-exploded
484-
* GLR parse GRINDS (minutes, environment-dependent — measured 2s to
485-
* 218s for the identical input). The guard's signal is the CRASH,
486-
* which fires within the first seconds when the recursion cap
487-
* regresses — so a clean exit after 10s proves the cap held without
488-
* paying for the rest of the grind. SIGSEGV/SIGBUS still report as
489-
* WIFSIGNALED; the alarm handler exits cleanly, never masking them. */
484+
/* Deterministic ceiling. Falsification data (2026-07-18, macOS
485+
* ASan): with CBM_TS_STACK_MERGE_MAX_DEPTH deleted outright, this
486+
* branch stayed GREEN both unbounded (220s full grind, no crash)
487+
* and bounded — instrumentation shows the recursive merge path is
488+
* never even entered here (max depth 0 through the whole window).
489+
* The cap-regression DETECTION therefore lives in the Windows
490+
* in-process branch above (real ~1 MB native stack, where #913
491+
* manifested); this POSIX branch is a bounded no-crash smoke of
492+
* the pathological parse, and grinding past 10s adds no signal
493+
* (unbounded it wandered 2s-218s with machine state). A real
494+
* SIGSEGV/SIGBUS still terminates the child by signal before the
495+
* alarm handler can exit cleanly. */
490496
signal(SIGALRM, so_parse_alarm_exit);
491497
alarm(10);
492498
TSParser *parser = ts_parser_new();

0 commit comments

Comments
 (0)