BorrowSanitizer
摘要
BorrowSanitizer 是一个基于 LLVM 的动态分析工具,用于检测 Rust 在多语言互操作中因 unsafe 代码导致的别名违规问题。它旨在弥补 Miri 无法分析外部代码且运行缓慢的不足,目标支持 Rust、C、C++ 互操作,并达到可用于模糊测试的速度。项目开源,代码在 GitHub,欢迎贡献。
荐读理由
该工具定位明确,可替代 Miri 用于模糊测试场景,但目前仍处于项目介绍阶段,未提供具体使用方式或性能数据,需进一步查看 GitHub 才能判断是否可迁移。
原文
Introduction
Check out our latest status update for 2026! 👀
BorrowSanitizer is a dynamic analysis tool for detecting Rust-specific aliasing bugs in multi-language applications.
The Rust compiler provides powerful, static safety guarantees by restricting aliasing and mutability. However, developers can bypass these restrictions by using a subset of unsafe features. These features are necessary for Rust to interoperate with other languages. However, if developers use unsafe code incorrectly, then they can break the rules of Rust’s aliasing model, which the compiler relies on to be able to optimize programs. Incorrect optimizations can introduce security vulnerabilities.
Rust developers can find aliasing bugs using Miri, an interpreter. Miri is the only tool that can find violations of Rust’s latest Tree Borrows aliasing model, but it cannot find these bugs in foreign code. Miri is also significantly slower than native execution, which makes it impractical to use techniques like fuzzing or property-based testing to find these Rust-specific bugs.
BorrowSanitizer is an LLVM sanitizer for finding aliasing violations. Our goal is for it to be fast enough for use with fuzzing tools and to have support for Rust, C, and C++ in interoperation. We intend for it to be a production-ready tool.
Join our Zulip if you are interested in contributing or if you have any additional questions about our project. You can build and test our sanitizer by following the setup instructions in the next section. All of our code is open-source and publicly available on GitHub.
这条对你有帮助吗?