bytecodealliance / bytecodealliance/ComponentizeJS

Import return buffers are never freed

未關閉
#330 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
391
分支
53
平均合併
3 天 5 小時
30 天內合併 PR
1

描述

**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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

先檢查 splicer 對 `cabi_realloc` 的處理,以及 `post_call` 的 free-list 邏輯,其中 issue #319 是前置條件,#224 涉及先前的 use-after-free。接著檢視 bindgen 設定 `post_return: None`,以及 ComponentizeJS 如何處理 export 的 post-return 呼叫。完成的要求是確定一種 ownership 與 reclamation 設計,同時避免洩漏與 use-after-free。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
rust, wasm
領域
backend
Issue 類型
缺陷
難度
5/5
預估耗時
一週以上
活躍度
冷清
描述清晰度
需要釐清
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。