bytecodealliance / bytecodealliance/ComponentizeJS
Import return buffers are never freed
- Vorherrschende Sprache
- Rust
- Sterne
- 391
- Forks
- 53
- Ø Merge
- 3 T. 5 Std.
- Gemergte PRs (30 T.)
- 1
Beschreibung
**Issue details assume #319 is merged.**
Import return buffers allocated via `cabi_realloc` in the splicer are never freed. The old `free_list` bulk free in `post_call` was the only mechanism reclaiming them, but it also caused use-after-free (#224, fixed by #319).
The retptr is returned to JS as a pointer, and JS reads from it after the WASM glue returns, so there's no obvious place to insert a free in the current architecture. This is an unbounded leak for components that make repeated import calls returning strings or lists.
Separately, I noticed the bindgen sets `post_return: None` so ComponentizeJS never generates post-return functions for exports. The canonical ABI expects the host to call post-return so the guest can free export return buffers. I haven't investigated whether `post_call` covers this already.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginne mit der Prüfung der `cabi_realloc`-Behandlung des Splicers und der Free-List-Logik von `post_call`, wobei Issue #319 eine Voraussetzung ist und #224 den vorherigen Use-after-free betrifft. Prüfe anschließend die bindgen-Einstellung `post_return: None` und wie ComponentizeJS Post-Return-Aufrufe für Exporte behandelt. Als abgeschlossen gilt die Aufgabe, wenn ein festgelegtes Ownership- und Reclamation-Design vorliegt, das sowohl Leaks als auch Use-after-free verhindert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rust, wasm
- Bereich
- backend
- Issue-Typ
- Bug
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Ruhig
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100