-
Notifications
You must be signed in to change notification settings - Fork 38
110 lines (100 loc) · 3.16 KB
/
gwos-evm-fuzz.yml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: GWOS EVM FuzzTest
on:
push:
paths:
- 'gwos-evm/**'
pull_request:
paths:
- 'gwos-evm/**'
schedule:
- cron: 0 */2 * * *
jobs:
build-and-run-fuzzing:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: gwos-evm
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Cache Rust - Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
- name: Install moleculec
run: |
export MOLC_VERSION=$(cat ../gwos/c/Makefile | egrep "MOLC_VERSION :=" | awk '{print $3}')
test "$(moleculec --version)" = "Moleculec $MOLC_VERSION" \
|| CARGO_TARGET_DIR=target/ cargo install moleculec --version $MOLC_VERSION
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v3
with:
path: ./llvm
key: clang-11
- name: Set the datetime
run: echo "DATETIME=$(date +%F_%H:%M)" >> $GITHUB_ENV
- name: Cache corpus
id: cache-corpus
uses: actions/cache@v3
with:
path: |
gwos-evm/polyjuice-tests/fuzz/corpus-cache
key: corpus-${{ env.DATETIME }}
restore-keys: |
corpus
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "11.0"
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Set fuzzing duration for 1h
run: echo "MAX_FUZZ_TIME=3600" >> $GITHUB_ENV
- name: Set fuzzing duration for 1m
if: github.event_name == 'pull_request'
run: echo "MAX_FUZZ_TIME=60" >> $GITHUB_ENV
- name: Fuzzing Polyjuice
working-directory: gwos-evm/polyjuice-tests/fuzz
run: |
mkdir -p corpus-cache
mkdir -p corpus
ls corpus-cache
make build/fuzzer && \
LLVM_PROFILE_FILE="build/fuzzer.profraw" ./build/fuzzer corpus corpus-cache \
-max_total_time=$MAX_FUZZ_TIME -timeout=120 \
-max_len=25000 -rss_limit_mb=0
# Max data buffer size: 24KB < 25000 bytes
- name: Cov report
working-directory: gwos-evm/polyjuice-tests/fuzz
run: |
llvm-profdata merge -sparse build/fuzzer.profraw -o build/fuzzer.profdata
llvm-cov report ./build/fuzzer -instr-profile=build/fuzzer.profdata
- name: merge corpus
working-directory: gwos-evm/polyjuice-tests/fuzz
run: |
mkdir -p corpus-new
./build/fuzzer -merge=1 corpus-new corpus-cache corpus
rm -rf corpus-cache
mv corpus-new corpus-cache
- name: Archive inputs that triggered crashes or sanitizer failures
uses: actions/upload-artifact@v3
if: failure()
with:
name: fuzzing-inputs
path: |
polyjuice-tests/fuzz/crash-*
polyjuice-tests/fuzz/leak-*
polyjuice-tests/fuzz/timeout-*
polyjuice-tests/fuzz/oom-*
- name: Archive corpus
uses: actions/upload-artifact@v3
with:
name: corpus
path: |
gwos-evm/polyjuice-tests/fuzz/corpus-cache/*