-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
56 lines (45 loc) · 1.53 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install -y software-properties-common
# System deps
RUN apt-get update
RUN apt-get install -y \
autoconf \
automake \
build-essential \
cmake \
libtool \
llvm llvm-dev clang \
make \
ninja-build \
sudo \
unzip \
zlib1g-dev \
patchelf
RUN apt-get clean autoclean
RUN apt-get autoremove -y
# Copy this code into place
COPY . /code
# Compile and install AFL++
WORKDIR /code/AFLplusplus
RUN make WAFL_MODE=1 TEST_MMAP=1 install
# TODO: wavm expects AFLplusplus instrumentation passes at /AFLplusplus/x-pass.so
RUN ln -s /code/AFLplusplus /
# Compile and install the WAVM part
WORKDIR /build
RUN cmake -G Ninja /code -DCMAKE_BUILD_TYPE=RelWithDebInfo
RUN ninja && ninja install && \
patchelf --add-needed /usr/local/lib/libWAVM.so /usr/local/bin/wavm
# setup example program for fuzzing
RUN apt-get install -y git wget tar
WORKDIR /
RUN wget -q https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz && \
tar xvf wasi-sdk-20.0-linux.tar.gz
ENV WASI_SDK_PATH=/wasi-sdk-20.0
RUN git clone https://github.com/AFLplusplus/fuzzer-challenges
RUN cd fuzzer-challenges && \
/wasi-sdk-20.0/bin/clang -O0 -g --target=wasm32-wasi test-u8.c -o test-u8.wasm /code/standalone.c
ENV AFL_SKIP_CPUFREQ=1 AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES=1 AFL_SKIP_BIN_CHECK=1
RUN mkdir /in && mkdir /out && echo seed > /in/seed
ENV __AFL_PERSISTENT=1 __AFL_SHM_FUZZ=1
CMD afl-fuzz -i /in/ -o /out/ wavm run /fuzzer-challenges/test-u8.wasm