From 679871aedbd3480dbffbba35801487f612a7453d Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Mon, 3 Aug 2026 01:47:35 +0200 Subject: [PATCH] fix(c_lsp): remove the whole-function ASan suppression; assert the resolution it hid c_lsp_process_file carried __attribute__((no_sanitize("address"))) over the entire C LSP orchestration, excluding every direct memory access in it from ASan -- placed for a stack-pointer-to-registry lifetime bug whose witness test also had its assertion discarded ((void)find_resolved), so nothing could ever prove the bug gone. Flagged by the memory-diagnostics standards report (private/C_MEMORY_DIAGNOSTICS_STANDARDS_REPORT.md, priority 2) as the single highest-value ASan coverage gap in the repository. This branch's C LSP registry rework resolved the underlying lifetime: with the suppression removed, the full c_lsp suite passes under ASan+UBSan (760 tests), including the formerly-failing template field type resolution, whose test now asserts the resolved call instead of discarding it. Honest limit: the original bug predates the branch and its fix is the branch's broad registry rework, not an isolatable commit -- so the revert-proof is main-vs-branch (main: suppression + discarded assertion; branch: neither), not a single-change revert-check. Signed-off-by: Martin Vogel --- internal/cbm/lsp/c_lsp.c | 2 +- tests/test_c_lsp.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/cbm/lsp/c_lsp.c b/internal/cbm/lsp/c_lsp.c index a680d56d2..5437e3e99 100644 --- a/internal/cbm/lsp/c_lsp.c +++ b/internal/cbm/lsp/c_lsp.c @@ -5402,7 +5402,7 @@ static void c_process_class(CLSPContext *ctx, TSNode class_node) { // Process file: top-level walk // ============================================================================ -__attribute__((no_sanitize("address"))) void c_lsp_process_file(CLSPContext *ctx, TSNode root) { +void c_lsp_process_file(CLSPContext *ctx, TSNode root) { if (ts_node_is_null(root)) return; diff --git a/tests/test_c_lsp.c b/tests/test_c_lsp.c index f05cb5962..d821ad30b 100644 --- a/tests/test_c_lsp.c +++ b/tests/test_c_lsp.c @@ -7795,11 +7795,13 @@ TEST(clsp_fix2_struct_field_access_pair_second) { "}\n" ""); ASSERT_NOT_NULL(r); - /* KNOWN ISSUE: template field type resolution fails under ASan due to - * a stack-pointer-to-registry leak bug in c_lsp.c. The Go test passes - * because CGo doesn't run ASan/UBSan. See c_lsp_process_file's - * no_sanitize("address") attribute. Tracked as a pre-existing C LSP bug. */ - (void)find_resolved(r, "test", "bar"); + /* Formerly a KNOWN ISSUE: template field type resolution failed under + * ASan due to a stack-pointer-to-registry lifetime bug, hidden by a + * whole-function no_sanitize("address") on c_lsp_process_file and a + * discarded assertion here. The suppression is removed and the branch's + * C LSP registry rework resolved the lifetime; this now asserts the + * resolution it always meant to. */ + ASSERT_GTE(find_resolved(r, "test", "bar"), 0); cbm_free_result(r); PASS(); }