mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-24 18:32:23 +00:00
Plug-ins: the host checks the WebAssembly features a plug-in uses
Plugin::load now validates each module with wasmparser and a fixed list of WebAssembly features before wasmi reads it: mutable globals, sign extension, saturating conversions, multi-value, bulk memory, reference types, tail calls, extended constant expressions and floats. A module that uses any other feature is refused, so a wasmi upgrade, a change to its defaults or one of its crate features turned on elsewhere in the build does not change what a plug-in may use. wasmi's Config is set to the same list for every setter it has in this build. The list is the set wasmi accepted before, without multi-memory. A second memory was already refused by the one-memory limit; its error now says "multiple memories". No module that loaded before is refused. wasmparser 0.228.0 is the version wasmi 2.0.0 already uses. A new test loads a plug-in that uses each listed feature and checks that modules using SIMD, relaxed SIMD, memory64, a second memory, custom page sizes, wide arithmetic, threads, exceptions, legacy exceptions, function references or garbage collection are refused with an error that names the feature. docs/plugins.md lists the whole set; it named only four of the allowed features before.
This commit is contained in:
+7
-4
@@ -353,10 +353,13 @@ each time it is drawn, and a paint linked to a global swatch is drawn in that sw
|
||||
|
||||
## ABI v1
|
||||
|
||||
A plug-in is a core WebAssembly module (MVP + the usual post-MVP features: bulk memory, sign extension, multi-value,
|
||||
saturating conversions; no SIMD, no memory64) with these exports and no imports other than the [host
|
||||
imports](#host-imports-api-level-2) of API level 2. Integers are `i32` unless noted; pointers are offsets into the
|
||||
module's memory.
|
||||
A plug-in is a core WebAssembly module (MVP + these post-MVP features: mutable globals, sign extension, saturating
|
||||
conversions, multi-value, bulk memory, reference types, tail calls and extended constant expressions) with one memory,
|
||||
these exports and no imports other than the [host imports](#host-imports-api-level-2) of API level 2. Before wasmi reads
|
||||
a module, the host validates it with only these features on, and refuses a module that uses any other feature. The error
|
||||
names the feature for SIMD, relaxed SIMD, memory64, multi-memory, custom page sizes, wide arithmetic, threads,
|
||||
exceptions, function references and garbage collection. Integers are `i32` unless noted;
|
||||
pointers are offsets into the module's memory.
|
||||
|
||||
| Export | Signature | Meaning |
|
||||
|---|---|---|
|
||||
|
||||
Reference in New Issue
Block a user