You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
compiler double-frees a HashMap in Zcu.compile_source_frontend_mode on a c_import error path (openssl 4.0.2 evp.h); regression since v0.15.2.1 #1158
with init + with get c.openssl (fetches OpenSSL 4.0.2 today) + build/release_uat_fixtures/openssl_main.w as src/main.w, then with check src/main.w with the current main compiler (0a0ff13, darwin-aarch64):
invalid free addr=4451869408
debug-alloc: invalid-free forensics: slab range 27 start=4451827712 header-offset=41680 header-word=4451880832
panic: invalid free: pointer is not an allocated payload start
frame #6: with_hashmap_free at rt_core.w:3312
frame #7: Zcu.compile_source_frontend_mode at main.w (inlined)
frame #9: Zcu.compile_file_frontend_with_config
frame #10: Compilation.compile_file
frame #11: run_cli
What the path is
On these headers the generated <c_import openssl/evp.h> module raises a Sema error (let OSSL_DEPRECATEDIN_4_0: c_int = OSSL_DEPRECATED(4.0) → "undefined variable": an object macro whose value calls an attribute macro that has no With form; the release PR #1155 stops emitting such macros). The double free happens on that error path of compile_source_frontend_mode: a HashMap local is dropped twice.
Attribution
The 09-06 release compiler v0.15.2.1 takes the same error path on the same headers and exits cleanly with the diagnostic (plus the fixture's now-gated write import) — no double free. So this is a regression on main between d9091ce (v0.15.2.1) and 0a0ff13.
It surfaced now because with get c.openssl moved from 3.x to 4.0.2, whose new OSSL_DEPRECATEDIN_4_0 macros first reach that error path.
Route
Per CLAUDE.md: --dump-drop-state / --trace-ownership on compile_source_frontend_mode for the map local, WITH_DEBUG_ALLOC_TRAP_FREE=<addr> under WITH_ALLOC_NO_REUSE with tools/debug_drop_sites.lldb to get the two drop sites, then the MIR that scheduled the second drop. Candidates: the error-return edges added to the frontend by the D39/#1151 work (bundle interface collection on demand, one path boundary) between 09-06 and 09-16.
Blocks the openssl release UAT only until #1155's generator fix lands (the error path is then not taken for this fixture); the double free itself remains for any c_import module that errors.
The address-trap investigation located the earlier free. The root is broader
than frontend error-edge cleanup: HashMap extraction shallow-copies non-Copy
elements into an owning Vec.
On the current source (69bf4e70), LLDB with ASLR disabled and WITH_DEBUG_ALLOC_TRAP_FREE=4712080096 shows:
Key-string allocation in Zcu.c_import_record_omissions_frontend.
Free at sema_clone_str_str_hashmap +404 (0x1004ece58): the generated
destructor for the helper's let ks = src.keys() Vec drops its strings.
Reuse of that allocation in Sema.select_trait_impl via hm_grow.
Free through the original map's stale key at Frontend.w:1780.
Double free when the actual trait-selection map is destroyed.
MAP_KEYS → with_hashmap_keys_out raw-copies string headers. MAP_VALUES
and MAP_ITEMS have the same contract defect, and ordinary for map iteration
also lowers through MAP_ITEMS. The correction must cover the collection
operations, not avoid keys() in this Sema helper. No memory fix is applied yet.
Small string-map probes run successfully normally but fail after snapshot
destruction with WITH_DEBUG_ALLOC_SCRIBBLE=1. The reducer predicate requires
both the normal success and the scribbled failure, avoiding a false reduction
to an unrelated empty-map unwrap panic.
The audit blind spot is filed as #1159; the address-trap helper defects found
during the hunt are #1160. Full evidence and the release failure matrix are
being recorded in docs/with-get-release-investigation.md.
Separately, #1155 did not eliminate the OpenSSL macro failure. LLDB shows ci_translate_macros marking OSSL_DEPRECATED emitted before recording
the same macro untranslated; the dependent object macro then passes the
emitted-callee guard. This also reproduces on Darwin with a cold cache.
Root cause: HashMap.keys() / values() / items() byte-copied their elements (with_hashmap_{keys,values,items}_out), so for a non-Copy element the returned Vec and the map owned the same buffers. sema_clone_str_str_hashmap called .keys() on a HashMap[str, str]; dropping that Vec freed the map's key strings, and the map freed them again. Allocator verdict: DOUBLE FREE size=64 first_drop=drop#struct __drop_struct_229; lldb at dbg_report_double_free: second free with_hashmap_free from Zcu.compile_source_frontend_mode. It vanished under WITH_ALLOC_NO_REUSE=1 and under instrumentation because it needed the freed block to be reused.
Evidence after the fix: with a release compiler built from main + #1190, with build of the fetched OpenSSL project no longer dies with invalid free (it reports the underlying c_import error cleanly); on the campaign branch, which also carries the c_import fixes, with run prints openssl UAT passed and the whole darwin :release-uat group is green. test/behavior/behav_d44_map_ownership.w holds the regression under --debug-alloc with WITH_DEBUG_ALLOC_SCRIBBLE=1.
The audit blind spot that let it through stays open as #1159.
Activity
release: c_import generator fixes for the UAT packages, local-first r…
docs: handoff — cutting v0.15.2.2, the local-first release process, a…
release: make every Release leg able to go green (toward v0.15.2.2 wi…
ehartford commentedon Sep 17, 2026
The address-trap investigation located the earlier free. The root is broader
than frontend error-edge cleanup: HashMap extraction shallow-copies non-Copy
elements into an owning Vec.
On the current source (
69bf4e70), LLDB with ASLR disabled andWITH_DEBUG_ALLOC_TRAP_FREE=4712080096shows:Zcu.c_import_record_omissions_frontend.sema_clone_str_str_hashmap +404(0x1004ece58): the generateddestructor for the helper's
let ks = src.keys()Vec drops its strings.Sema.select_trait_implviahm_grow.Frontend.w:1780.MAP_KEYS→with_hashmap_keys_outraw-copies string headers.MAP_VALUESand
MAP_ITEMShave the same contract defect, and ordinaryformap iterationalso lowers through
MAP_ITEMS. The correction must cover the collectionoperations, not avoid
keys()in this Sema helper. No memory fix is applied yet.Small string-map probes run successfully normally but fail after snapshot
destruction with
WITH_DEBUG_ALLOC_SCRIBBLE=1. The reducer predicate requiresboth the normal success and the scribbled failure, avoiding a false reduction
to an unrelated empty-map unwrap panic.
The audit blind spot is filed as #1159; the address-trap helper defects found
during the hunt are #1160. Full evidence and the release failure matrix are
being recorded in
docs/with-get-release-investigation.md.Separately, #1155 did not eliminate the OpenSSL macro failure. LLDB shows
ci_translate_macrosmarkingOSSL_DEPRECATEDemitted before recordingthe same macro untranslated; the dependent object macro then passes the
emitted-callee guard. This also reproduces on Darwin with a cold cache.
D44: map traversal observes; consuming iteration transfers; transport…
Map traversal and snapshots never make a second owner (D44, §2.3)
Map traversal and snapshots never make a second owner (D44, §2.3) (#1190
ehartford commentedon Sep 19, 2026
Fixed by #1190 (D44 step 1,
c1760ffdon main).Root cause:
HashMap.keys()/values()/items()byte-copied their elements (with_hashmap_{keys,values,items}_out), so for a non-Copy element the returnedVecand the map owned the same buffers.sema_clone_str_str_hashmapcalled.keys()on aHashMap[str, str]; dropping thatVecfreed the map's key strings, and the map freed them again. Allocator verdict:DOUBLE FREE size=64 first_drop=drop#struct __drop_struct_229; lldb atdbg_report_double_free: second freewith_hashmap_freefromZcu.compile_source_frontend_mode. It vanished underWITH_ALLOC_NO_REUSE=1and under instrumentation because it needed the freed block to be reused.Evidence after the fix: with a release compiler built from
main+ #1190,with buildof the fetched OpenSSL project no longer dies withinvalid free(it reports the underlying c_import error cleanly); on the campaign branch, which also carries the c_import fixes,with runprintsopenssl UAT passedand the whole darwin:release-uatgroup is green.test/behavior/behav_d44_map_ownership.wholds the regression under--debug-allocwithWITH_DEBUG_ALLOC_SCRIBBLE=1.The audit blind spot that let it through stays open as #1159.
D22 compliant and its 66 fixtures promoted; D44 extraction copy glue (#…