• This repository has been archived on 22/Aug/2024
  • Stars
    star
    1,004
  • Rank 45,731 (Top 1.0 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust mid-level IR Abstract Interpreter

MIRAI codecov deps.rs

MIRAI is an abstract interpreter for the Rust compiler's mid-level intermediate representation (MIR). It is intended to become a widely used static analysis tool for Rust.

Request for Proposals

The Web3 Foundation has an RFP for extending MIRAI. If you are interested in making a proposal, feel free to do so and expect to count on support with design reviews, coding and merging your contributions. Contact [email protected] if you want to discuss this further.

Who should use MIRAI

MIRAI can be used as a linter that finds panics that may be unintentional or are not the best way to terminate a program. This use case generally requires no annotations and is best realized by integrating MIRAI into a CI pipeline.

MIRAI can also be used to verify correctness properties. Such properties need to be encoded into annotations of the source program.

A related use is to better document an API via explicit precondition annotations and then use MIRAI to check that the annotations match the code.

Finally, MIRAI can be used to look for security bugs via taint analysis (information leaks, code injection bugs, etc.) and constant time analysis (information leaks via side channels). Unintentional (or ill-considered) panics can also become security problems (denial of service, undefined behavior).

How to use MIRAI

You'll need to install MIRAI as described here.

Then use cargo mirai to run MIRAI over your current package. This works much like cargo check but uses MIRAI rather than rustc to analyze the targets of your current package.

This will likely produce some warnings. Some of these will be real issues (true positives) that you'll fix by changing the offending code. Other warnings will be due to limitations of MIRAI and you can silence them by adding annotations declared in this crate.

Once MIRAI gives your code a clean bill of health, your code will be better documented and more readable. Perhaps you'll also have found and fixed a few bugs.

You can use the environment variable MIRAI_FLAGS to get cargo to provide command line options to MIRAI. The value is a string which can contain any of the following flags:

  • --diag=default|verify|library|paranoid: configures level of diagnostics. With default MIRAI will not report errors which are potential 'false positives'. With verify it will point out functions that may contain such errors. With library it will require explicit preconditions. With paranoid it will flag any issue that may be an error.
  • --single_func <name>: the name of a specific function you want to analyze.
  • --body_analysis_timeout <seconds>: the maximum number of seconds to spend analyzing a function body.
  • --call_graph_config <path_to_config>: path to configuration file for call graph generator (see Call Graph Generator documentation). No call graph will be generated if this is not specified.
  • --print_function_names: just print the source location and fully qualified function signature of every function.
  • --: any arguments after this marker are passed on to rustc.

You can get some insight into the inner workings of MIRAI by setting the verbosity level of log output to one of warn, info, debug, or trace, via the environment variable MIRAI_LOG.

Developing MIRAI

See the developer guide for instructions on how to build, run and debug MIRAI.

Full documentation

Join the MIRAI community

See the CONTRIBUTING file for how to help out.

License

MIRAI is MIT licensed, as found in the LICENSE file.

More Repositories

1

Recoil

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
JavaScript
19,610
star
2

libunifex

Unified Executors
C++
1,479
star
3

hermit

Hermit launches linux x86_64 programs in a special, hermetically isolated sandbox to control their execution. Hermit translates normal, nondeterministic behavior, into deterministic, repeatable behavior. This can be used for various applications, including replay-debugging, reproducible artifacts, chaos mode concurrency testing and bug analysis.
Rust
1,189
star
4

Robyn

Robyn is an experimental, AI/ML-powered and open sourced Marketing Mix Modeling (MMM) package from Meta Marketing Science. Our mission is to democratise modeling knowledge, inspire the industry through innovation, reduce human bias in the modeling process & build a strong open source marketing science community.
Jupyter Notebook
1,104
star
5

reverie

An ergonomic and safe syscall interception framework for Linux.
Rust
544
star
6

ExtendedAndroidTools

Extended Android Tools is a place to host and maintain a build environment and makefiles cross compiling Linux tools we all love for Android.
Python
174
star
7

object-introspection

Object Introspection (OI) enables on-demand, hierarchical profiling of objects in arbitrary C/C++ programs with no recompilation.
C++
153
star
8

resctl-demo

Demonstrate and benchmark various features of Linux resource control in a self-contained package.
Rust
149
star
9

allocative

Library and proc macro to analyze memory usage of data structures in rust.
Rust
125
star
10

rust-shed

Repository containing Rust crates common between other Facebook open source projects (like Mononoke or Eden).
Rust
102
star
11

go-media-webtransport-server

WebTransport media server that enables ultra low latency live streaming over QUIC (also VOD and rewind)
Go
94
star
12

webcodecs-capture-play

Live streaming low latency experimentation platform in the browser (using WebCodecs)
JavaScript
88
star
13

moq-encoder-player

This project is provides a minimal implementation (inside the browser) of a live video and audio encoder and video / audio player creating and consuming IETF MOQ stream. The goal is to provide a minimal live platform components that helps testing IETF MOQ interop
HTML
50
star
14

siMMMulator

siMMMulator is an open source R-package that helps users to generate simulated data to plug into Marketing Mix Models (MMMs). The package features a variety of functions to help users build a data set from scratch.
R
45
star
15

moq-go-server

This is an experimental relay (optimized for low latency media transfers) that implements IETF MOQ protocol
Go
43
star
16

MemorySnapshotAnalyzer

Analysis tooling for memory snapshots of managed code runtimes, specifically, Unity Memory Snapshots.
C#
31
star
17

protoquant

Prototype routines for GPU quantization written using PyTorch.
Python
19
star
18

moxygen

Implementation of IETF MOQ protocol
Python
15
star
19

kperf

TCP and TLS performance testing tool.
C
11
star
20

edencommon

Shared library for Watchman and Eden projects.
C++
11
star
21

propellint

A tool joining profile information with static analysis.
C++
5
star
22

r8

Customized version of the D8 dexer and R8 shrinker
Java
5
star
23

usb-video

Android library and app for streaming content from USB Video Class (UVC) devices.
C++
4
star
24

CARL

Classical Action Recognition Library
C++
4
star
25

WMG

Serverless Application Model (SAM) project to deploy a Cloudformation insfrastructure capable of measuring signals in WhatsApp conversations.
JavaScript
3
star
26

iot-session-manager

The IoT Session Manager is an application that provides a reliable and scalable device to device messaging network with simple setup. The system is deployable locally on a machine or on a cloud server and provides extensible methods for device authentication and control automation.
Python
3
star
27

free-threading-benchmarking

Benchmark results for free-threaded builds of Python
3
star
28

xrpa

Xrpa (pronounced "zerpa") is a platform architecture framework for building experimental XR experiences.
C++
3
star
29

fnob

Open source Fnob (Command-line Dynamic Random Generator) package;
SystemVerilog
2
star
30

Rmdkernel

This is a very simple fork of https//github.com/IRkernel/IRkernel to provide an rmarkdown (rather than R) jupyter kernel.
Jupyter Notebook
2
star
31

ndctl

A "device memory" enabling project encompassing tools and libraries for CXL, NVDIMMs, DAX, memory tiering and other platform memory device topics. Forked from https://github.com/pmem/ndctl
C
2
star
32

csproj_benchmark

A tool that generates Visual Studio C# projects and measures IDE startup performance
C#
1
star