Skip to content

Propose a 2025H2 goal for emitting retags in codegen #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

icmccorm
Copy link

@icmccorm icmccorm commented Jul 18, 2025

Retag intrinsics are necessary for finding aliasing bugs. We can support new types of bug-finding tools by providing a way to lower retags from MIR into codegen backends.

Rendered


Miri has a unique role for the Rust community as the only tool that can find violations of Rust's evolving aliasing models. However, Miri is significantly slower than native execution, and it does not support finding aliasing violations triggered by foreign function calls. Lack of FFI support has prevented developers from finding aliasing bugs in real-world libraries—including one maintained by the Rust project ([`flate2-rs`](https://github.com/rust-lang/flate2-rs/issues/392))! We need a new approach for finding these bugs in the large-scale, multi-language projects where Rust is being adopted.

We could provide both better performance and support for multilanguage applications by inserting native run-time checks into shared formats like LLVM IR. These checks could be implemented in several different ways, possibly as [an extension to Valgrind](https://github.com/pnkfelix/krabcake) or [a new LLVM sanitizer](https://borrowsanitizer.com/). However, we can fully prototype any of these approaches, we need a way to take the type information that Miri uses to find aliasing violations and lower it into Rust's codegen backends, where it can be used to determine where and how to insert these run-time checks.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
We could provide both better performance and support for multilanguage applications by inserting native run-time checks into shared formats like LLVM IR. These checks could be implemented in several different ways, possibly as [an extension to Valgrind](https://github.com/pnkfelix/krabcake) or [a new LLVM sanitizer](https://borrowsanitizer.com/). However, we can fully prototype any of these approaches, we need a way to take the type information that Miri uses to find aliasing violations and lower it into Rust's codegen backends, where it can be used to determine where and how to insert these run-time checks.
We could provide both better performance and support for multilanguage applications by inserting native run-time checks into shared formats like LLVM IR. These checks could be implemented in several different ways, possibly as [an extension to Valgrind](https://github.com/pnkfelix/krabcake) or [a new LLVM sanitizer](https://borrowsanitizer.com/). However, before we can fully prototype any of these approaches, we need a way to take the type information that Miri uses to find aliasing violations and lower it into Rust's codegen backends, where it can be used to determine where and how to insert these run-time checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants