Parent: #478 Related: #476, #493, #647
Goal
Preserve exact string storage ownership and lifetime while no-GIL property writers race multi-slot clone/enumeration consumers. No engine path may publish or copy a StringCell from freed, poisoned, torn, or otherwise invalid bytes.
Fresh failure
Fresh main CI run 32369900898, Linux nogil-corpus-releasesafe (shard 3/4), failed only cve/mc-val-multislot-clone.js after 61/62 cases passed. The bounded diagnostics from #647 exposed:
thread 2880 panic: StringCell: invalid WTF-8 lead byte 0xaa at index 0 of aaaaaaaaaaaa
src/strcell.zig:432 debugAssertWtf8
src/gc.zig:4332 finishManagedString
src/gc.zig:4351 allocManagedString
src/strcell.zig:450 createCell
src/value.zig:6468 strAllocThe witness runs two foreign writers that transition/delete rotating properties while the main thread exercises Object.assign, spread, JSON.stringify, and direct for-in. The 0xaa bytes are consistent with poisoned/stale storage, but the exact ownership violation still needs attribution; this issue does not presume use-after-free until a lifetime trace proves it.
Scope
- Reproduce the failure deterministically or amplify it without weakening the original MC-VAL witness.
- Trace the source slice, allocator identity, property backing/shape generation, string ownership state, and GC reachability from property read through
strAllocandfinishManagedString. - Prove publication ordering and lifetime for deleted/quarantined slots, superseded backing, cloned values, and managed-string allocation across realms/threads.
- Fix the owning lifetime/synchronization contract; keep the WTF-8 tripwire as a security invariant.
- Audit equivalent tree-walker, VM, clone/spread, JSON, and enumeration paths for the same stale-byte window.
No-workaround rules
- No GIL, witness skip, reduced churn, added sleep, disabled poison/tripwire, leaked/quarantined storage without a bounded reclamation proof, copied-everything slow path, or retry that hides an invalid read.
- Do not accept merely converting the panic into replacement text or a catchable error: valid JavaScript strings must retain their exact value.
Acceptance
- A focused deterministic/amplified witness demonstrates the pre-fix ownership violation and passes after the fix.
- The exact source allocation and reclamation race is documented with synchronization and memory-order reasoning.
cve/mc-val-multislot-clone.jspasses no-GIL in Debug, ReleaseSafe, and suppression-free TSan within its existing budget.- Object.assign, spread, JSON, for-in, property delete/transition, string GC/compaction, and fault/OOM coverage pass with exact values and no leaks.
- Full unit, no-GIL corpus, threadfuzz broad/mid-GC/verify, and relevant sanitizer gates pass.
- #647 remains capable of exposing the exact panic if the invariant is deliberately re-broken.