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

WasmWalker:用于改进 WebAssembly 程序分析的基于路径的代码表示

WasmWalker: Path-based Code Representations for Improved WebAssembly Program Analysis

Mohammad Robati Shirzad, Patrick Lam

AI总结:

提出WasmWalker,基于AST路径为WebAssembly构建两种新代码表示,在方法名预测和返回类型恢复任务上显著超越现有技术。

摘要:

WebAssembly(或称 Wasm)是一种低级二进制语言,能够在 Web 浏览器中执行接近原生性能的代码。Wasm 已被证明在游戏、音视频处理和云计算等应用中非常有用,为 Web 开发中的 JavaScript 提供了一种高性能、低开销的替代方案。所有主流浏览器对 WebAssembly 的快速广泛采用,为支持这一新技术的分析工具创造了机会。深度学习程序分析模型可以极大地受益于包含抽象语法树(AST)信息的代码表示中所涵盖的程序结构信息。为了获取此类代码表示,我们对大量 WebAssembly 二进制文件的 WebAssembly Text 格式中的 AST 路径进行了实证分析,这些文件是从 Ubuntu 18.04 软件包仓库中的源码包编译而来的。在精炼收集到的路径后,我们发现在所有这些二进制文件中仅出现了 3,352 条唯一路径。基于这一发现,我们为 WebAssembly 二进制文件提出了两种新颖的代码表示。这些新颖的表示不仅用于生成固定大小的代码嵌入,还为序列到序列模型提供额外信息。最终,我们的方法帮助程序分析模型从 Wasm 二进制文件中发掘新属性,拓展了我们对其潜力的理解。我们在两个应用上评估了我们的新代码表示:(i) 方法名预测和 (ii) 恢复精确返回类型。我们的结果证明了我们的新技术优于以前的方法。具体而言,与先前的最先进技术 SnowWhite 相比,我们的新方法在方法名预测的 Top-1 (Top-5) 准确率上提高了 5.36% (11.31%),在恢复精确返回类型上提高了 8.02% (7.92%)。

英文摘要:

WebAssembly, or Wasm, is a low-level binary language that enables execution of near-native-performance code in web browsers. Wasm has proven to be useful in applications including gaming, audio and video processing, and cloud computing, providing a high-performance, low-overhead alternative to JavaScript in web development. The fast and widespread adoption of WebAssembly by all major browsers has created an opportunity for analysis tools that support this new technology. Deep learning program analysis models can greatly benefit from the program structure information included in Abstract Syntax Tree (AST)-aware code representations. To obtain such code representations, we performed an empirical analysis on the AST paths in the WebAssembly Text format of a large dataset of WebAssembly binary files compiled from source packages in the Ubuntu 18.04 repositories. After refining the collected paths, we discovered that only 3,352 unique paths appeared across all of these binary files. With this insight, we propose two novel code representations for WebAssembly binaries. These novel representations serve not only to generate fixed-size code embeddings but also to supply additional information to sequence-to-sequence models. Ultimately, our approach helps program analysis models uncover new properties from Wasm binaries, expanding our understanding of their potential. We evaluated our new code representation on two applications: (i) method name prediction and (ii) recovering precise return types. Our results demonstrate the superiority of our novel technique over previous methods. More specifically, our new method resulted in 5.36% (11.31%) improvement in Top-1 (Top-5) accuracy in method name prediction and 8.02% (7.92%) improvement in recovering precise return types, compared to the previous state-of-the-art technique, SnowWhite.

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

↑