Code Monkey home page Code Monkey logo

rust-mir-checker's People

Contributors

lizhuohua avatar thealgorythm avatar vikramnitin9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-mir-checker's Issues

cannot open shared object file: No such file or directory

Hi:

An error occurs when I operate according to the readme document.

target/debug/mir-checker: error while loading shared libraries: librustc_driver-834924640dd700d5.so: 
cannot open shared object file: No such file or directory

The following is my system and operation steps

# System info
run@run:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 21.04
Release:        21.04
Codename:       hirsute

# Clone project
run@run:~$ git clone --recursive https://github.com/lizhuohua/rust-mir-checker.git

# Ubuntu install GMP, MPFR, PPL and Z3:
run@run:~/rust-mir-checker$ sudo apt-get install libgmp-dev libmpfr-dev libppl-dev libz3-dev

# Install nightly-2020-20-29:
run@run:~/rust-mir-checker$ rustup toolchain list
no installed toolchains
run@run:~/rust-mir-checker$ rustup toolchain install nightly-2020-12-29

# Rustc-dev and llvm-tools-preview:
run@run:~/rust-mir-checker$ rustup component add rustc-dev llvm-tools-preview

# There are no errors in build & install

Create examples/loop-buffer-overflow.rs and write simple example

run@run:~/rust-mir-checker$ target/debug/mir-checker examples/loop-buffer-overflow.rs --entry main 
--domain interval --widening_delay 5 --narrowing_iteration 5
target/debug/mir-checker: error while loading shared libraries: librustc_driver-834924640dd700d5.so: 
cannot open shared object file: No such file or directory

Entry the tests floder and run the run.py

run@run:~/rust-mir-checker/tests$ python run.py 
rust-mir-checker/target/debug/cargo-mir-checker: error while loading shared libraries: librustc_driver-834924640dd700d5.so:
 cannot open shared object file: No such file or directory
......
rust-mir-checker/target/debug/cargo-mir-checker: error while loading shared libraries: librustc_driver-834924640dd700d5.so: 
cannot open shared object file: No such file or directory
All abstract domains cannot reason about the verification conditions for "alloc-test"

I didn't get a warning message that should appear

upgrade rust-toolchain

I compiled cargo-mir-checker and run it in our project.

run@run:~/test$ cargo-mir-checker mir-checker    
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
   --> .cargo/registry/src/github.com-1ecc6299db9ec823/lock_api-0.4.5/src/rwlock.rs:355:6
    |
355 | impl<R: RawRwLock, T> RwLock<R, T> {
    |      ^
    |
    = note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
    = help: add `#![feature(const_fn)]` to the crate attributes to enable

For more information about this error, try `rustc --explain E0723`.
error: could not compile `lock_api` due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: build failed

Compile error due to rust-toolchain problem.

Modify mir-checker rust-toolchain to nightly-2021-08-20 and compile.

run@run:~/rust-project/rust-mir-checker$ cargo install --path .


error[E0615]: attempted to take value of method `ty` on type `&ConstantKind<'_>`
    --> src/analysis/mir_visitor/block_visitor.rs:1478:25
     |
1478 |                 literal.ty
     |                         ^^ method, not a field
     |
help: use parentheses to call the method
     |
1478 |                 literal.ty()
     |                           ++

e                              ^^^^ function or associated item not found in `Binder<'_, _>`

Caused by:
  could not compile `rust-mir-checker` due to 49 previous errors


Do you have a plan to upgrade the rust toolchain?

cargo install error

hello author,
I cant build this project by "cargo install --path ." the error like this:

error: failed to compile `rust-mir-checker v0.1.0 (/home/dell/rust/rust-mir-checker)`, intermediate artifacts can be found at `/home/dell/rust/rust-mir-checker/target`

Caused by:
  failed to download `object v0.30.3`

Caused by:
  unable to get packages from source

Caused by:
  failed to download replaced source registry `https://github.com/rust-lang/crates.io-index`

Caused by:
  failed to parse manifest at `/home/dell/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/object-0.30.3/Cargo.toml`

Caused by:
  feature `resolver` is required

  consider adding `cargo-features = ["resolver"]` to the manifest

I try to add cargo-features = ["resolver"] ,but cant fix this problem, and try to install object v0.30.3 by offline, but the error still exists
I want to check projects built by cargo ,so I hope you can help me fix this problem

compile error with: "cargo install --path ."

Dear authors, thanks for creating this analyzer for the Rust community!
I have followed your instructions and change my cargo version to "nightly-2020-12-29", but when I ran "cargo install --path ." below error occurred. Can you please take a look? Any help would be appreciated! FYI: "cargo build" works well.

error: failed to compile rust-mir-checker v0.1.0 (/home/dennis/Documents/Rust_Project/Static_Analyzer/rust-mir-checker), intermediate artifacts can be found at /home/dennis/Documents/Rust_Project/Static_Analyzer/rust-mir-checker/target

Caused by:
failed to download gmp-mpfr-sys v1.5.0

Caused by:
unable to get packages from source

Caused by:
failed to parse manifest at /home/dennis/.cargo/registry/src/github.com-1ecc6299db9ec823/gmp-mpfr-sys-1.5.0/Cargo.toml

Caused by:
failed to parse the edition key

Caused by:
this version of Cargo is older than the 2021 edition, and only supports 2015 and 2018 editions.

Running on library crates

Hello, is it possible for running mir-checker directly on some library crate? In such a case there wont be a "entry" function. How can I possibly run mir-checker directly on crates that are just libraries?

Compilation fails due to missing dependency

Hello, just wanting to try out the tool and I can't get it to compile (not a Rust user here, more interested in the yet-another-static-analysis tool angle). The issue:

$ cargo install --path .
  Installing rust-mir-checker v0.1.0 (/home/lift/rust-mir)
    Updating crates.io index
   Compiling rust-mir-checker v0.1.0 (/home/lift/rust-mir)
error[E0463]: can't find crate for `rustc_ast`
 --> src/lib.rs:7:1
  |
7 | extern crate rustc_ast;
  | ^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

Adding to the cargo.toml didn't help since the ast package itself didn't build with this nightly.

Build failed due to proc-macro2

I have the following Dockerfile in an attempt to build your system.

From rust:latest

COPY . /home/rust-mir-checker
WORKDIR /home/rust-mir-checker

RUN rustup override set nightly-2020-12-29
RUN rustup component add rustc-dev llvm-tools-preview
RUN apt-get -y update
RUN apt-get -y install libgmp-dev libmpfr-dev libppl-dev libz3-dev

RUN cargo --version
RUN cargo install --path .

CMD ["/bin/bash"]

However, during build, I have the following error:

   Compiling clang-sys v0.28.1
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

   Compiling aho-corasick v0.7.19
   Compiling object v0.29.0
error: aborting due to previous error

For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0635`.
error: failed to compile `rust-mir-checker v0.1.0 (/home/rust-mir-checker)`, intermediate artifacts can be found at `/home/rust-mir-checker/target`

Caused by:
  build failed
The command '/bin/sh -c cargo install --path .' returned a non-zero code: 101

Do I miss anything?

error while loading shared libraries

I compiled mir-checker and test it in the tests/safe-bugs/division-by-zero/src/main.rs
but :

xl@zone:~/rust-mir-checker$ target/debug/mir-checker tests/safe-bugs/division-by-zero/src/main.rs --entry main --domain
interval --widening_delay 5 --narrowing_iteration 5
target/debug/mir-checker: error while loading shared libraries: librustc_driver-834924640dd700d5.so: cannot open shared
object file: No such file or directory

how can i slove it?

Failed to test due to panic

During analyzing the following code, the mir-checker failed due to a panic error.

use http::header::HeaderMap;
fn case() {
    let mut map = HeaderMap::with_capacity(32);
    map.insert("1", DropDetector(1));
    map.insert("2", DropDetector(2));

    let mut drain = map.drain();
    drain.next();
    std::mem::forget(drain);
}

Cargo.toml:

[dependencies]
http = "0.1.19"

The following is the way I tried:

root@8dc876f78d20:/home/rust-mir-checker/rudra-poc/http# ./../../target/debug/cargo-mir-checker mir-checker -- --entry main --domain interval --widening_delay 5 --narrowing_iteration 5
    Checking http v0.1.0 (/home/rust-mir-checker/rudra-poc/http)
thread 'rustc' panicked at 'panic in fold1', src/analysis/mir_visitor/call_visitor.rs:190:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: could not compile `http`

To learn more, run the command again with --verbose.

The following code causes the panic:

// Compute the join of all the basic blocks that contain a return terminator
 let joined_state = post
       .into_iter()
       .filter(|(bb, _domain)| body_visitor.result_blocks.contains(bb))
       .map(|(_bb, domain)| domain)
       .fold1(|state1, state2| state1.join(&state2))
       .expect("panic in fold1");

Native cargo can build the case successfully.

root@8dc876f78d20:/home/rust-mir-checker/rudra-poc/http# cargo --version
cargo 1.50.0-nightly (75d5d8cff 2020-12-22)
root@8dc876f78d20:/home/rust-mir-checker/rudra-poc/http# cargo build 
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s

Can you suggest a fix for the issue or explain the reasoning?

Thread 'rustc' panicked at 'panic in fold1'.

Hi, I am trying to run MirChecker for my project
RUSTSEC-2018-0008.zip

My project can be compiled without errors using cargo.

Checking RUSTSEC-2018-0008 v0.1.0 (/Users/thanhdeku/Documents/Research/Melbourne/Detection/rust-mir-checker/rust-study/section-5-memory-safety-issues/reproduced-bugs/cve/RUSTSEC-2018-0008)
warning: crate `RUSTSEC_2018_0008` should have a snake case name
  |
  = note: `#[warn(non_snake_case)]` on by default
  = help: convert the identifier to snake case: `rustsec_2018_0008`

warning: 1 warning emitted

    Finished dev [unoptimized + debuginfo] target(s) in 0.23s

However, MirChecker, cannot compile it.

warning: crate `RUSTSEC_2018_0008` should have a snake case name
  |
  = note: `#[warn(non_snake_case)]` on by default
  = help: convert the identifier to snake case: `rustsec_2018_0008`

thread 'rustc' panicked at 'panic in fold1', src/analysis/mir_visitor/call_visitor.rs:190:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: 1 warning emitted

error: could not compile `RUSTSEC-2018-0008`

I wonder if you know why does the situation happen ?
Many thanks. Have a good day.

*Note: To run/compile my project, please follow instructions in main.rs

Please archive this repository

Dear author,

As you can see in the issues, people actually try to check this out.
Problem is, that this does not compile anymore.
To stop wasting peoples time, please either fix the description on how to compile this or please set the repository to "archived".

Thanks.

Wasted hours here: 2.
@everyone: Feel free to add more wasted hours below.

Release version wanted

Why not prepare a compiled release version? I have encountered multiple compile errors.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.