Skip to content

Commit

Permalink
[core] Add a fuzzing regression test github action
Browse files Browse the repository at this point in the history
While fuzzing subzero core before the nanopb 0.4.5 upgrade,
the fuzzer found a bunch of inputs which triggered UBSAN.

This PR creates a regression test that runs the fuzzer with these inputs
and verifies that none of them fail now that we're on nanopb 0.4.5.

If more bad inputs are discovered later, they can be added to this directory
after the corresponding bugs are fixed.
  • Loading branch information
ivmaykov committed Aug 1, 2023
1 parent 0375387 commit 41a3d26
Show file tree
Hide file tree
Showing 48 changed files with 76 additions and 2 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/fuzzing-regression-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Subzero regression test for bugs discovered with fuzz testing
name: "Fuzzing Regression Test"

on:
push:
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
# Daily at 1am
- cron: '0 1 * * *'

jobs:
fuzzing-regression-test:
name: "Fuzzing Regression Test"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -euxo pipefail {0}

strategy:
fail-fast: false
matrix:
python-version: [3.9]

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
submodules: 'recursive'

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: |
python -c "import sys; print(sys.version)"
- name: Install dependencies
run: scripts/ubuntu_install_protobuf.sh

- name: Setup Clang
uses: egor-tensin/[email protected]
with:
version: latest
platform: x64

# Build CORE with ASAN, UBSAN, and libfuzzer
- name: Build Subzero Core (ASAN+UBSAN+FUZZER)
run: |
export CC=`which clang`
export CXX=`which clang++`
scripts/build_core.sh -DENABLE_ASAN=ON -DENABLE_UBSAN=ON -DENABLE_FUZZER=ON
- name: Run Subzero CORE Fuzzing regression test
run: |
cd ${{ github.workspace }}
./core/build/subzero_fuzzer-testnet ./core/fuzzing_regression_test_inputs/*
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 12 additions & 2 deletions scripts/build_core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@ cd core/build
# For mainnet. Skip compile_db generation
TARGET=dev CURRENCY=btc-mainnet cmake ../ "$@"
make
mv subzero subzero-mainnet
if [ -f subzero ]; then
mv subzero subzero-mainnet
fi
if [ -f subzero_fuzzer ]; then
mv subzero_fuzzer subzero_fuzzer-mainnet
fi
# For testnet. Generate compile_db for clang static analyzer
make clean
TARGET=dev CURRENCY=btc-testnet cmake ../ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON "$@"
make
mv subzero subzero-testnet
if [ -f subzero ]; then
mv subzero subzero-testnet
fi
if [ -f subzero_fuzzer ]; then
mv subzero_fuzzer subzero_fuzzer-testnet
fi

0 comments on commit 41a3d26

Please sign in to comment.