Skip to content

Commit 1ebd01f

Browse files
authored
Improve Fuzzing Script and Dockerfile (#27)
- Add typing - Use `&&` to combine commands so that following commands won't execute if previous one failed - Optimize `Dockerfile` - Use Docker Python SDK to avoid commands inside other commands - Fix Docker core binding (See https://datacorrupted.atlassian.net/wiki/spaces/IRFUZZER/pages/2293762/Weekly+meeting+notes#Docker-Core-binding) - Fix Docker fuzzing output permission
1 parent 9a7e8d5 commit 1ebd01f

File tree

3 files changed

+328
-223
lines changed

3 files changed

+328
-223
lines changed

Dockerfile

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:22.04
22

3+
ENV DEBIAN_FRONTEND=noninteractive
34
RUN apt-get update && \
4-
apt-get -y upgrade
5-
ENV DEBIAN_FRONTEND noninteractive
6-
RUN apt-get install -y -q git build-essential wget zlib1g-dev cmake python3 python3-pip ninja-build ccache && \
5+
apt-get -y upgrade && \
6+
apt-get install -y -q git build-essential wget zlib1g-dev cmake python3 python3-pip ninja-build ccache && \
77
apt-get clean
88

99
ENV FUZZING_HOME=/IRFuzzer
10-
11-
RUN mkdir -p /$FUZZING_HOME
12-
COPY . /$FUZZING_HOME
13-
WORKDIR /$FUZZING_HOME
10+
WORKDIR $FUZZING_HOME
11+
COPY . $FUZZING_HOME
1412

1513
ENV LLVM=llvm-project
1614
ENV AFL=AFLplusplus
1715
ENV PATH="${PATH}:/clang+llvm/bin"
1816
ENV AFL_LLVM_INSTRUMENT=CLASSIC
1917

2018
RUN CLANG_LLVM=clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04 && \
21-
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/$CLANG_LLVM.tar.xz && \
19+
wget --no-verbose --show-progress --progress=dot:mega https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/$CLANG_LLVM.tar.xz && \
2220
tar -xvf $CLANG_LLVM.tar.xz -C / && \
2321
mv /$CLANG_LLVM /clang+llvm && \
2422
rm $CLANG_LLVM.tar.xz
2523

26-
RUN git clone https://github.com/SecurityLab-UCD/AFLplusplus.git --branch=isel --depth=1 $FUZZING_HOME/$AFL && \
27-
cd $FUZZING_HOME/$AFL && \
24+
RUN git clone https://github.com/SecurityLab-UCD/AFLplusplus.git --branch=isel --depth=1 $AFL && \
25+
cd $AFL && \
2826
make -j
2927

30-
RUN git clone --branch irfuzzer-0.1 https://github.com/SecurityLab-UCD/llvm-project.git --depth=1 $FUZZING_HOME/$LLVM
28+
RUN git clone --branch irfuzzer-0.1 https://github.com/SecurityLab-UCD/llvm-project.git --depth=1 $LLVM
3129

3230
RUN mkdir -p $LLVM/build-afl && \
3331
cd $LLVM/build-afl && \
@@ -75,8 +73,3 @@ RUN mkdir -p mutator/build && \
7573
cd mutator/build && \
7674
cmake -GNinja .. && \
7775
ninja -j $(nproc --all)
78-
79-
# Tell AFL++ to only use our mutator
80-
ENV AFL_CUSTOM_MUTATOR_ONLY=1
81-
# Tell AFL++ Where our mutator is
82-
ENV AFL_CUSTOM_MUTATOR_LIBRARY=$FUZZING_HOME/mutator/build/libAFLCustomIRMutator.so

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export AFL_LLVM_INSTRUMENT=CLASSIC
2929
If you want to use dockerized environment, you can also do
3030

3131
```sh
32-
docker build .
32+
docker build . -t irfuzzer
3333
```
3434

3535
## Seed selection

0 commit comments

Comments
 (0)