diff --git a/.github/actions/deps/action.yml b/.github/actions/deps/action.yml index 576d094316..3d662cd790 100644 --- a/.github/actions/deps/action.yml +++ b/.github/actions/deps/action.yml @@ -22,7 +22,7 @@ runs: echo "HAS_APT_GET=0" >> $GITHUB_ENV fi - - name: apt-get update + - name: apt-get update && sudo apt-get install -y cmake shell: bash run: sudo apt-get update if: env.HAS_APT_GET == '1' diff --git a/.github/actions/fc/action.yml b/.github/actions/fc/action.yml new file mode 100644 index 0000000000..a6bb64e849 --- /dev/null +++ b/.github/actions/fc/action.yml @@ -0,0 +1,55 @@ +name: Generate Firedancer Fuzz Targets +description: Generates Firedancer fuzz targets and .fc files + +inputs: + SKID: + description: "AWS Secret key id" + required: true + type: string + AKID: + description: "AWS access key" + required: true + type: string + previous_action_outputs: + description: 'Outputs from the previous action' + required: true + type: string + +runs: + using: "composite" + steps: + - name: checkout fd + uses: actions/checkout@v4 + + - name: Download artifacts from previous action + id: get-artifacts + uses: actions/download-artifact@v4 + with: + path: build + merge-multiple: true + + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y zip unzip + shell: bash + + - name: Generate fuzz targets and .fc files, md5 zipfile + id: fileops + run: | + ls contrib/test || ls contrib/* + chmod +x ./contrib/test/bundle-binaries-fc.sh + ./contrib/test/bundle-binaries-fc.sh ./build ./fc-fd-latest.zip + FCBUNDLEMD5=$(md5sum ./fc-fd-latest.zip | cut -d' ' -f1) + echo "bundle-md5=$FCBUNDLEMD5" >> "$GITHUB_OUTPUT" + shell: bash + + - name: Upload to FC S3 + env: + AWS_ACCESS_KEY_ID: ${{ inputs.AKID }} + AWS_SECRET_ACCESS_KEY: ${{ inputs.SKID }} + AWS_DEFAULT_REGION: us-east-2 + run: | + aws s3 cp --debug ./fc-fd-latest.zip s3://fuzzcorp-bundle-dropbox-975049986498-86c13d2/org_rvfruw8l/prj_rvfruw8lvGQ/${{ steps.fileops.outputs.bundle-md5 }}.zip + shell: bash + \ No newline at end of file diff --git a/.github/workflows/clusterfuzz.yml b/.github/workflows/clusterfuzz.yml index b99914e52c..b95d969c91 100644 --- a/.github/workflows/clusterfuzz.yml +++ b/.github/workflows/clusterfuzz.yml @@ -2,6 +2,7 @@ name: Publish to ClusterFuzz on: workflow_call: workflow_dispatch: + pull_request: jobs: clusterfuzz-publish: environment: @@ -20,17 +21,17 @@ jobs: artifact_dir: build/linux/clang/icelake qualifier: highend runs-on: - group: github-v1 + ubuntu-latest env: MACHINE: ${{ matrix.machine }} EXTRAS: fuzz asan ubsan steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/hugepages + # - uses: ./.github/actions/hugepages - uses: ./.github/actions/deps - - run: sudo apt update && sudo apt install -y zip + - run: sudo apt update && sudo apt install -y zip patchelf - uses: asymmetric-research/clusterfuzz-fuzzbot-builder@main name: Build fuzz tests @@ -50,3 +51,33 @@ jobs: project-id: isol-clusterfuzz qualifier: ${{ matrix.qualifier }} service-account-credentials: ${{ secrets.FUZZ_SERVICE_ACCT_JSON_BUNDLE }} + + - name: Find the tmpdir containing our binaries and rewritten-rpath libs + id: find-fuzzdir + run: | + FD_DIR=$(find /tmp/ | grep fdfuzz | head -n 1) + mkdir -p ./build/lib + cp $FD_DIR/lib/*.so* ./build/lib/ + - uses: actions/upload-artifact@v4 + name: Upload harness binaries and libs to GHA Artifacts + with: + name: ${{ github.run_id }}-${{ matrix.machine }} + path: ./build/ + retention-days: 1 + + + fuzzcorp-publish: + needs: clusterfuzz-publish + runs-on: + ubuntu-latest + steps: + + - uses: actions/checkout@v4 + - uses: ./.github/actions/fc + with: + SKID: ${{ secrets.AWS_SKID }} + AKID: ${{ secrets.AWS_AKID }} + previous_action_outputs: | + ${{ github.run_id }}-linux_clang_haswell + ${{ github.run_id }}-linux_clang_icelake + diff --git a/contrib/test/bundle-binaries-fc.sh b/contrib/test/bundle-binaries-fc.sh new file mode 100644 index 0000000000..607a8ece09 --- /dev/null +++ b/contrib/test/bundle-binaries-fc.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# This script will take the path to build/ as an argument $1 and create the needed .fc +# files alongside the harnesses, then create the final zip at $2. +set -e + +build_dir="$1" +output_zip="$2" + +# Loop through each architecture, compiler, and fuzz target +for arch in haswell icelake; do + for compiler in clang; do #aflgcc later + for target_dir in "$build_dir/linux/$compiler/$arch/fuzz-test"/*; do + target=$(basename "$target_dir") + + # Create the target directory structure + target_path="targets/$arch/$compiler/$target" + mkdir -p "$target_path" + + # Chmod and copy the fuzz target binary + chmod +x "$target_dir/$target" + cp "$target_dir/$target" "$target_path/" + + # Create the .fc file + fc_file="$target_path/$target.fc" + cat > "$fc_file" <