bytecodealliance / bytecodealliance/ComponentizeJS
Import return buffers are never freed
- Linguagem predominante
- Rust
- Estrelas
- 391
- Forks
- 53
- Merge médio
- 3d 5h
- PRs com merge (30d)
- 1
Descrição
**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.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Comece revisando o tratamento de `cabi_realloc` do splicer e a lógica da free-list de `post_call`, tendo a issue #319 como pré-requisito e a #224 como referência para o use-after-free anterior. Em seguida, inspecione a configuração do bindgen `post_return: None` e como o ComponentizeJS trata as chamadas post-return de exports. O trabalho estará concluído quando houver um design definido de ownership e reclamation que impeça tanto vazamentos quanto use-after-free.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust, wasm
- Domínio
- backend
- Tipo de issue
- Bug
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Pouca atividade
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 35/100