WEFT_OS/tests/components/grants-probe/wit/world.wit
Marco Allegretti 044634692f
fix(runtime): bound component memory and app messages
The runtime set no limits of its own:
- A component could grow its linear memory until the host ran out, with
  no ceiling at all where systemd is unavailable.
- An app message could contain line breaks and split into several
  messages.
- An overlong message from weft-appd was buffered without bound.
- A closed connection looked the same as an empty one.

The Wasmtime store now has a limiter: linear memory is capped at 256 MiB
by default (--max-memory-mib changes it), and tables and instances are
bounded too. A memory that would grow past the limit does not grow, and
the component sees an allocation failure.

App messages are single lines of at most 64 KiB, the limit weft-appd
applies. A longer message, or one containing a line break, is refused.
A longer line from weft-appd ends the connection, and sending afterwards
reports that it is closed. The systemd scope also gets TasksMax=64.

The grants probe component now also tries a 300 MiB allocation and the
two refused messages. tests/runtime/check_grants.py checks that the
allocation fails at the default limit and succeeds with a 512 MiB
limit.
2026-10-09 18:23:07 +00:00

9 lines
224 B
Text

package weft:grants-probe@0.1.0;
world app {
import weft:app/notify@0.1.0;
import weft:app/fetch@0.1.0;
import weft:app/notifications@0.1.0;
import weft:app/clipboard@0.1.0;
import weft:app/ipc@0.1.0;
}