From c1415b816aac3e55c46028c9f032bc8550b652b0 Mon Sep 17 00:00:00 2001 From: Damiano Melotti Date: Sat, 15 Jan 2022 19:28:18 +0100 Subject: Adjustments to unicorn docs and speedtest sample --- unicorn_mode/README.md | 24 ++++++++++++------------ unicorn_mode/samples/speedtest/README.md | 8 ++++---- unicorn_mode/samples/speedtest/c/harness.c | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/unicorn_mode/README.md b/unicorn_mode/README.md index 0f28cf96..392a3254 100644 --- a/unicorn_mode/README.md +++ b/unicorn_mode/README.md @@ -9,7 +9,7 @@ The CompareCoverage and NeverZero counters features are by Andrea Fioraldi /unicorn_mode/samples/simple/ + $ cd /unicorn_mode/samples/speedtest/c $ make - $ ../../../afl-fuzz -m none -i sample_inputs -o out -- ./harness @@ + $ ../../../../afl-fuzz -i ../sample_inputs -o out -U -- ./harness @@ */ // This is not your everyday Unicorn. -- cgit 1.4.1 From 751e09f47b0449d57105e533087e49ce34bce0b4 Mon Sep 17 00:00:00 2001 From: Damiano Melotti Date: Sat, 15 Jan 2022 20:02:57 +0100 Subject: Fixed Rust harness name to be consistent with the others --- unicorn_mode/samples/speedtest/rust/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unicorn_mode/samples/speedtest/rust/Cargo.toml b/unicorn_mode/samples/speedtest/rust/Cargo.toml index 9b81be0b..e2c3d7c4 100644 --- a/unicorn_mode/samples/speedtest/rust/Cargo.toml +++ b/unicorn_mode/samples/speedtest/rust/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "unicornafl_harness" +name = "unicornafl" version = "0.1.0" authors = ["Dominik Maier "] edition = "2018" -- cgit 1.4.1 From a45cdb240c20e019a98ab9b143bb928d91e7f959 Mon Sep 17 00:00:00 2001 From: Damiano Melotti Date: Mon, 17 Jan 2022 14:32:06 +0100 Subject: fixup! Fixed Rust harness name to be consistent with the others --- unicorn_mode/samples/speedtest/rust/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unicorn_mode/samples/speedtest/rust/Cargo.toml b/unicorn_mode/samples/speedtest/rust/Cargo.toml index e2c3d7c4..766b2f27 100644 --- a/unicorn_mode/samples/speedtest/rust/Cargo.toml +++ b/unicorn_mode/samples/speedtest/rust/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "unicornafl" +name = "harness" version = "0.1.0" authors = ["Dominik Maier "] edition = "2018" -- cgit 1.4.1 From 34caf7d7816382575bb8045f809c03526ca534a2 Mon Sep 17 00:00:00 2001 From: Damiano Melotti Date: Mon, 17 Jan 2022 17:38:46 +0100 Subject: Cleaned unicorn speedtest sample README --- unicorn_mode/samples/speedtest/README.md | 40 ++++---------------------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/unicorn_mode/samples/speedtest/README.md b/unicorn_mode/samples/speedtest/README.md index 9305417c..f46a5772 100644 --- a/unicorn_mode/samples/speedtest/README.md +++ b/unicorn_mode/samples/speedtest/README.md @@ -6,6 +6,10 @@ to show the raw speed of C, Rust, and Python harnesses. ## Compiling... Make sure you built unicornafl first (`../../build_unicorn_support.sh`). +Build the target using the provided Makefile. +This will also run the [./get_offsets.py](./get_offsets.py) script, +which finds some relevant addresses in the target binary using `objdump`, +and dumps them to different files. Then, follow these individual steps: ### Rust @@ -34,39 +38,3 @@ cd python ## Results TODO: add results here. - -## Compiling speedtest_target.c - -You shouldn't need to compile simple_target.c since a X86_64 binary version is -pre-built and shipped in this sample folder. This file documents how the binary -was built in case you want to rebuild it or recompile it for any reason. - -The pre-built binary (simple_target_x86_64.bin) was built using -g -O0 in gcc. - -Then load the binary and execute the main function directly. - -## Addresses for the harness - -To find the address (in hex) of main, run: - -```bash -objdump -M intel -D target | grep '
:' | cut -d" " -f1 -``` - -To find all call sites to magicfn, run: - -```bash -objdump -M intel -D target | grep '$' | cut -d":" -f1 -``` - -For malloc callsites: - -```bash -objdump -M intel -D target | grep '$' | cut -d":" -f1 -``` - -And free callsites: - -```bash -objdump -M intel -D target | grep '$' | cut -d":" -f1 -``` \ No newline at end of file -- cgit 1.4.1