diff --git a/README.md b/README.md index c6787b2..6e17616 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# ![logo](rap_logo.png) -RAP is a static Rust analysis platform developed by researchers at [Artisan-Lab](https://hxuhack.github.io), Fudan University. The project aims to provide a foundation for Rust programmers to develop or use advanced static analysis features beyond those offered by the rustc compiler. For further details, please refer to the [RAP-Book](https://artisan-lab.github.io/RAP-Book). +# ![logo](rapx_logo.png) +RAPx is a static Rust analysis platform developed by researchers at [Artisan-Lab](https://hxuhack.github.io), Fudan University. The project aims to provide a foundation for Rust programmers to develop or use advanced static analysis features beyond those offered by the rustc compiler. For further details, please refer to the [RAPx-Book](https://artisan-lab.github.io/RAPx-Book). The project is still under heavy development. ## Quick Start -Install `nightly-2024-10-12` on which rap is compiled with. This just needs to do once on your machine. If the toolchain exists, +Install `nightly-2024-10-12` on which rapx is compiled with. This just needs to do once on your machine. If the toolchain exists, this will do nothing. ```shell rustup toolchain install nightly-2024-10-12 --profile minimal --component rustc-dev,rust-src,llvm-tools-preview -cargo +nightly-2024-10-12 install rap --git https://github.com/Artisan-Lab/RAP.git +cargo +nightly-2024-10-12 install rapx --git https://github.com/Artisan-Lab/RAP.git ``` ## Usage -Navigate to your Rust project folder containing a `Cargo.toml` file. Then run `cargo-rap` with [toolchain override shorthand syntax]. +Navigate to your Rust project folder containing a `Cargo.toml` file. Then run `cargo-rapx` with [toolchain override shorthand syntax]. [toolchain override shorthand syntax]: https://rust-lang.github.io/rustup/overrides.html#toolchain-override-shorthand ```shell -cargo rap [rap options] -- [cargo check options] +cargo rapx [rapx options] -- [cargo check options] where `-- [cargo check options]` is optional, and if specified, they are passed to cargo check. ``` @@ -28,17 +28,17 @@ where `-- [cargo check options]` is optional, and if specified, they are passed Alternatively, you can switch to the pinned toolchain ahead of time: ```rust -# set up rap's toolchain as default +# set up rapx's toolchain as default rustup default nightly-2024-10-12 -# run cargo rap without +toolchain syntax any more -cargo rap [rap options] -- [cargo check options] +# run cargo rapx without +toolchain syntax any more +cargo rap [rapx options] -- [cargo check options] ``` Check out supported options with `-help`: ```shell -cargo +nightly-2024-10-12 rap -help +cargo +nightly-2024-10-12 rapx -help ``` Environment variables (Values are case insensitive): @@ -54,12 +54,12 @@ For `RAP_RECURSIVE`: * shallow: check for current workpace members * deep: check for all workspaces from current folder -NOTE: for shallow or deep, rap will enter each member folder to do the check. +NOTE: for shallow or deep, rapx will enter each member folder to do the check. ### Use-After-Free Detection Detect bugs such as use-after-free and double free in Rust crates caused by unsafe code. ```shell -cargo +nightly-2024-10-12 rap -uaf +cargo +nightly-2024-10-12 rapx -uaf ``` If RAP gets stuck after executing `cargo clean`, try manually downloading metadata dependencies by running `cargo metadata`. @@ -82,7 +82,7 @@ The feature is based on our SafeDrop paper, which was published in TOSEM. Detect memory leakage bugs caused by apis like [ManuallyDrop](https://doc.rust-lang.org/std/mem/struct.ManuallyDrop.html) and [into_raw()](https://doc.rust-lang.org/std/boxed/struct.Box.html#method.into_raw). ```shell -cargo +nightly-2024-10-12 rap -mleak +cargo +nightly-2024-10-12 rapx -mleak ``` The feature is based on our rCanary work, which was published in TSE diff --git a/install.sh b/install.sh index 65ee1bb..4e12a6f 100755 --- a/install.sh +++ b/install.sh @@ -2,6 +2,6 @@ set -e -cargo install --path rap +cargo install --path rapx -cargo rap -help +cargo rapx -help diff --git a/rap/Cargo.lock b/rap/Cargo.lock deleted file mode 100644 index 183b21b..0000000 --- a/rap/Cargo.lock +++ /dev/null @@ -1,879 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "annotate-snippets" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e35ed54e5ea7997c14ed4c70ba043478db1112e98263b3b035907aa197d991" -dependencies = [ - "anstyle", - "unicode-width", -] - -[[package]] -name = "anstyle" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "bindgen" -version = "0.66.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.87", -] - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "camino" -version = "1.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-targets 0.48.5", -] - -[[package]] -name = "clang-sys" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "colored" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" -dependencies = [ - "is-terminal", - "lazy_static", - "winapi", -] - -[[package]] -name = "colorful" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97af0562545a7d7f3d9222fcf909963bec36dcb502afaacab98c6ffac8da47ce" - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "fern" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" -dependencies = [ - "colored", - "log", -] - -[[package]] -name = "gimli" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "iana-time-zone" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys", -] - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.148" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cdc71e17332e86d2e1d38c1f99edcb6288ee11b815fb1a4b049eaa2114d369b" - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-traits" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "proc-macro2" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rap" -version = "1.0.0" -dependencies = [ - "annotate-snippets", - "cargo_metadata", - "chrono", - "colorful", - "fern", - "lazy_static", - "log", - "once_cell", - "regex", - "rustc-demangle", - "serde_json", - "snafu", - "wait-timeout", - "walkdir", - "z3", -] - -[[package]] -name = "regex" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.215" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - -[[package]] -name = "serde_json" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "shlex" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" - -[[package]] -name = "snafu" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" -dependencies = [ - "backtrace", - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.87", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "z3" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a7ff5718c079e7b813378d67a5bed32ccc2086f151d6185074a7e24f4a565e8" -dependencies = [ - "log", - "z3-sys", -] - -[[package]] -name = "z3-sys" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cf70fdbc0de3f42b404f49b0d4686a82562254ea29ff0a155eef2f5430f4b0" -dependencies = [ - "bindgen", -] diff --git a/rap/Cargo.toml b/rapx/Cargo.toml similarity index 62% rename from rap/Cargo.toml rename to rapx/Cargo.toml index 12a8945..d26ffd6 100644 --- a/rap/Cargo.toml +++ b/rapx/Cargo.toml @@ -1,20 +1,24 @@ [package] -name = "rap" -version = "1.0.0" -edition = "2018" -authors = ["Moran Tsui "] -default-run = "rap" +name = "rapx" +version = "0.1.0" +edition = "2021" +authors = ["Artisan-Lab "] +default-run = "rapx" +license = "MPL" +description = "A static analysis platform for use-after-free, memory leakage detection, etc" +homepage = "https://github.com/Artisan-Lab/RAPx" +readme = "https://github.com/Artisan-Lab/RAPx/README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [[bin]] -name = "rap" +name = "rapx" [[bin]] -name = "cargo-rap" +name = "cargo-rapx" [lib] -name = "rap" +name = "rapx" [dependencies] lazy_static = "1.4" diff --git a/rap/src/analysis.rs b/rapx/src/analysis.rs similarity index 100% rename from rap/src/analysis.rs rename to rapx/src/analysis.rs diff --git a/rap/src/analysis/core.rs b/rapx/src/analysis/core.rs similarity index 100% rename from rap/src/analysis/core.rs rename to rapx/src/analysis/core.rs diff --git a/rap/src/analysis/core/alias.rs b/rapx/src/analysis/core/alias.rs similarity index 100% rename from rap/src/analysis/core/alias.rs rename to rapx/src/analysis/core/alias.rs diff --git a/rap/src/analysis/core/alias/mop.rs b/rapx/src/analysis/core/alias/mop.rs similarity index 100% rename from rap/src/analysis/core/alias/mop.rs rename to rapx/src/analysis/core/alias/mop.rs diff --git a/rap/src/analysis/core/alias/mop/alias.rs b/rapx/src/analysis/core/alias/mop/alias.rs similarity index 100% rename from rap/src/analysis/core/alias/mop/alias.rs rename to rapx/src/analysis/core/alias/mop/alias.rs diff --git a/rap/src/analysis/core/alias/mop/graph.rs b/rapx/src/analysis/core/alias/mop/graph.rs similarity index 100% rename from rap/src/analysis/core/alias/mop/graph.rs rename to rapx/src/analysis/core/alias/mop/graph.rs diff --git a/rap/src/analysis/core/alias/mop/mop.rs b/rapx/src/analysis/core/alias/mop/mop.rs similarity index 100% rename from rap/src/analysis/core/alias/mop/mop.rs rename to rapx/src/analysis/core/alias/mop/mop.rs diff --git a/rap/src/analysis/core/alias/mop/types.rs b/rapx/src/analysis/core/alias/mop/types.rs similarity index 100% rename from rap/src/analysis/core/alias/mop/types.rs rename to rapx/src/analysis/core/alias/mop/types.rs diff --git a/rap/src/analysis/core/call_graph.rs b/rapx/src/analysis/core/call_graph.rs similarity index 100% rename from rap/src/analysis/core/call_graph.rs rename to rapx/src/analysis/core/call_graph.rs diff --git a/rap/src/analysis/core/call_graph/call_graph_helper.rs b/rapx/src/analysis/core/call_graph/call_graph_helper.rs similarity index 100% rename from rap/src/analysis/core/call_graph/call_graph_helper.rs rename to rapx/src/analysis/core/call_graph/call_graph_helper.rs diff --git a/rap/src/analysis/core/call_graph/call_graph_visitor.rs b/rapx/src/analysis/core/call_graph/call_graph_visitor.rs similarity index 100% rename from rap/src/analysis/core/call_graph/call_graph_visitor.rs rename to rapx/src/analysis/core/call_graph/call_graph_visitor.rs diff --git a/rap/src/analysis/core/dataflow.rs b/rapx/src/analysis/core/dataflow.rs similarity index 100% rename from rap/src/analysis/core/dataflow.rs rename to rapx/src/analysis/core/dataflow.rs diff --git a/rap/src/analysis/core/dataflow/debug.rs b/rapx/src/analysis/core/dataflow/debug.rs similarity index 100% rename from rap/src/analysis/core/dataflow/debug.rs rename to rapx/src/analysis/core/dataflow/debug.rs diff --git a/rap/src/analysis/core/dataflow/graph.rs b/rapx/src/analysis/core/dataflow/graph.rs similarity index 100% rename from rap/src/analysis/core/dataflow/graph.rs rename to rapx/src/analysis/core/dataflow/graph.rs diff --git a/rap/src/analysis/core/heap_item.rs b/rapx/src/analysis/core/heap_item.rs similarity index 100% rename from rap/src/analysis/core/heap_item.rs rename to rapx/src/analysis/core/heap_item.rs diff --git a/rap/src/analysis/core/heap_item/ownership.rs b/rapx/src/analysis/core/heap_item/ownership.rs similarity index 100% rename from rap/src/analysis/core/heap_item/ownership.rs rename to rapx/src/analysis/core/heap_item/ownership.rs diff --git a/rap/src/analysis/core/heap_item/type_visitor.rs b/rapx/src/analysis/core/heap_item/type_visitor.rs similarity index 100% rename from rap/src/analysis/core/heap_item/type_visitor.rs rename to rapx/src/analysis/core/heap_item/type_visitor.rs diff --git a/rap/src/analysis/opt.rs b/rapx/src/analysis/opt.rs similarity index 100% rename from rap/src/analysis/opt.rs rename to rapx/src/analysis/opt.rs diff --git a/rap/src/analysis/opt/checking.rs b/rapx/src/analysis/opt/checking.rs similarity index 100% rename from rap/src/analysis/opt/checking.rs rename to rapx/src/analysis/opt/checking.rs diff --git a/rap/src/analysis/opt/checking/bounds_checking.rs b/rapx/src/analysis/opt/checking/bounds_checking.rs similarity index 100% rename from rap/src/analysis/opt/checking/bounds_checking.rs rename to rapx/src/analysis/opt/checking/bounds_checking.rs diff --git a/rap/src/analysis/opt/checking/bounds_checking/bounds_len.rs b/rapx/src/analysis/opt/checking/bounds_checking/bounds_len.rs similarity index 100% rename from rap/src/analysis/opt/checking/bounds_checking/bounds_len.rs rename to rapx/src/analysis/opt/checking/bounds_checking/bounds_len.rs diff --git a/rap/src/analysis/opt/checking/bounds_checking/bounds_loop_push.rs b/rapx/src/analysis/opt/checking/bounds_checking/bounds_loop_push.rs similarity index 100% rename from rap/src/analysis/opt/checking/bounds_checking/bounds_loop_push.rs rename to rapx/src/analysis/opt/checking/bounds_checking/bounds_loop_push.rs diff --git a/rap/src/analysis/opt/memory_cloning.rs b/rapx/src/analysis/opt/memory_cloning.rs similarity index 100% rename from rap/src/analysis/opt/memory_cloning.rs rename to rapx/src/analysis/opt/memory_cloning.rs diff --git a/rap/src/analysis/opt/memory_cloning/hash_key_cloning.rs b/rapx/src/analysis/opt/memory_cloning/hash_key_cloning.rs similarity index 100% rename from rap/src/analysis/opt/memory_cloning/hash_key_cloning.rs rename to rapx/src/analysis/opt/memory_cloning/hash_key_cloning.rs diff --git a/rap/src/analysis/opt/memory_cloning/used_as_immutable.rs b/rapx/src/analysis/opt/memory_cloning/used_as_immutable.rs similarity index 100% rename from rap/src/analysis/opt/memory_cloning/used_as_immutable.rs rename to rapx/src/analysis/opt/memory_cloning/used_as_immutable.rs diff --git a/rap/src/analysis/rcanary.rs b/rapx/src/analysis/rcanary.rs similarity index 100% rename from rap/src/analysis/rcanary.rs rename to rapx/src/analysis/rcanary.rs diff --git a/rap/src/analysis/rcanary/ranalyzer.rs b/rapx/src/analysis/rcanary/ranalyzer.rs similarity index 100% rename from rap/src/analysis/rcanary/ranalyzer.rs rename to rapx/src/analysis/rcanary/ranalyzer.rs diff --git a/rap/src/analysis/rcanary/ranalyzer/inter_visitor.rs b/rapx/src/analysis/rcanary/ranalyzer/inter_visitor.rs similarity index 100% rename from rap/src/analysis/rcanary/ranalyzer/inter_visitor.rs rename to rapx/src/analysis/rcanary/ranalyzer/inter_visitor.rs diff --git a/rap/src/analysis/rcanary/ranalyzer/intra_visitor.rs b/rapx/src/analysis/rcanary/ranalyzer/intra_visitor.rs similarity index 100% rename from rap/src/analysis/rcanary/ranalyzer/intra_visitor.rs rename to rapx/src/analysis/rcanary/ranalyzer/intra_visitor.rs diff --git a/rap/src/analysis/rcanary/ranalyzer/order.rs b/rapx/src/analysis/rcanary/ranalyzer/order.rs similarity index 100% rename from rap/src/analysis/rcanary/ranalyzer/order.rs rename to rapx/src/analysis/rcanary/ranalyzer/order.rs diff --git a/rap/src/analysis/rcanary/ranalyzer/ownership.rs b/rapx/src/analysis/rcanary/ranalyzer/ownership.rs similarity index 100% rename from rap/src/analysis/rcanary/ranalyzer/ownership.rs rename to rapx/src/analysis/rcanary/ranalyzer/ownership.rs diff --git a/rap/src/analysis/safedrop.rs b/rapx/src/analysis/safedrop.rs similarity index 100% rename from rap/src/analysis/safedrop.rs rename to rapx/src/analysis/safedrop.rs diff --git a/rap/src/analysis/safedrop/alias.rs b/rapx/src/analysis/safedrop/alias.rs similarity index 100% rename from rap/src/analysis/safedrop/alias.rs rename to rapx/src/analysis/safedrop/alias.rs diff --git a/rap/src/analysis/safedrop/bug_records.rs b/rapx/src/analysis/safedrop/bug_records.rs similarity index 100% rename from rap/src/analysis/safedrop/bug_records.rs rename to rapx/src/analysis/safedrop/bug_records.rs diff --git a/rap/src/analysis/safedrop/check_bugs.rs b/rapx/src/analysis/safedrop/check_bugs.rs similarity index 100% rename from rap/src/analysis/safedrop/check_bugs.rs rename to rapx/src/analysis/safedrop/check_bugs.rs diff --git a/rap/src/analysis/safedrop/corner_handle.rs b/rapx/src/analysis/safedrop/corner_handle.rs similarity index 100% rename from rap/src/analysis/safedrop/corner_handle.rs rename to rapx/src/analysis/safedrop/corner_handle.rs diff --git a/rap/src/analysis/safedrop/graph.rs b/rapx/src/analysis/safedrop/graph.rs similarity index 100% rename from rap/src/analysis/safedrop/graph.rs rename to rapx/src/analysis/safedrop/graph.rs diff --git a/rap/src/analysis/safedrop/safedrop.rs b/rapx/src/analysis/safedrop/safedrop.rs similarity index 100% rename from rap/src/analysis/safedrop/safedrop.rs rename to rapx/src/analysis/safedrop/safedrop.rs diff --git a/rap/src/analysis/safedrop/types.rs b/rapx/src/analysis/safedrop/types.rs similarity index 100% rename from rap/src/analysis/safedrop/types.rs rename to rapx/src/analysis/safedrop/types.rs diff --git a/rap/src/analysis/senryx.rs b/rapx/src/analysis/senryx.rs similarity index 100% rename from rap/src/analysis/senryx.rs rename to rapx/src/analysis/senryx.rs diff --git a/rap/src/analysis/senryx/contracts/abstract_state.rs b/rapx/src/analysis/senryx/contracts/abstract_state.rs similarity index 100% rename from rap/src/analysis/senryx/contracts/abstract_state.rs rename to rapx/src/analysis/senryx/contracts/abstract_state.rs diff --git a/rap/src/analysis/senryx/contracts/checker.rs b/rapx/src/analysis/senryx/contracts/checker.rs similarity index 100% rename from rap/src/analysis/senryx/contracts/checker.rs rename to rapx/src/analysis/senryx/contracts/checker.rs diff --git a/rap/src/analysis/senryx/contracts/contract.rs b/rapx/src/analysis/senryx/contracts/contract.rs similarity index 100% rename from rap/src/analysis/senryx/contracts/contract.rs rename to rapx/src/analysis/senryx/contracts/contract.rs diff --git a/rap/src/analysis/senryx/contracts/mod.rs b/rapx/src/analysis/senryx/contracts/mod.rs similarity index 100% rename from rap/src/analysis/senryx/contracts/mod.rs rename to rapx/src/analysis/senryx/contracts/mod.rs diff --git a/rap/src/analysis/senryx/contracts/state_lattice.rs b/rapx/src/analysis/senryx/contracts/state_lattice.rs similarity index 100% rename from rap/src/analysis/senryx/contracts/state_lattice.rs rename to rapx/src/analysis/senryx/contracts/state_lattice.rs diff --git a/rap/src/analysis/senryx/inter_record.rs b/rapx/src/analysis/senryx/inter_record.rs similarity index 100% rename from rap/src/analysis/senryx/inter_record.rs rename to rapx/src/analysis/senryx/inter_record.rs diff --git a/rap/src/analysis/senryx/matcher.rs b/rapx/src/analysis/senryx/matcher.rs similarity index 100% rename from rap/src/analysis/senryx/matcher.rs rename to rapx/src/analysis/senryx/matcher.rs diff --git a/rap/src/analysis/senryx/visitor.rs b/rapx/src/analysis/senryx/visitor.rs similarity index 100% rename from rap/src/analysis/senryx/visitor.rs rename to rapx/src/analysis/senryx/visitor.rs diff --git a/rap/src/analysis/unsafety_isolation.rs b/rapx/src/analysis/unsafety_isolation.rs similarity index 100% rename from rap/src/analysis/unsafety_isolation.rs rename to rapx/src/analysis/unsafety_isolation.rs diff --git a/rap/src/analysis/unsafety_isolation/draw_dot.rs b/rapx/src/analysis/unsafety_isolation/draw_dot.rs similarity index 100% rename from rap/src/analysis/unsafety_isolation/draw_dot.rs rename to rapx/src/analysis/unsafety_isolation/draw_dot.rs diff --git a/rap/src/analysis/unsafety_isolation/generate_dot.rs b/rapx/src/analysis/unsafety_isolation/generate_dot.rs similarity index 100% rename from rap/src/analysis/unsafety_isolation/generate_dot.rs rename to rapx/src/analysis/unsafety_isolation/generate_dot.rs diff --git a/rap/src/analysis/unsafety_isolation/hir_visitor.rs b/rapx/src/analysis/unsafety_isolation/hir_visitor.rs similarity index 100% rename from rap/src/analysis/unsafety_isolation/hir_visitor.rs rename to rapx/src/analysis/unsafety_isolation/hir_visitor.rs diff --git a/rap/src/analysis/unsafety_isolation/isolation_graph.rs b/rapx/src/analysis/unsafety_isolation/isolation_graph.rs similarity index 100% rename from rap/src/analysis/unsafety_isolation/isolation_graph.rs rename to rapx/src/analysis/unsafety_isolation/isolation_graph.rs diff --git a/rap/src/analysis/utils.rs b/rapx/src/analysis/utils.rs similarity index 100% rename from rap/src/analysis/utils.rs rename to rapx/src/analysis/utils.rs diff --git a/rap/src/analysis/utils/def_path.rs b/rapx/src/analysis/utils/def_path.rs similarity index 100% rename from rap/src/analysis/utils/def_path.rs rename to rapx/src/analysis/utils/def_path.rs diff --git a/rap/src/analysis/utils/intrinsic_id.rs b/rapx/src/analysis/utils/intrinsic_id.rs similarity index 100% rename from rap/src/analysis/utils/intrinsic_id.rs rename to rapx/src/analysis/utils/intrinsic_id.rs diff --git a/rap/src/analysis/utils/show_mir.rs b/rapx/src/analysis/utils/show_mir.rs similarity index 100% rename from rap/src/analysis/utils/show_mir.rs rename to rapx/src/analysis/utils/show_mir.rs diff --git a/rap/src/bin/cargo-rap/args.rs b/rapx/src/bin/cargo-rapx/args.rs similarity index 97% rename from rap/src/bin/cargo-rap/args.rs rename to rapx/src/bin/cargo-rapx/args.rs index a72b0bd..aa19bc4 100644 --- a/rap/src/bin/cargo-rap/args.rs +++ b/rapx/src/bin/cargo-rapx/args.rs @@ -95,9 +95,9 @@ pub fn get_arg_flag_value(name: &str) -> Option<&'static str> { ARGS.get_arg_flag_value(name) } -/// `cargo rap [rap options] -- [cargo check options]` +/// `cargo rapx [rapx options] -- [cargo check options]` /// -/// Options before the first `--` are arguments forwarding to rap. +/// Options before the first `--` are arguments forwarding to rapx. /// Stuff all after the first `--` are arguments forwarding to cargo check. pub fn rap_and_cargo_args() -> [&'static [String]; 2] { [&ARGS.args_group1, &ARGS.args_group2] @@ -109,8 +109,8 @@ pub fn is_current_compile_crate() -> bool { } /// Returns true for crate types to be checked; -/// returns false for some special crate types that can't be handled by rap. -/// For example, checking proc-macro crates or build.rs can cause linking errors in rap. +/// returns false for some special crate types that can't be handled by rapx. +/// For example, checking proc-macro crates or build.rs can cause linking errors in rapx. pub fn filter_crate_type() -> bool { if let Some(s) = get_arg_flag_value("--crate-type") { return match s { diff --git a/rap/src/bin/cargo-rap/cargo_check.rs b/rapx/src/bin/cargo-rapx/cargo_check.rs similarity index 98% rename from rap/src/bin/cargo-rap/cargo_check.rs rename to rapx/src/bin/cargo-rapx/cargo_check.rs index 8e54269..ff18584 100644 --- a/rap/src/bin/cargo-rap/cargo_check.rs +++ b/rapx/src/bin/cargo-rapx/cargo_check.rs @@ -1,6 +1,6 @@ use crate::args; use cargo_metadata::camino::Utf8Path; -use rap::utils::log::rap_error_and_exit; +use rapx::utils::log::rap_error_and_exit; use std::{env, process::Command, time::Duration}; use wait_timeout::ChildExt; diff --git a/rap/src/bin/cargo-rap/cargo_check/workspace.rs b/rapx/src/bin/cargo-rapx/cargo_check/workspace.rs similarity index 92% rename from rap/src/bin/cargo-rap/cargo_check/workspace.rs rename to rapx/src/bin/cargo-rapx/cargo_check/workspace.rs index 046f36a..542b478 100644 --- a/rap/src/bin/cargo-rap/cargo_check/workspace.rs +++ b/rapx/src/bin/cargo-rapx/cargo_check/workspace.rs @@ -2,14 +2,14 @@ use cargo_metadata::{ camino::{Utf8Path, Utf8PathBuf}, Metadata, }; -use rap::utils::log::rap_error_and_exit; +use rapx::utils::log::rap_error_and_exit; use std::collections::BTreeMap; /// Run cargo check in each member folder under current workspace. pub fn shallow_run() { let cargo_toml = Utf8Path::new("Cargo.toml"); if !cargo_toml.exists() { - rap_error_and_exit("rap should be run in a folder directly containing Cargo.toml"); + rap_error_and_exit("rapx should be run in a folder directly containing Cargo.toml"); } let ws_metadata = workspace(cargo_toml); check_members(&ws_metadata); @@ -24,7 +24,7 @@ pub fn deep_run() { } fn check_members(ws_metadata: &Metadata) { - // Force clean even if `RAP_CLEAN` is false, because rap is in control of + // Force clean even if `RAP_CLEAN` is false, because rapx is in control of // caches for all packages and there should be no cache. let ws_root = &ws_metadata.workspace_root; rap_trace!("cargo clean in workspace root {ws_root}"); diff --git a/rap/src/bin/cargo-rap/help.rs b/rapx/src/bin/cargo-rapx/help.rs similarity index 74% rename from rap/src/bin/cargo-rap/help.rs rename to rapx/src/bin/cargo-rapx/help.rs index bb17e33..7930667 100644 --- a/rap/src/bin/cargo-rap/help.rs +++ b/rapx/src/bin/cargo-rapx/help.rs @@ -1,21 +1,21 @@ -pub const RAP_HELP: &str = r#" +pub const RAPX_HELP: &str = r#" Usage: - cargo rap [rap options] -- [cargo check options] + cargo rapx [rapx options] -- [cargo check options] -Rap Options: +RAPx Options: Use-After-Free/double free detection. - -F or -uaf command: "cargo rap -uaf" + -F or -uaf command: "cargo rapx -uaf" Memory leakage detection. - -M or -mleak command: "cargo rap -mleak" + -M or -mleak command: "cargo rapx -mleak" Debugging options: -mir print the MIR of each function General command: -H or -help: show help information - -V or -version: show the version of RAP + -V or -version: show the version of RAPx The following features are under development Unsafe code tracing @@ -31,16 +31,16 @@ Automatic optimization -O or -opt automatically detect code optimization chances NOTE: multiple detections can be processed in single run by -appending the options to the arguments. Like `cargo rap -F -M` +appending the options to the arguments. Like `cargo rapx -F -M` will perform two kinds of detection in a row. e.g. 1. detect use-after-free and memory leak for a riscv target: - cargo rap -F -M -- --target riscv64gc-unknown-none-elf + cargo rapx -F -M -- --target riscv64gc-unknown-none-elf 2. detect use-after-free and memory leak for tests: - cargo rap -F -M -- --tests + cargo rapx -F -M -- --tests 3. detect use-after-free and memory leak for all members: - cargo rap -F -M -- --workspace + cargo rapx -F -M -- --workspace Environment Variables (Values are case insensitive): RAP_LOG verbosity of logging: trace, debug, info, warn @@ -56,12 +56,12 @@ Environment Variables (Values are case insensitive): * shallow: check for current workpace members * deep: check for all workspaces from current folder - NOTE: for shallow or deep, rap will enter each member + NOTE: for shallow or deep, rapx will enter each member folder to do the check. "#; -pub const RAP_VERSION: &str = r#" -rap version 0.1 -released at 2024-07-23 +pub const RAPX_VERSION: &str = r#" +rapx version 0.1 +released at 2025-01-06 developped by artisan-lab @ Fudan university "#; diff --git a/rap/src/bin/cargo-rap/main.rs b/rapx/src/bin/cargo-rapx/main.rs similarity index 58% rename from rap/src/bin/cargo-rap/main.rs rename to rapx/src/bin/cargo-rapx/main.rs index 2a2ce12..6d81872 100644 --- a/rap/src/bin/cargo-rap/main.rs +++ b/rapx/src/bin/cargo-rapx/main.rs @@ -5,9 +5,9 @@ #![feature(rustc_private)] #[macro_use] -extern crate rap; +extern crate rapx; -use rap::utils::log::{init_log, rap_error_and_exit}; +use rapx::utils::log::{init_log, rap_error_and_exit}; mod args; mod help; @@ -18,20 +18,20 @@ use crate::utils::*; mod cargo_check; fn phase_cargo_rap() { - rap_trace!("Start cargo-rap."); + rap_trace!("Start cargo-rapx."); - // here we skip two args: cargo rap + // here we skip two args: cargo rapx let Some(arg) = args::get_arg(2) else { - rap_error!("Expect command: e.g., `cargo rap -help`."); + rap_error!("Expect command: e.g., `cargo rapx -help`."); return; }; match arg { "-V" | "-version" => { - rap_info!("{}", help::RAP_VERSION); + rap_info!("{}", help::RAPX_VERSION); return; } "-H" | "-help" | "--help" => { - rap_info!("{}", help::RAP_HELP); + rap_info!("{}", help::RAPX_HELP); return; } _ => {} @@ -41,10 +41,10 @@ fn phase_cargo_rap() { } fn phase_rustc_wrapper() { - rap_trace!("Launch cargo-rap again triggered by cargo check."); + rap_trace!("Launch cargo-rapx again triggered by cargo check."); let is_direct = args::is_current_compile_crate(); - // rap only checks local crates + // rapx only checks local crates if is_direct && args::filter_crate_type() { run_rap(); return; @@ -56,9 +56,9 @@ fn phase_rustc_wrapper() { fn main() { /* This function will be enteredd twice: - 1. When we run `cargo rap ...`, cargo dispatches the execution to cargo-rap. - In this step, we set RUSTC_WRAPPER to cargo-rap, and execute `cargo check ...` command; - 2. Cargo check actually triggers `path/cargo-rap path/rustc` according to RUSTC_WRAPPER. + 1. When we run `cargo rapx ...`, cargo dispatches the execution to cargo-rapx. + In this step, we set RUSTC_WRAPPER to cargo-rapx, and execute `cargo check ...` command; + 2. Cargo check actually triggers `path/cargo-rapx path/rustc` according to RUSTC_WRAPPER. Because RUSTC_WRAPPER is defined, Cargo calls the command: `$RUSTC_WRAPPER path/rustc ...` */ @@ -66,10 +66,10 @@ fn main() { init_log().expect("Failed to init log."); match args::get_arg(1).unwrap() { - s if s.ends_with("rap") => phase_cargo_rap(), + s if s.ends_with("rapx") => phase_cargo_rap(), s if s.ends_with("rustc") => phase_rustc_wrapper(), _ => { - rap_error_and_exit("rap must be called with either `rap` or `rustc` as first argument.") + rap_error_and_exit("rapx must be called with either `rap` or `rustc` as first argument.") } } } diff --git a/rap/src/bin/cargo-rap/utils.rs b/rapx/src/bin/cargo-rapx/utils.rs similarity index 96% rename from rap/src/bin/cargo-rap/utils.rs rename to rapx/src/bin/cargo-rapx/utils.rs index 2ab4b18..871520a 100644 --- a/rap/src/bin/cargo-rap/utils.rs +++ b/rapx/src/bin/cargo-rapx/utils.rs @@ -7,7 +7,7 @@ use std::{ fn find_rap() -> PathBuf { let mut path = args::current_exe_path().to_owned(); - path.set_file_name("rap"); + path.set_file_name("rapx"); path } diff --git a/rap/src/bin/rap.rs b/rapx/src/bin/rapx.rs similarity index 99% rename from rap/src/bin/rap.rs rename to rapx/src/bin/rapx.rs index 649ab7c..5dead64 100644 --- a/rap/src/bin/rap.rs +++ b/rapx/src/bin/rapx.rs @@ -3,7 +3,7 @@ extern crate rustc_driver; extern crate rustc_session; -use rap::{ +use rapx::{ compile_time_sysroot, rap_info, rap_trace, utils::log::init_log, RapCallback, RAP_DEFAULT_ARGS, }; use rustc_session::config::ErrorOutputType; diff --git a/rap/src/lib.rs b/rapx/src/lib.rs similarity index 98% rename from rap/src/lib.rs rename to rapx/src/lib.rs index e98de81..b1097b8 100644 --- a/rap/src/lib.rs +++ b/rapx/src/lib.rs @@ -37,7 +37,7 @@ use std::path::PathBuf; // Insert rustc arguments at the beginning of the argument list that RAP wants to be // set per default, for maximal validation power. -pub static RAP_DEFAULT_ARGS: &[&str] = &["-Zalways-encode-mir", "-Zmir-opt-level=0", "--cfg=rap"]; +pub static RAP_DEFAULT_ARGS: &[&str] = &["-Zalways-encode-mir", "-Zmir-opt-level=0"]; pub type Elapsed = (i64, i64); @@ -202,7 +202,7 @@ pub fn compile_time_sysroot() -> Option { format!("{}/toolchains/{}", home.unwrap(), toolchain.unwrap()) } else { option_env!("RUST_SYSROOT") - .expect("To build RAP without rustup, set the `RUST_SYSROOT` env var at build time") + .expect("To build RAPx without rustup, set the `RUST_SYSROOT` env var at build time") .to_string() }; Some(env) diff --git a/rap/src/utils.rs b/rapx/src/utils.rs similarity index 100% rename from rap/src/utils.rs rename to rapx/src/utils.rs diff --git a/rap/src/utils/fs.rs b/rapx/src/utils/fs.rs similarity index 100% rename from rap/src/utils/fs.rs rename to rapx/src/utils/fs.rs diff --git a/rap/src/utils/log.rs b/rapx/src/utils/log.rs similarity index 100% rename from rap/src/utils/log.rs rename to rapx/src/utils/log.rs diff --git a/rap/src/utils/source.rs b/rapx/src/utils/source.rs similarity index 100% rename from rap/src/utils/source.rs rename to rapx/src/utils/source.rs diff --git a/rap_logo.png b/rapx_logo.png similarity index 100% rename from rap_logo.png rename to rapx_logo.png diff --git a/tests/batch.sh b/tests/batch.sh index db1ba2a..fce25cb 100755 --- a/tests/batch.sh +++ b/tests/batch.sh @@ -1,7 +1,7 @@ #!/bin/bash #该脚本在目录下为每个Cargo项目执行相同的命令直到报错 -# All arguments passed to this script are forwarded to cargo rap +# All arguments passed to this script are forwarded to cargo rapx # Example: batch.sh -F -M cur=$(pwd) @@ -25,20 +25,20 @@ find support -type f -name "Cargo.toml" | while read -r cargo_file; do popd >/dev/null continue else - cmd="cargo rap $@" - $cmd 2>&1 | tee $cur/rap.txt | ansi2txt | grep 'RAP|WARN|' && echo -e "\033[32m$project_dir pass\033[0m" + cmd="cargo rapx $@" + $cmd 2>&1 | tee $cur/rapx.txt | ansi2txt | grep 'RAP|WARN|' && echo -e "\033[32m$project_dir pass\033[0m" fi if [ $? -ne 0 ]; then echo -e "\033[31mError: '$cmd' doesn't emit WARN diagnostics in $project_dir \033[0m\nRAP output:" - cat $cur/rap.txt + cat $cur/rapx.txt exit 1 fi - cat $cur/rap.txt | ansi2txt | grep 'RAP|ERROR|' + cat $cur/rapx.txt | ansi2txt | grep 'RAP|ERROR|' if [ $? -eq 0 ]; then echo -e "Error: '$cmd' contains error message in $project_dir \nRAP output:" - cat $cur/rap.txt + cat $cur/rapx.txt exit 1 fi diff --git a/tests/rapx.txt b/tests/rapx.txt new file mode 100644 index 0000000..8844e80 --- /dev/null +++ b/tests/rapx.txt @@ -0,0 +1,14 @@ + Checking rcanary02 v0.1.0 (/home/aisr/RAPx/tests/support/leak/leak_proxy) +22:33:39|RAP|INFO|: Start analysis with RAP. +22:33:39|RAP|WARN|: Double free detected in function main +warning: Memory Leak detected. + --> src/main.rs:7:15 + | +5 | fn main() { +6 | let buf = Box::new("buffer"); +7 | let ptr = Box::into_raw(buf); + | ------------------ Memory Leak Candidates. +8 | let _proxy = Proxy { _p:ptr }; +9 | } + | + Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.16s