From f8ff34b695bcb17450cc5e985d2e6137a76d7e0a Mon Sep 17 00:00:00 2001 From: Alexey Vishnyakov Date: Fri, 16 Feb 2024 12:21:15 +0300 Subject: [PATCH] Add Docker usage (#201) --- README.md | 18 +++++++++++++----- casr/src/triage.rs | 6 +++--- casr/src/util.rs | 2 +- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c0b9ae89..e3ce0538 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,11 @@ collected from gdb. To save crash reports as json use `serde` feature. ## Dependencies -Install build dependencies: +Install runtime dependencies: + + $ sudo apt install gdb lsb-release + +Install build dependencies when building from source: $ sudo apt install build-essential clang @@ -94,12 +98,12 @@ Install [Rust](https://www.rust-lang.org/tools/install) or update existing Rust $ rustup update -Install runtime dependencies: - - $ sudo apt install gdb lsb-release - ## Install +Download latest Linux 64-bit +[release](https://github.com/ispras/casr/releases/latest/download/casr-x86_64-unknown-linux-gnu.tar.xz) +or build from source as explained below. + Build from Git repository: $ git clone https://github.com/ispras/casr @@ -115,6 +119,10 @@ Add `dojo` feature if you want to install `casr-dojo` (the same for `cargo build ## Usage +**Running in Docker:** CASR disables address randomization for better +deduplication and uses ptrace to run GDB. Thus, Docker should be started with +`--cap-add=SYS_PTRACE --security-opt seccomp=unconfined`. + Create report from coredump: $ casr-core -f casr/tests/casr_tests/bin/core.test_destAv -e casr/tests/casr_tests/bin/test_destAv -o destAv.casrep diff --git a/casr/src/triage.rs b/casr/src/triage.rs index 491203da..1dd4fd31 100644 --- a/casr/src/triage.rs +++ b/casr/src/triage.rs @@ -150,7 +150,7 @@ impl<'a> CrashInfo { pub fn fuzzing_crash_triage_pipeline( matches: &clap::ArgMatches, crashes: &HashMap, - gdb_args: &Vec, + gdb_args: &[String], ) -> Result<()> { // Get casr-cluster path let casr_cluster = get_path("casr-cluster")?; @@ -281,7 +281,7 @@ pub fn fuzzing_crash_triage_pipeline( fn summarize_results( matches: &clap::ArgMatches, crashes: &HashMap, - gdb_args: &Vec, + gdb_args: &[String], ) -> Result<()> { // Get output dir let dir = matches.get_one::("output").unwrap(); @@ -334,7 +334,7 @@ fn summarize_results( crashes.par_iter().try_for_each(|crash| { if let Err(e) = (CrashInfo { path: crash.to_path_buf(), - target_args: gdb_args.clone(), + target_args: gdb_args.to_vec(), envs: HashMap::new(), at_index, casr_tool: casr_gdb.clone(), diff --git a/casr/src/util.rs b/casr/src/util.rs index 53cd8276..76c211fd 100644 --- a/casr/src/util.rs +++ b/casr/src/util.rs @@ -445,7 +445,7 @@ pub fn get_reports(dir: &Path) -> Result> { /// /// * A vector of correctly parsed report info: paths, stacktraces and crashlines /// * A vector of bad reports -pub fn reports_from_paths(casreps: &Vec, jobs: usize) -> (Vec, Vec) { +pub fn reports_from_paths(casreps: &[PathBuf], jobs: usize) -> (Vec, Vec) { // Get len let len = casreps.len(); // Start thread pool.