diff --git a/README.md b/README.md index 620e747951..4e38b68408 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ Rust directly, instructions can be found [here](https://www.rust-lang.org/tools/ The LLVM tools (including clang, clang++) are needed (newer than LLVM 15.0.0 up to LLVM 18.1.3) If you are using Debian/Ubuntu, again, we highly recommmend that you install the package from [here](https://apt.llvm.org/) +(In `libafl_concolic`, we only support LLVM version newer than 18) + - Cargo-make We use cargo-make to build the fuzzers in `fuzzers/` directory. You can install it with diff --git a/libafl/src/observers/concolic/mod.rs b/libafl/src/observers/concolic/mod.rs index fddc5a3dd6..c05ca9317c 100644 --- a/libafl/src/observers/concolic/mod.rs +++ b/libafl/src/observers/concolic/mod.rs @@ -60,7 +60,6 @@ pub enum SymExpr { offset: usize, value: u8, }, - Integer { value: u64, bits: u8, @@ -69,6 +68,7 @@ pub enum SymExpr { high: u64, low: u64, }, + IntegerFromBuffer {}, Float { value: f64, is_double: bool, diff --git a/libafl/src/observers/concolic/serialization_format.rs b/libafl/src/observers/concolic/serialization_format.rs index 1080f0f1bc..bac1063843 100644 --- a/libafl/src/observers/concolic/serialization_format.rs +++ b/libafl/src/observers/concolic/serialization_format.rs @@ -115,6 +115,7 @@ impl MessageFileReader { SymExpr::InputByte { .. } | SymExpr::Integer { .. } | SymExpr::Integer128 { .. } + | SymExpr::IntegerFromBuffer { .. } | SymExpr::Float { .. } | SymExpr::NullPointer | SymExpr::True @@ -288,6 +289,7 @@ impl MessageFileWriter { SymExpr::InputByte { .. } | SymExpr::Integer { .. } | SymExpr::Integer128 { .. } + | SymExpr::IntegerFromBuffer { .. } | SymExpr::Float { .. } | SymExpr::NullPointer | SymExpr::True diff --git a/libafl/src/stages/concolic.rs b/libafl/src/stages/concolic.rs index 0becb32efb..58c799963d 100644 --- a/libafl/src/stages/concolic.rs +++ b/libafl/src/stages/concolic.rs @@ -179,6 +179,7 @@ fn generate_mutations(iter: impl Iterator) -> Vec< Some(BV::from_u64(&ctx, value, u32::from(bits)).into()) } SymExpr::Integer128 { high: _, low: _ } => todo!(), + SymExpr::IntegerFromBuffer {} => todo!(), SymExpr::NullPointer => Some(BV::from_u64(&ctx, 0, usize::BITS).into()), SymExpr::True => Some(Bool::from_bool(&ctx, true).into()), SymExpr::False => Some(Bool::from_bool(&ctx, false).into()), diff --git a/libafl_cc/src/lib.rs b/libafl_cc/src/lib.rs index 5651f12d6e..b0c013dc83 100644 --- a/libafl_cc/src/lib.rs +++ b/libafl_cc/src/lib.rs @@ -27,7 +27,6 @@ ))] #![cfg_attr(test, deny( missing_debug_implementations, - missing_docs, //trivial_casts, trivial_numeric_casts, unused_extern_crates, diff --git a/libafl_concolic/symcc_libafl/src/lib.rs b/libafl_concolic/symcc_libafl/src/lib.rs index ba7f84070e..1583f8af82 100644 --- a/libafl_concolic/symcc_libafl/src/lib.rs +++ b/libafl_concolic/symcc_libafl/src/lib.rs @@ -5,7 +5,7 @@ /// The URL of the `LibAFL` `SymCC` fork. pub const SYMCC_REPO_URL: &str = "https://github.com/AFLplusplus/symcc.git"; /// The commit of the `LibAFL` `SymCC` fork. -pub const SYMCC_REPO_COMMIT: &str = "6010402596f02da6de1c2dc88794f339d7c4dfe7"; +pub const SYMCC_REPO_COMMIT: &str = "1330e29d28bce706d9f7c0864da3b0a5ae218e03"; #[cfg(feature = "clone")] mod clone { diff --git a/libafl_concolic/symcc_runtime/src/lib.rs b/libafl_concolic/symcc_runtime/src/lib.rs index 46d505e3a2..1d59a9fd26 100644 --- a/libafl_concolic/symcc_runtime/src/lib.rs +++ b/libafl_concolic/symcc_runtime/src/lib.rs @@ -160,6 +160,18 @@ macro_rules! export_rust_runtime_fn { } } }; + // special case for build_integer_from_buffer cuz the next one just doesn't work!!!!!!! + (pub fn build_integer_from_buffer( + buffer: *mut ::std::os::raw::c_void, + num_bits: ::std::os::raw::c_uint,) -> RSymExpr,$c_name:ident; $rt_cb:path) => { + #[allow(clippy::missing_safety_doc)] + #[no_mangle] + pub unsafe extern "C" fn _rsym_build_integer_from_buffer(buffer: *mut ::std::os::raw::c_void, num_bits: ::std::os::raw::c_uint) { + $rt_cb(|rt| { + rt.build_integer_from_buffer(buffer, num_bits); + }) + } + }; // all other methods are handled by this (pub fn $name:ident($( $arg:ident : $(::)?$($type:ident)::+ ),*$(,)?)$( -> $($ret:ident)::+)?, $c_name:ident; $rt_cb:path) => { #[allow(clippy::missing_safety_doc)] diff --git a/libafl_concolic/symcc_runtime/src/tracing.rs b/libafl_concolic/symcc_runtime/src/tracing.rs index 58676d4753..ade5da9d75 100644 --- a/libafl_concolic/symcc_runtime/src/tracing.rs +++ b/libafl_concolic/symcc_runtime/src/tracing.rs @@ -62,6 +62,17 @@ macro_rules! binary_expression_builder { } impl Runtime for TracingRuntime { + #[allow(clippy::missing_safety_doc)] + #[no_mangle] + fn build_integer_from_buffer( + &mut self, + _buffer: *mut core::ffi::c_void, + _num_bits: core::ffi::c_uint, + ) -> Option { + // todo + self.write_message(SymExpr::IntegerFromBuffer {}) + } + expression_builder!(get_input_byte(offset: usize, value: u8) => InputByte); expression_builder!(build_integer(value: u64, bits: u8) => Integer); diff --git a/libafl_concolic/test/smoke_test.sh b/libafl_concolic/test/smoke_test.sh index 4e23543e9e..e47db28f4a 100755 --- a/libafl_concolic/test/smoke_test.sh +++ b/libafl_concolic/test/smoke_test.sh @@ -16,7 +16,7 @@ if [ ! -d "symcc" ]; then echo "cloning symcc" git clone https://github.com/AFLplusplus/symcc.git symcc cd symcc - git checkout 2a3229da6101596af220f20fef5085e59537abcb + git checkout 1330e29d28bce706d9f7c0864da3b0a5ae218e03 cd .. fi @@ -46,4 +46,4 @@ cat constraints.txt sed 's/, location: .* / /' < constraints.txt > constraints_filtered.txt sed 's/, location: .* / /' < expected_constraints.txt > expected_constraints_filtered.txt -diff constraints_filtered.txt expected_constraints_filtered.txt \ No newline at end of file +diff constraints_filtered.txt expected_constraints_filtered.txt diff --git a/libafl_derive/src/lib.rs b/libafl_derive/src/lib.rs index 485592a129..d10489dde8 100644 --- a/libafl_derive/src/lib.rs +++ b/libafl_derive/src/lib.rs @@ -28,7 +28,6 @@ ))] #![cfg_attr(test, deny( missing_debug_implementations, - missing_docs, //trivial_casts, trivial_numeric_casts, unused_extern_crates, diff --git a/libafl_frida/src/lib.rs b/libafl_frida/src/lib.rs index 33ed14c7d6..f632c2f82a 100644 --- a/libafl_frida/src/lib.rs +++ b/libafl_frida/src/lib.rs @@ -34,7 +34,6 @@ Additional documentation is available in [the `LibAFL` book](https://aflplus.plu ))] #![cfg_attr(test, deny( missing_debug_implementations, - missing_docs, //trivial_casts, trivial_numeric_casts, unused_extern_crates, diff --git a/libafl_sugar/src/lib.rs b/libafl_sugar/src/lib.rs index 9de7dac2ce..2851795e95 100644 --- a/libafl_sugar/src/lib.rs +++ b/libafl_sugar/src/lib.rs @@ -27,7 +27,6 @@ ))] #![cfg_attr(test, deny( missing_debug_implementations, - missing_docs, //trivial_casts, trivial_numeric_casts, unused_extern_crates, diff --git a/libafl_targets/src/lib.rs b/libafl_targets/src/lib.rs index 553001a7af..5ced10b1de 100644 --- a/libafl_targets/src/lib.rs +++ b/libafl_targets/src/lib.rs @@ -28,7 +28,6 @@ ))] #![cfg_attr(test, deny( missing_debug_implementations, - missing_docs, //trivial_casts, trivial_numeric_casts, unused_extern_crates, diff --git a/libafl_tinyinst/src/lib.rs b/libafl_tinyinst/src/lib.rs index a8b95c4387..6827b8112b 100644 --- a/libafl_tinyinst/src/lib.rs +++ b/libafl_tinyinst/src/lib.rs @@ -32,7 +32,6 @@ The tinyinst module for `LibAFL`. ))] #![cfg_attr(test, deny( missing_debug_implementations, - missing_docs, //trivial_casts, trivial_numeric_casts, unused_extern_crates, diff --git a/scripts/clippy.sh b/scripts/clippy.sh index 6f7395ef57..e37554a8f5 100755 --- a/scripts/clippy.sh +++ b/scripts/clippy.sh @@ -4,7 +4,7 @@ cd "$SCRIPT_DIR/.." || exit 1 set -e -RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --tests --examples --benches -- -Z macro-backtrace \ +RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --exclude libafl_nyx --exclude symcc_runtime --exclude runtime_test --no-deps --tests --examples --benches -- -Z macro-backtrace \ -D clippy::all \ -D clippy::pedantic \ -W clippy::similar_names \ @@ -21,7 +21,7 @@ RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --tests --example if [[ "$OSTYPE" == "linux-gnu"* ]]; then cd libafl_libfuzzer/libafl_libfuzzer_runtime - RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --tests --examples --benches -- -Z macro-backtrace \ + RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --exclude libafl_nyx --exclude symcc_runtime --exclude runtime_test --no-deps --tests --examples --benches -- -Z macro-backtrace \ -D clippy::all \ -D clippy::pedantic \ -W clippy::similar_names \