diff options
author | Huanyao Rong <r3tr0spect2019@qq.com> | 2024-06-21 21:03:37 -0700 |
---|---|---|
committer | Nguyễn Gia Phong <cnx@loang.net> | 2024-12-03 11:17:44 +0900 |
commit | d04bdf2e841fa6706c16bbba1cb6f6c73d647767 (patch) | |
tree | 23393adc733e6e9e61d7eb226c90258870bb0624 /docs/aflrun.md | |
parent | cee3c86d7d5f0a05ad6cbb1434dc13162a16e336 (diff) | |
download | afl++-d04bdf2e841fa6706c16bbba1cb6f6c73d647767.tar.gz |
Implement AFLRun
References: https://github.com/Mem2019/AFLRun/commit/f5bb87f78ef1 References: https://github.com/Mem2019/AFLRun/commit/3af5f11b5644
Diffstat (limited to 'docs/aflrun.md')
-rw-r--r-- | docs/aflrun.md | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/docs/aflrun.md b/docs/aflrun.md new file mode 100644 index 00000000..e996f26c --- /dev/null +++ b/docs/aflrun.md @@ -0,0 +1,71 @@ +# AFLRun + +## Usage + +The AFLRun is tested with clang 16.0.3, the other version might work but might also be problematic. These are the steps to compile the LLVM project for AFLRun. + +```bash +# Clone LLVM project. +git clone --depth=1 https://github.com/llvm/llvm-project.git && \ + cd llvm-project && \ + git fetch origin --depth=1 4a2c05b05ed07f1f620e94f6524a8b4b2760a0b1 && \ + git reset --hard 4a2c05b05ed07f1f620e94f6524a8b4b2760a0b1 + +# Download binutils. +wget https://ftp.gnu.org/gnu/binutils/binutils-2.39.tar.gz -O binutils.tar.gz && \ + tar -xf binutils.tar.gz + +# Download CMake. +wget https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1-linux-x86_64.tar.gz -O cmake.tar.gz && \ + tar -xf cmake.tar.gz + +# Compile and install LLVM project. +# Please change "/path/to/install" to your install path. +PATH_TO_INSTALL="/path/to/install" +mkdir build && cd build +export CXX=g++ +export CC=gcc +../cmake-3.25.1-linux-x86_64/bin/cmake -G "Ninja" \ + -DLLVM_BINUTILS_INCDIR=$PWD/../binutils-2.39/include \ + -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=host \ + -DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld" \ + -DCMAKE_INSTALL_PREFIX="$PATH_TO_INSTALL" \ + -DLLVM_INSTALL_BINUTILS_SYMLINKS=ON $PWD/../llvm/ +ninja -j $(nproc) && ninja install +cd ../.. && rm -rf llvm-project +``` + +Then we can compile AFLRun + +```bash +git clone https://github.com/Mem2019/AFLRun.git && cd AFLRun +export CC="$PATH_TO_INSTALL/bin/clang" +export CXX="$PATH_TO_INSTALL/bin/clang++" +make clean all +AFLRUN="$PWD" +``` + +Now we can use AFLRun to compile program + +```bash +# Set target file, the format is same as AFLGo. +export AFLRUN_BB_TARGETS="/path/to/BBtargets.txt" +# Names of target binaries to instrument, "::" means instrument all binaries. +export AFLRUN_TARGETS="bin1:bin2" +# Optional, directory to store data. If not set, a random directory will be created. +export AFLRUN_TMP="/tmp/" +export CC="$AFLRUN/afl-clang-lto" +export CXX="$AFLRUN/afl-clang-lto++" +``` + +## Citation + +```bibtex +@article{Rong2023TowardUM, + title={Toward Unbiased Multiple-Target Fuzzing with Path Diversity}, + author={Huanyao Rong and Wei You and Xiaofeng Wang and Tianhao Mao}, + journal={ArXiv}, + year={2023}, + volume={abs/2310.12419} +} +``` |