MCPcopy Create free account
hub / github.com/BorrowSanitizer/bsan

github.com/BorrowSanitizer/bsan @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
2,519 symbols 5,058 edges 504 files ⚖ MIT 521 documented · 21% ● updated 6d agoclang-0a5579e-1.102.0 · 2026-11-09★ 1026 open issues

Browse by type

⨍ Functions 2,093◇ Types & classes 426
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CI Benchmarks docs project chat Open in Dev Containers

BorrowSanitizer

BorrowSanitizer is a work-in-progress LLVM instrumentation pass for detecting aliasing violations in multi-language Rust applications. Our project is still in early development, but may help you find cross-language bugs otherwise undetectable by Miri. Our goal is to support detecting the following types of errors:

  • Violations of Rust's Tree Borrows aliasing model.
  • Accesses out-of-bounds
  • Use-after free errors.

Check out our website for more information.

Usage

The easiest way to try BorrowSanitizer is inside a Docker container. Our image supports the following platforms:

Platform Target Description
linux/amd64 aarch64-unknown-linux-gnu ARM64 Linux
linux/arm64 x86_64-unknown-linux-gnu X86 Linux

First, pull our latest image from GitHub's container registry.

docker pull ghcr.io/borrowsanitizer/bsan:latest

Then, launch a container and attach a shell.

docker run -it bsan:latest

Once inside the container, you can use our Cargo plugin to build and test crates using BorrowSanitizer.

cargo bsan test

Our plugin supports most of the same subcommands as Miri. When it's used for the first time, it will perform a one-time setup step of building an instrumented sysroot. You can trigger this step manually using the setup subcommand.

Contributing

We follow the LLVM Project's AI Tool Use Policy. All AI-generated content must be disclosed. There must always be a human in the loop.

We welcome contributions! Please consult our contribution guide and join our Zulip if you have questions.

Bugs found by BorrowSanitizer

BorrowSanitizer has been used to find a variety of new cross-language aliasing bugs in open source projects. * Overlapping references in aws-lc-rs * Writing through an immutable reference in CXX

License & Credits

BorrowSanitizer is dual-licensed under Apache and MIT, following the Rust project.

Zulip Zulip sponsors free hosting for BorrowSanitizer. Zulip is an organized team chat app designed for efficient communication.

Extension points exported contracts — how you extend this code

browse all types & interfaces →

Core symbols most depended-on inside this repo

browse all functions →

Shape

Function 1,431
Method 662
Class 307
Enum 65
Interface 54

Languages

Rust86%
C++13%
Python1%

Modules by API surface

bsan-pass/BorrowSanitizer.cpp122 symbols
tests/miri-tests/pass/dyn-upcast.rs56 symbols
bsan-rt/src/lib.rs45 symbols
bsan-rt/src/tree_borrows/perms.rs44 symbols
bsan-rt/src/tree_borrows/diagnostics.rs44 symbols
bsan-rt/llvm-wrapper/bsan.cpp43 symbols
bsan-rt/src/tree_borrows/tree.rs42 symbols
bsan-rt/llvm-wrapper/bsan_allocator.cpp36 symbols
bsan-script/src/env.rs34 symbols
bsan-script/src/commands.rs34 symbols
bsan-rt/src/tree_borrows/tree/tests.rs33 symbols
cargo-bsan/src/util.rs32 symbols

For agents

$ claude mcp add bsan \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page