arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2403.07973cs.PL
收藏

WebAssembly的灵活非侵入式动态插桩

Flexible Non-intrusive Dynamic Instrumentation for WebAssembly

Ben L. Titzer, Elizabeth Gilbert, Bradley Wei Jie Teo, Yash Anand, Kazuyuki Takayama, Heather Miller

AI总结:

本文在Wizard研究引擎中实现了首个WebAssembly非侵入式动态插桩系统,通过字节码级探针支持灵活分析,并优化了性能开销,适合生产环境采用。

摘要:

托管运行时相对于硬件的一个关键优势在于,能够通过插桩深入了解程序的动态执行情况。代码覆盖率、执行频率、追踪和调试等分析在虚拟环境中都变得更加容易。作为一种可移植的低级字节码,WebAssembly提供了低成本、高性能的进程内沙箱。然而,迄今为止,Wasm引擎并未提供太多对正在执行程序的洞察能力,最多支持字节码级单步执行和基本源映射,但不具备插桩能力。在本文中,我们展示了开源Wizard Research Engine中首个针对WebAssembly的非侵入式动态插桩系统。我们的创新设计提供了灵活、完整的插桩原语层次结构,支持基于低级可编程探针构建高级复杂分析。与模拟或机器码插桩相比,在字节码级别注入探针提高了表达能力,并通过重用引擎的JIT编译器、解释器和去优化机制而非构建新机制,极大地简化了实现。Wizard支持动态插桩的插入和移除,同时提供一致性保证,这对于组合多个分析而不相互干扰至关重要。我们详细介绍了在高性能多层级Wasm引擎中的全功能实现,展示了专门为最小化插桩开销而设计的新颖优化,并评估了在各种分析负载下的性能特征。该设计非常适合生产引擎采用,因为探针可以在不使用时对生产性能无影响。

英文摘要:

A key strength of managed runtimes over hardware is the ability to gain detailed insight into the dynamic execution of programs with instrumentation. Analyses such as code coverage, execution frequency, tracing, and debugging, are all made easier in a virtual setting. As a portable, low-level bytecode, WebAssembly offers inexpensive in-process sandboxing with high performance. Yet to date, Wasm engines have not offered much insight into executing programs, supporting at best bytecode-level stepping and basic source maps, but no instrumentation capabilities. In this paper, we show the first non-intrusive dynamic instrumentation system for WebAssembly in the open-source Wizard Research Engine. Our innovative design offers a flexible, complete hierarchy of instrumentation primitives that support building high-level, complex analyses in terms of low-level, programmable probes. In contrast to emulation or machine code instrumentation, injecting probes at the bytecode level increases expressiveness and vastly simplifies the implementation by reusing the engine's JIT compiler, interpreter, and deoptimization mechanism rather than building new ones. Wizard supports both dynamic instrumentation insertion and removal while providing consistency guarantees, which is key to composing multiple analyses without interference. We detail a fully-featured implementation in a high-performance multi-tier Wasm engine, show novel optimizations specifically designed to minimize instrumentation overhead, and evaluate performance characteristics under load from various analyses. This design is well-suited for production engine adoption as probes can be implemented to have no impact on production performance when not in use.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑