Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last cleanup after decapstone #1727

Merged
merged 3 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion fuzzers/frida_executable_libpng/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ reqwest = { version = "0.11.4", features = ["blocking"] }
[dependencies]
libafl = { path = "../../libafl/", features = [ "std", "llmp_compression", "llmp_bind_public", "frida_cli" ] } #, "llmp_small_maps", "llmp_debug"]}
libafl_bolts = { path = "../../libafl_bolts/" }
capstone = "0.11.0"
frida-gum = { version = "0.13.2", features = [ "auto-download", "event-sink", "invocation-listener"] }
libafl_frida = { path = "../../libafl_frida", features = ["cmplog"] }
libafl_targets = { path = "../../libafl_targets", features = ["sancov_cmplog"] }
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/frida_executable_libpng/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Library
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/frida_libpng/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Library
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/fuzzbench_fork_qemu/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ condition = { files_not_exist = [ "./libpng-1.6.37" ] }
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# fuzzer
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/fuzzbench_qemu/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ condition = { files_not_exist = [ "./libpng-1.6.37" ] }
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# fuzzer
Expand Down
4 changes: 2 additions & 2 deletions fuzzers/libfuzzer_libpng/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ windows_alias = "unsupported"
condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
curl https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz --output libpng-1.6.37.tar.xz
tar -xvf libpng-1.6.37.tar.xz
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The compiler wrappers, `libafl_cc` and `libafl_cxx`, will end up in `./target/re
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_accounting/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_accounting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In addition, it will also build two C and C++ compiler wrappers (bin/libafl_c(li
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
4 changes: 2 additions & 2 deletions fuzzers/libfuzzer_libpng_aflpp_ui/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ windows_alias = "unsupported"
condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
curl https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz --output libpng-1.6.37.tar.xz
tar -xvf libpng-1.6.37.tar.xz
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_aflpp_ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The compiler wrappers, `libafl_cc` and `libafl_cxx`, will end up in `./target/re
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_centralized/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_centralized/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In addition, it will also build two C and C++ compiler wrappers (bin/libafl_c(li
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
4 changes: 2 additions & 2 deletions fuzzers/libfuzzer_libpng_cmin/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ windows_alias = "unsupported"
condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
curl https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz --output libpng-1.6.37.tar.xz
tar -xvf libpng-1.6.37.tar.xz
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_cmin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The compiler wrappers, `libafl_cc` and libafl_cxx`, will end up in `./target/rel
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_ctx/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_ctx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In addition, it will also build two C and C++ compiler wrappers (bin/libafl_c(li
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_launcher/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_launcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In addition, it will also build two C and C++ compiler wrappers (bin/libafl_c(li
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_norestart/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_norestart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ In addition, it will also build two C and C++ compiler wrappers (bin/libafl_c(li
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
4 changes: 2 additions & 2 deletions fuzzers/libfuzzer_libpng_tcp_manager/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ windows_alias = "unsupported"
condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
curl https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz --output libpng-1.6.37.tar.xz
tar -xvf libpng-1.6.37.tar.xz
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_libpng_tcp_manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The compiler wrappers, `libafl_cc` and `libafl_cxx`, will end up in `./target/re
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```

Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/libfuzzer_reachability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The compiler wrappers, `libafl_cc` and `libafl_cxx`, will end up in `./target/re
Then download libpng, and unpack the archive:
```bash
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
```
Run `patch libpng-1.6.37/png.c diff.patch` before compiling the libpng
Now compile libpng, using the libafl_cc compiler wrapper:
Expand Down
2 changes: 1 addition & 1 deletion fuzzers/nautilus_sync/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ condition = { files_not_exist = ["./libpng-1.6.37"]}
script_runner="@shell"
script='''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf libpng-1.6.37.tar.xz
tar -xvf v1.6.37.tar.gz
'''

# Compilers
Expand Down
4 changes: 2 additions & 2 deletions fuzzers/qemu_cmin/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ condition = { files_not_exist = [ "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/lib
script_runner="@shell"
script='''
wget \
-O "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/libpng-1.6.37.tar.xz" \
-O "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/v1.6.37.tar.gz" \
https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz

tar \
-xvf "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/libpng-1.6.37.tar.xz" \
-xvf "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/v1.6.37.tar.gz" \
-C ${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/
'''

Expand Down
4 changes: 2 additions & 2 deletions fuzzers/qemu_coverage/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ condition = { files_not_exist = [ "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/lib
script_runner="@shell"
script='''
wget \
-O "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/libpng-1.6.37.tar.xz" \
-O "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/v1.6.37.tar.gz" \
https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz

tar \
-xvf "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/libpng-1.6.37.tar.xz" \
-xvf "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/v1.6.37.tar.gz" \
-C ${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/
'''

Expand Down
4 changes: 2 additions & 2 deletions fuzzers/qemu_launcher/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ condition = { files_not_exist = [ "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/lib
script_runner="@shell"
script='''
wget \
-O "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/libpng-1.6.37.tar.xz" \
-O "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/v1.6.37.tar.gz" \
https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz

tar \
-xvf "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/libpng-1.6.37.tar.xz" \
-xvf "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/v1.6.37.tar.gz" \
-C ${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/deps/
'''

Expand Down
2 changes: 1 addition & 1 deletion libafl_frida/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cc = { version = "1.0", features = ["parallel"] }
yaxpeax-arm = "0.2.4"

[target.'cfg(target_arch = "x86_64")'.dependencies]
yaxpeax-x86 = { git = "https://github.com/tokatoka/yaxpeax-x86/" } # replace this with origin later
yaxpeax-x86 = { git = "https://github.com/iximeow/yaxpeax-x86/", rev = "85668b2" } # replace this with origin later

[dependencies]
libafl = { path = "../libafl", default-features = false, version = "0.11.1", features = [
Expand Down
5 changes: 1 addition & 4 deletions libafl_frida/src/asan/asan_rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use yaxpeax_arm::armv8::a64::{ARMv8, InstDecoder, Opcode, Operand, ShiftStyle, S
#[cfg(target_arch = "x86_64")]
use yaxpeax_x86::amd64::{InstDecoder, Instruction, Opcode};

#[cfg(any(target_arch = "x86_64"))]
#[cfg(target_arch = "x86_64")]
use crate::utils::frida_to_cs;
#[cfg(target_arch = "aarch64")]
use crate::utils::{instruction_width, writer_register};
Expand Down Expand Up @@ -2138,8 +2138,6 @@ impl AsanRuntime {
u32, //load/store size
Option<(ShiftStyle, u8)>, //(shift type, shift size)
)> {
// We need to re-decode frida-internal capstone values to upstream capstone

let instr = disas_count(&decoder, instr.bytes(), 1)[0];
// We have to ignore these instructions. Simulating them with their side effects is
// complex, to say the least.
Expand Down Expand Up @@ -2235,7 +2233,6 @@ impl AsanRuntime {
_address: u64,
instr: &Insn,
) -> Option<(u8, X86Register, X86Register, u8, i32)> {
// We need to re-decode frida-internal capstone values to upstream capstone
let cs_instr = frida_to_cs(decoder, instr);
let mut operands = vec![];
for operand_idx in 0..cs_instr.operand_count() {
Expand Down
8 changes: 3 additions & 5 deletions libafl_frida/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use frida_gum::instruction_writer::Aarch64Register;
#[cfg(target_arch = "x86_64")]
use frida_gum::instruction_writer::X86Register;
#[cfg(any(target_arch = "x86_64"))]
#[cfg(target_arch = "x86_64")]
use frida_gum_sys;
#[cfg(target_arch = "aarch64")]
use num_traits::cast::FromPrimitive;
Expand Down Expand Up @@ -162,7 +162,6 @@ const X86_64_REGS: [(RegSpec, X86Register); 34] = [

/// The writer registers
/// frida registers: <https://docs.rs/frida-gum/0.4.0/frida_gum/instruction_writer/enum.X86Register.html>
/// capstone registers: <https://docs.rs/capstone-sys/0.14.0/capstone_sys/x86_reg/index.html>
#[cfg(all(target_arch = "x86_64", unix))]
#[must_use]
#[inline]
Expand All @@ -177,9 +176,8 @@ pub fn writer_register(reg: RegSpec) -> X86Register {
X86Register::None
}

/// Translates a frida instruction to a capstone instruction.
/// Returns a [`capstone::Instructions`] with a single [`capstone::Insn`] inside.
#[cfg(any(target_arch = "x86_64"))]
/// Translates a frida instruction to a disassembled instruction.
#[cfg(target_arch = "x86_64")]
pub(crate) fn frida_to_cs(decoder: InstDecoder, frida_insn: &frida_gum_sys::Insn) -> Instruction {
decoder.decode_slice(frida_insn.bytes()).unwrap()
}
Expand Down
Loading