Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Base image with clang toolchain
# SDK ClusterFuzzLite Dockerfile. Builds the Absolution-driven SDK self-fuzz
Comment thread
N3ur0sis marked this conversation as resolved.
# targets defined under fuzzing/sdk-fuzz/ (see .clusterfuzzlite/build.sh).
FROM gcr.io/oss-fuzz-base/base-builder:v1

RUN pip3 install --break-system-packages --no-cache-dir pillow>=3.4.0
RUN apt update && apt install -y ninja-build zip

# Copy the project's source code.
COPY . $SRC/ledger-secure-sdk

# Working directory for build.sh
WORKDIR $SRC/ledger-secure-sdk

# Copy build.sh into $SRC dir.
COPY ./.clusterfuzzlite/build.sh $SRC/
35 changes: 19 additions & 16 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
#!/bin/bash -e

pushd fuzzing
cmake -S . -B build -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Debug \
-G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DBOLOS_SDK=/src/ledger-secure-sdk/ -DTARGET=flex \
-DAPP_BUILD_PATH=/src/ledger-secure-sdk/
# Generates .zip for initial corpus in clusterFuzz
for dir in harness/*; do
if [ -d "$dir" ]; then
fuzzer_name=$(basename "$dir")
zip_name="${fuzzer_name}_seed_corpus.zip"
echo "Zipping corpus from $dir into $zip_name"
# SDK self-fuzz targets under fuzzing/sdk-fuzz/ are Absolution-driven: absolution_add_fuzzer() regenerates each harness from the model, using the same app contract as real apps.

(cd "$dir" && zip -q -r "$zip_name" .)
SDK_DIR="${SRC:-/src}/ledger-secure-sdk"

mv "$dir/$zip_name" "$OUT/"
fi
pushd "${SDK_DIR}/fuzzing/sdk-fuzz"

cmake -S . -B build-absolution \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_BUILD_TYPE=Debug \
-G Ninja \
-DCMAKE_EXPORT_COMPILE_COMMANDS=On \
-DBOLOS_SDK="${SDK_DIR}" \
-DTARGET=flex \
-DAPP_BUILD_PATH="${SDK_DIR}"

cmake --build build-absolution

for fuzzer in ./build-absolution/fuzz_*; do
[[ -f "${fuzzer}" && -x "${fuzzer}" ]] || continue
cp "${fuzzer}" "${OUT}/"
done
cmake --build build
mv ./build/fuzz_* "${OUT}"

popd
40 changes: 0 additions & 40 deletions .github/workflows/cflite_cron.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .github/workflows/cflite_pr.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/clusterfuzzlite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ClusterFuzzLite fuzzing tests

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
schedule:
- cron: '0 13 * * 6' # 13:00 UTC every Saturday

permissions: read-all

jobs:
Fuzzing:
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_clusterfuzz_tests.yml@v1
with:
exec_mode: ${{ github.event_name }}
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@ unit-tests/lib_*/build/
build
fuzzing/build/
fuzzing/out/
fuzzing/mock/generated/
fuzzing/mock/_generated/
# SDK self-fuzz generated artifacts
fuzzing/sdk-fuzz/invariants/*.zon
fuzzing/sdk-fuzz/mock/scenario_layout.h
.fuzz-artifacts/
*.profraw
*.profdata

# LSP
compile_commands.json
Loading
Loading