From 552123670027e0ccb124c467ae56de92c8e457e9 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Mon, 2 Aug 2021 13:40:51 +0200 Subject: Add a stand-alone replayer The replayer can be used to reproduce crashes for fuzz targets using the FuzzedDataProvider only given the raw crashing input. This will help maintainers of OSS-Fuzz projects to reproduce issues even though they have no access to the Java reproducers, which ClusterFuzz does not store. Compared to the full Jazzer driver, it has the advantage that it is a Java library (with a native library dependency) and can thus be published to Maven. Since we currently do not have multi-platform RBE or cross toolchains set up on GitHub, the packages jars for the individual architectures are merged in a GitHub Actions pipeline. --- .github/workflows/build-replayer.yml | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/build-replayer.yml (limited to '.github') diff --git a/.github/workflows/build-replayer.yml b/.github/workflows/build-replayer.yml new file mode 100644 index 00000000..aa617416 --- /dev/null +++ b/.github/workflows/build-replayer.yml @@ -0,0 +1,76 @@ +name: Release replayer + +on: + workflow_dispatch: + +jobs: + + build_replayer: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-10.15] + include: + - os: ubuntu-latest + arch: "linux" + cache: "/home/runner/.cache/bazel-disk" + - os: macos-10.15 + arch: "darwin" + cache: "/private/var/tmp/bazel-disk" + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Mount Bazel disk cache + uses: actions/cache@v2 + with: + path: ${{ matrix.cache }} + key: bazel-disk-cache-${{ matrix.arch }}-8 + + - name: Build + run: | + bazelisk build --config=ci --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }} --disk_cache=${{ matrix.cache }} --java_runtime_version=localjdk_${{ matrix.jdk }} //agent/src/main/java/com/code_intelligence/jazzer/replay:Replayer_deploy.jar + cp -L bazel-bin/agent/src/main/java/com/code_intelligence/jazzer/replay/Replayer_deploy.jar replayer.jar + + - name: Upload test logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: replayer_${{ matrix.arch }}.jar + path: replayer.jar + + merge_jars: + runs-on: ubuntu-latest + needs: build_replayer + + steps: + - name: Download macOS jar + uses: actions/download-artifact@v2 + with: + name: replayer_darwin.jar + path: replayer_darwin + + - name: Download Linux jar + uses: actions/download-artifact@v2 + with: + name: replayer_linux.jar + path: replayer_linux + + - name: Merge jars + run: | + mkdir merged + unzip -o replayer_darwin/replayer.jar -d merged + unzip -o replayer_linux/replayer.jar -d merged + jar cvmf merged/META-INF/MANIFEST.MF replayer.jar -C merged . + + - name: Upload merged jar + uses: actions/upload-artifact@v2 + with: + name: replayer.jar + path: replayer.jar + -- cgit v1.2.3