Flux Research Group / School of Computing

Random Testing of WebAssembly Interface Type Binding Generators

Ethan Stanley

Masters Thesis, University of Utah. May 2025.

areas
Languages, Software Testing, Middleware

abstract

We evaluate the effectiveness of random differential testing for finding bugs in WebAssembly Interface Type (WIT) binding generators, which are code generators used within the WebAssembly component ecosystem. Components are composable wrappers around ordinary WebAssembly modules; components specify their imports and exports in a standard format, enabling the interoperation of programs written in different programming languages. A WIT binding generator creates the code that allows the WebAssembly modules within components to communicate, i.e., to invoke each other’s exported functions and receive the results of those invocations. It is challenging to produce correct binding code due to potential mismatches in programming language semantics and execution models, and bugs in binding code can undermine the correctness of systems that use WebAssembly components. Therefore, it is necessary to thoroughly and effectively test WIT binding generators.

We implemented a system to perform random differential testing for two WIT binding generators, called wit-bindgen and wit-bindgen-go. Our system uses these binding generators to produce multiple WebAssembly components with the same behavior from programs in different high-level languages. If their run-time behaviors differ, we expect that there is a bug in one of the generated bindings. Using our framework, we discovered four previously unknown code-generation defects in wit-bindgen and wit-bindgen-go. We analyze the nature of these bugs to evaluate the effectiveness of our framework.