Skip to main content
Menu
Advisories

Process abort when a GC heap's reservation isn't a multiple of the page size

GHSA-WVGQ-G5HF-6GM6Published Updated GitHub

Description

When an embedder configures Wasmtime with a GC heap that can't move and a GC heap reservation that isn't a multiple of the host page size, a WebAssembly module that uses GC can make Wasmtime abort the host process by filling its GC heap.

Details

For a linear memory or GC heap that can't move, compiled code assumes that the memory never grows beyond the configured reservation, and it bounds-checks accesses against that constant instead of the memory's current length. At runtime, Wasmtime rounds the reservation up to the host page size when it allocates the memory, and allowed a memory that can't move to grow into the whole rounded-up allocation. With, for example, a reservation of 131071 bytes on a host with 4 KiB pages, a memory could grow to 131072 bytes. Compiled code then, erroneously, rejected every access to its last byte.

For the GC heap, compiled code reports this failing access as GC heap corruption. With Wasmtime's default configuration spectre mitigations are enabled which means that this failing access loads from the NULL pointer and generates a fault. This fault is caught by Wasmtime, but Wasmtime's logic for handling this fault erroneously classified the fault as completely unknown and aborted the process out of caution.

Impact

This affects embedders that enable the Wasm GC proposal (on by default from 47.0.0), and configure all of the following:

  1. Config::gc_heap_may_move(false) or Config::memory_may_move(false).
  2. Config::gc_heap_reservation or Config::memory_reservation with a value that is not a multiple of the host's page size.

With such a configuration, a guest can abort the host process by allocating GC objects until its GC heap is full. The default configuration of Wasmtime is not affected.

Affected versions

References

GitHub · bytecodealliance/wasmtime