一句话:提出针对 WIT 绑定生成器的随机差分测试框架,发现 7 个此前未知的代码生成缺陷。
WebAssembly 组件模型通过 WIT 绑定生成器为普通模块包裹绑定代码,使不同语言编译出的部件能够互操作。绑定代码生成中的错误会在组件应用中引发崩溃或静默数据损坏等难以诊断的运行时错误;然而已有 WebAssembly 测试工作只关注编译器与运行时,忽视了绑定生成器这一环节。本文是一篇经验论文,实现了一套针对 wit-bindgen 与 wit-bindgen-go 的随机差分测试系统:用不同高级语言编写行为应一致的程序,分别生成多个语义相同的 WebAssembly 组件,若其运行时行为出现差异,则怀疑某个生成的绑定存在缺陷。借助该框架,作者在两个生成器中发现了 7 个此前未知的代码生成缺陷,对它们进行了分析,并总结了可供未来绑定生成器测试借鉴的经验教训。
The WebAssembly Component Model is an emerging standard for assembling applications from parts that are implemented in WebAssembly. Unlike ordinary WebAssembly modules, components implement their interfaces in a standardized way, enabling the interoperation of software parts compiled to WebAssembly from different programming languages. A component essentially wraps an ordinary module with binding code, created by a WebAssembly Interface Type (WIT) binding generator, to adapt the module to the WebAssembly component standard. Errors in the generation of binding code can lead to hard-to-diagnose run-time errors, including crashes and silent data corruption, in applications built from WebAssembly components. Prior published work on WebAssembly testing has focused on finding bugs in WebAssembly compilers and runtimes, and has overlooked the potential for bugs in the generation of binding code. In this experience paper, we detail and evaluate our approach to addressing this oversight.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 written in different high-level languages. If the components’ run-time behaviors differ, we expect that there is a bug in one of the generated bindings. Using our framework, we discovered seven previously unknown code-generation defects in wit-bindgen and wit-bindgen-go. We analyze these bugs in this paper and, in addition, share lessons learned that can guide future efforts to test binding generators.
DOI 原文 ·
@inproceedings{paperbot9374,
title = {Finding Bugs in WebAssembly Interface Type Binding Generators},
author = {Ethan Stanley and Eric Eide},
booktitle = {ASE},
year = {2025},
doi = {10.1109/ase63991.2025.00025}
}