|
Embedded SDK
Embedded SDK
|
An app's fuzzing/CMakeLists.txt includes one SDK module, calls ledger_fuzz_setup(), and registers its target with ledger_fuzz_add_app_target(). The module pulls in the whole SDK fuzz subtree (mocks, libraries, Absolution) so the app only lists its own sources.
Always exclude the app's real main(): LibFuzzer provides the entry point.
Call once after project(). It:
invariants/fuzz_globals.zon becomes .{} and mock/scenario_layout.h gets sentinel values,mock/mocks.h to exist (it is app-owned; see The mocks).A thin wrapper over Absolution's absolution_add_fuzzer() for the shape Ledger apps share. It links secure_sdk automatically.
| Argument | Type | Default | Meaning |
|---|---|---|---|
NAME | one | fuzz_globals | Target name; must match [target].fuzzer in the manifest |
HARNESS | one | harness/fuzz_dispatcher.c | Harness translation unit |
ENTRY | one | fuzz_entry | Entry function the generated fuzzer calls |
INVARIANT | one | invariants/fuzz_globals.zon | Absolution model file |
SANITIZERS | one | auto-resolved | -fsanitize= set (see below) |
SOURCES | list | — | App + mock sources to instrument (add the opt-in TLV mutator source here) |
INCLUDE_DIRECTORIES | list | — | Include paths for the build |
COMPILE_DEFINITIONS | list | — | App-specific -D defines |
SANITIZERS is normally left unset: in CI it mirrors ClusterFuzzLite's flags, otherwise it follows the SANITIZER variable, defaulting to fuzzer,address. Apps with a non-standard layout can pass any argument explicitly, or bypass the helper and call absolution_add_fuzzer() directly.
Set with -D<VAR>=... at configure time, or as environment variables where noted.
| Variable | Default | Meaning |
|---|---|---|
LEDGER_FUZZ_ABSOLUTION_VERSION | v1.1.2 | Absolution release tag to fetch |
LEDGER_FUZZ_ABSOLUTION_LOCAL_DIR | unset | Local Absolution install (var or env); skips the download |
LEDGER_FUZZ_TLV_MUTATOR_SOURCE | SDK mock/tlv_mutator.c | Source for the opt-in TLV mutator (see The harness) |
On first configure, ledger_fuzz_setup() downloads the pinned Absolution release with CMake FetchContent and wires up its CMake package and RPATHs. For offline machines or an unreleased Absolution, point at a local install containing bin/absolution and lib/cmake/Absolution/:
export LEDGER_FUZZ_ABSOLUTION_LOCAL_DIR=/absolute/path/to/absolution