eBPF-based security platform
ci: fuzz the parsers under AFL++ as well
Daniel Borkmanncc9c4d1fd3cb
diff --git a/.github/workflows/sanitizers.yml b/.github/workflows/sanitizers.ymlindex f30ea412..0dc213bf 100644--- a/.github/workflows/sanitizers.yml+++ b/.github/workflows/sanitizers.yml@@ -261,3 +261,80 @@ jobs:name: fuzz-crashespath: testing/fuzz/crash-*if-no-files-found: ignore++ # The same targets under AFL++, whose comparison logging and mutators+ # find inputs libFuzzer does not, for a minute a target on a push or a+ # pull request and ten by hand. It shares the corpus with the libFuzzer+ # job through the cache: each starts from what the newest run of+ # either kept on main.+ afl-fuzz:+ name: afl-fuzz+ runs-on: ubuntu-latest+ timeout-minutes: 180++ steps:+ - name: Check out repository+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1++ - name: Restore the LVH OpenSSL toolchain+ id: lvh-openssl+ uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0+ with:+ path: build/host-openssl+ key: host-openssl-lvh-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/scripts/vm-toolchain.sh') }}++ - name: Restore the AFL++ build+ id: afl+ uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0+ with:+ path: build/afl+ key: afl-lvh-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.github/scripts/afl-deps.sh') }}++ - name: Restore the fuzz corpora+ uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0+ with:+ path: build/fuzz-corpus+ key: fuzz-corpus-afl-${{ github.run_id }}-${{ github.run_attempt }}+ restore-keys: fuzz-corpus-++ - name: Fuzz the parsers of input from outside the host with AFL++ in LVH VM+ id: fuzz+ uses: cilium/little-vm-helper@c8b0bfbae3bdda7bc69fb9cd370e4b74ce84986d # v0.0.33+ with:+ test-name: shirudo-afl-fuzz+ image: kind+ image-version: bpf-next-20260603.072225+ kernel-version: bpf-next-main+ host-mount: ${{ github.workspace }}+ images-folder-parent: ${{ github.workspace }}/../lvh+ install-dependencies: true+ cmd: |+ cd /host+ .github/scripts/vm-toolchain.sh libclang-rt-23-dev llvm-23-dev+ . build/vm-toolchain.env+ .github/scripts/afl-deps.sh+ PATH=/host/build/afl/bin:\$PATH make -j"\$(nproc)" -C testing afl \+ AFL_SECONDS=${{ github.event_name == 'workflow_dispatch' && 600 || 60 }} \+ FUZZ_CORPUS=/host/build/fuzz-corpus++ - name: Save the AFL++ build+ if: always() && steps.afl.outputs.cache-hit != 'true' && hashFiles('build/afl/.built') != ''+ uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0+ with:+ path: build/afl+ key: ${{ steps.afl.outputs.cache-primary-key }}++ - name: Save the fuzz corpora+ if: always() && steps.fuzz.outcome != 'skipped' && (github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main'))+ uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0+ with:+ path: build/fuzz-corpus+ key: fuzz-corpus-afl-${{ github.run_id }}-${{ github.run_attempt }}++ - name: Upload the crash inputs+ if: failure()+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2+ with:+ name: afl-fuzz-crashes+ path: testing/fuzz/crash-afl-*+ if-no-files-found: ignorediff --git a/Documentation/contribute/testing/testing.rst b/Documentation/contribute/testing/testing.rstindex 162ab076..832231b8 100644--- a/Documentation/contribute/testing/testing.rst+++ b/Documentation/contribute/testing/testing.rst@@ -403,6 +403,12 @@ corpus, which the next libFuzzer run merges down. A crash fails the runand leaves its input in ``testing/fuzz/crash-afl-<target>-<n>``; thelibFuzzer build of the target reproduces it like any other input.+The ``afl-fuzz`` job of the ``Sanitizers`` workflow runs every target+under AFL++ when the ``libFuzzer`` job does, for as long, and saves its+corpus when that job does. Each starts from the newest corpus either+kept, so that what one finds the other starts from. What crashed is in+the job's ``afl-fuzz-crashes`` artifact.+Use the test VM---------------