Symcc Update (#2047)

* symcc upd

* upda

* fix

* fmt

* mm

* psu

* psh

* fix

* fix

* fix

* tmate

* can't make it work

* i really hate you llvm

* real name

* mm
This commit is contained in:
Dongjia "toka" Zhang 2024-04-23 13:34:46 +02:00 committed by GitHub
parent 2046cfe82d
commit 5ff709f241
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 34 additions and 12 deletions

View File

@ -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) 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/) 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 - Cargo-make
We use cargo-make to build the fuzzers in `fuzzers/` directory. You can install it with We use cargo-make to build the fuzzers in `fuzzers/` directory. You can install it with

View File

@ -60,7 +60,6 @@ pub enum SymExpr {
offset: usize, offset: usize,
value: u8, value: u8,
}, },
Integer { Integer {
value: u64, value: u64,
bits: u8, bits: u8,
@ -69,6 +68,7 @@ pub enum SymExpr {
high: u64, high: u64,
low: u64, low: u64,
}, },
IntegerFromBuffer {},
Float { Float {
value: f64, value: f64,
is_double: bool, is_double: bool,

View File

@ -115,6 +115,7 @@ impl<R: Read> MessageFileReader<R> {
SymExpr::InputByte { .. } SymExpr::InputByte { .. }
| SymExpr::Integer { .. } | SymExpr::Integer { .. }
| SymExpr::Integer128 { .. } | SymExpr::Integer128 { .. }
| SymExpr::IntegerFromBuffer { .. }
| SymExpr::Float { .. } | SymExpr::Float { .. }
| SymExpr::NullPointer | SymExpr::NullPointer
| SymExpr::True | SymExpr::True
@ -288,6 +289,7 @@ impl<W: Write + Seek> MessageFileWriter<W> {
SymExpr::InputByte { .. } SymExpr::InputByte { .. }
| SymExpr::Integer { .. } | SymExpr::Integer { .. }
| SymExpr::Integer128 { .. } | SymExpr::Integer128 { .. }
| SymExpr::IntegerFromBuffer { .. }
| SymExpr::Float { .. } | SymExpr::Float { .. }
| SymExpr::NullPointer | SymExpr::NullPointer
| SymExpr::True | SymExpr::True

View File

@ -179,6 +179,7 @@ fn generate_mutations(iter: impl Iterator<Item = (SymExprRef, SymExpr)>) -> Vec<
Some(BV::from_u64(&ctx, value, u32::from(bits)).into()) Some(BV::from_u64(&ctx, value, u32::from(bits)).into())
} }
SymExpr::Integer128 { high: _, low: _ } => todo!(), SymExpr::Integer128 { high: _, low: _ } => todo!(),
SymExpr::IntegerFromBuffer {} => todo!(),
SymExpr::NullPointer => Some(BV::from_u64(&ctx, 0, usize::BITS).into()), SymExpr::NullPointer => Some(BV::from_u64(&ctx, 0, usize::BITS).into()),
SymExpr::True => Some(Bool::from_bool(&ctx, true).into()), SymExpr::True => Some(Bool::from_bool(&ctx, true).into()),
SymExpr::False => Some(Bool::from_bool(&ctx, false).into()), SymExpr::False => Some(Bool::from_bool(&ctx, false).into()),

View File

@ -27,7 +27,6 @@
))] ))]
#![cfg_attr(test, deny( #![cfg_attr(test, deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs,
//trivial_casts, //trivial_casts,
trivial_numeric_casts, trivial_numeric_casts,
unused_extern_crates, unused_extern_crates,

View File

@ -5,7 +5,7 @@
/// The URL of the `LibAFL` `SymCC` fork. /// The URL of the `LibAFL` `SymCC` fork.
pub const SYMCC_REPO_URL: &str = "https://github.com/AFLplusplus/symcc.git"; pub const SYMCC_REPO_URL: &str = "https://github.com/AFLplusplus/symcc.git";
/// The commit of the `LibAFL` `SymCC` fork. /// The commit of the `LibAFL` `SymCC` fork.
pub const SYMCC_REPO_COMMIT: &str = "6010402596f02da6de1c2dc88794f339d7c4dfe7"; pub const SYMCC_REPO_COMMIT: &str = "1330e29d28bce706d9f7c0864da3b0a5ae218e03";
#[cfg(feature = "clone")] #[cfg(feature = "clone")]
mod clone { mod clone {

View File

@ -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 // all other methods are handled by this
(pub fn $name:ident($( $arg:ident : $(::)?$($type:ident)::+ ),*$(,)?)$( -> $($ret:ident)::+)?, $c_name:ident; $rt_cb:path) => { (pub fn $name:ident($( $arg:ident : $(::)?$($type:ident)::+ ),*$(,)?)$( -> $($ret:ident)::+)?, $c_name:ident; $rt_cb:path) => {
#[allow(clippy::missing_safety_doc)] #[allow(clippy::missing_safety_doc)]

View File

@ -62,6 +62,17 @@ macro_rules! binary_expression_builder {
} }
impl Runtime for TracingRuntime { 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<RSymExpr> {
// todo
self.write_message(SymExpr::IntegerFromBuffer {})
}
expression_builder!(get_input_byte(offset: usize, value: u8) => InputByte); expression_builder!(get_input_byte(offset: usize, value: u8) => InputByte);
expression_builder!(build_integer(value: u64, bits: u8) => Integer); expression_builder!(build_integer(value: u64, bits: u8) => Integer);

View File

@ -16,7 +16,7 @@ if [ ! -d "symcc" ]; then
echo "cloning symcc" echo "cloning symcc"
git clone https://github.com/AFLplusplus/symcc.git symcc git clone https://github.com/AFLplusplus/symcc.git symcc
cd symcc cd symcc
git checkout 2a3229da6101596af220f20fef5085e59537abcb git checkout 1330e29d28bce706d9f7c0864da3b0a5ae218e03
cd .. cd ..
fi fi

View File

@ -28,7 +28,6 @@
))] ))]
#![cfg_attr(test, deny( #![cfg_attr(test, deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs,
//trivial_casts, //trivial_casts,
trivial_numeric_casts, trivial_numeric_casts,
unused_extern_crates, unused_extern_crates,

View File

@ -34,7 +34,6 @@ Additional documentation is available in [the `LibAFL` book](https://aflplus.plu
))] ))]
#![cfg_attr(test, deny( #![cfg_attr(test, deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs,
//trivial_casts, //trivial_casts,
trivial_numeric_casts, trivial_numeric_casts,
unused_extern_crates, unused_extern_crates,

View File

@ -27,7 +27,6 @@
))] ))]
#![cfg_attr(test, deny( #![cfg_attr(test, deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs,
//trivial_casts, //trivial_casts,
trivial_numeric_casts, trivial_numeric_casts,
unused_extern_crates, unused_extern_crates,

View File

@ -28,7 +28,6 @@
))] ))]
#![cfg_attr(test, deny( #![cfg_attr(test, deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs,
//trivial_casts, //trivial_casts,
trivial_numeric_casts, trivial_numeric_casts,
unused_extern_crates, unused_extern_crates,

View File

@ -32,7 +32,6 @@ The tinyinst module for `LibAFL`.
))] ))]
#![cfg_attr(test, deny( #![cfg_attr(test, deny(
missing_debug_implementations, missing_debug_implementations,
missing_docs,
//trivial_casts, //trivial_casts,
trivial_numeric_casts, trivial_numeric_casts,
unused_extern_crates, unused_extern_crates,

View File

@ -4,7 +4,7 @@ cd "$SCRIPT_DIR/.." || exit 1
set -e 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::all \
-D clippy::pedantic \ -D clippy::pedantic \
-W clippy::similar_names \ -W clippy::similar_names \
@ -21,7 +21,7 @@ RUST_BACKTRACE=full cargo +nightly clippy --all --all-features --tests --example
if [[ "$OSTYPE" == "linux-gnu"* ]]; then if [[ "$OSTYPE" == "linux-gnu"* ]]; then
cd libafl_libfuzzer/libafl_libfuzzer_runtime 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::all \
-D clippy::pedantic \ -D clippy::pedantic \
-W clippy::similar_names \ -W clippy::similar_names \