You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Always use fallible accesses of the GC heap (#13320)
This commit is an attempt to harden Wasmtime in the face of GC heap
corruption to downgrade panics to an error being returned instead.
Normal operation should never hit any of these paths and in theory this
is all dead code. The intention, however, is to further downgrade the
severity of GC heaps from a DoS to, in theory, maybe not even a CVE at
all.
This commit is inspired by the transition done for component-model-async
recently too where many `assert!`'d conditions and panics were
translated into `bail_bug!` within Wasmtime. This returns a special kind
of error in release mode and panics in debug mode. The rationale behind
this is that, like component-model-async, the GC implementation is the
intersection of:
* Easy for guests to control.
* Difficult to guarantee 100% correctness of the host.
* Low consequences if corruption is detected.
* Easy to generate a trap via `?` to propagate upwards.
In this situation the goal here is to more aggressively return errors,
in release mode, rather than panic which risks a quick DoS of
embedders. The ideal goal is for GC heap corruption to not be a DoS at
all, but we're not quite ready to make that commitment just yet.
Many methods in this commit were refactored to return `Result`, and many
implementations internally within the GC implementation have been
updated to use `bail_bug!` or similar to downgrade panics to errors.
Note that in debug mode (or `cfg(debug_assertions)`) all of these are
still panics.
cc #13216
0 commit comments