Skip to content

Commit

Permalink
Add Docker usage (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetVishnya authored Feb 16, 2024
1 parent 2cef4c7 commit f8ff34b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,24 @@ 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

Install [Rust](https://www.rust-lang.org/tools/install) or update existing Rust installation:

$ 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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions casr/src/triage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl<'a> CrashInfo {
pub fn fuzzing_crash_triage_pipeline(
matches: &clap::ArgMatches,
crashes: &HashMap<String, CrashInfo>,
gdb_args: &Vec<String>,
gdb_args: &[String],
) -> Result<()> {
// Get casr-cluster path
let casr_cluster = get_path("casr-cluster")?;
Expand Down Expand Up @@ -281,7 +281,7 @@ pub fn fuzzing_crash_triage_pipeline(
fn summarize_results(
matches: &clap::ArgMatches,
crashes: &HashMap<String, CrashInfo>,
gdb_args: &Vec<String>,
gdb_args: &[String],
) -> Result<()> {
// Get output dir
let dir = matches.get_one::<PathBuf>("output").unwrap();
Expand Down Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion casr/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ pub fn get_reports(dir: &Path) -> Result<Vec<PathBuf>> {
///
/// * A vector of correctly parsed report info: paths, stacktraces and crashlines
/// * A vector of bad reports
pub fn reports_from_paths(casreps: &Vec<PathBuf>, jobs: usize) -> (Vec<ReportInfo>, Vec<PathBuf>) {
pub fn reports_from_paths(casreps: &[PathBuf], jobs: usize) -> (Vec<ReportInfo>, Vec<PathBuf>) {
// Get len
let len = casreps.len();
// Start thread pool.
Expand Down

0 comments on commit f8ff34b

Please sign in to comment.