WebAssembly / memory-control

A proposal to introduce finer grained control of WebAssembly memory.
Other
33 stars 2 forks source link

Story for refs? #3

Open dead-claudia opened 1 year ago

dead-claudia commented 1 year ago

Refs have a similar issue to linear memory: there's a non-freeable linear memory and there's a WIP GC proposal that entirely offloads the memory management to the runtime. Where this seeks to provide a way to manage blocks of linear-like memory, a similar story would be very useful for refs for embedded users (where memory constraints may render GC impractical) and WASI server writers (where scaling based on memory usage is very desirable).

Note: I'm not recommending any particular API for this (much less mmap-like APIs in particular), just that it's a problem space that should be looked into.

dtig commented 1 year ago

Thanks for filing this issue, I'm not very familiar with WASI server writers, but curious if you'd be able to go into details of what would be the most useful in that space that this proposal might address?

dead-claudia commented 1 year ago

@dtig I'm not aware of any major production WASI-based servers currently, but it is a possibility I have great interest in, since it offers a way to cheaply sandbox them to systemically eliminate a number of common vulnerabilities with them (notably, RCEs). A cursory search has shown I'm not the only one interested in this space, though.

This proposal already addresses the concern of memory management, which is particularly helpful for caching. Funcref tables of course generally would remain static, but externrefs are useful (and may be necessary the way WASI's design is going) for managing references to external resources, and it'd be nice if these could scale with the program's general memory usage as well.