## Summary PoC-A proved that dynamically loaded ELF plugins are workable on ESP32-S3: plugins ship as signed MPB packages, are parsed by a strict single-type parser shared between host and target, and execute from PSRAM+IRAM within a measured admission budget. A 1000-cycle load/unload soak passed 18/18 trend gates with stable heaps, the capacity ladder settled at 8 coexisting plugin instances with a 3356B per-instance budget, and the fail-closed corpus executed zero attacker-controlled bytes across 14 rejection classes. Scheduler semantics (strand FIFO ordering, completion-cancel CAS, quiesce-as-noop ABI) were validated on both host (TSan suite) and target. **Gate-A verdict: PASS** — ADR-0002 moves to **Accepted** with the capacity value 8 and global-sum admission rule as PoC-derived proposals. ## Changes by area Grouped from `git log main..HEAD --oneline` (18 commits): - **Vendored loader + patches**: `4bb53f2` vendor elf_loader 1.3.3 + harness scaffold; `2f67b4f` plugin_iram loader patch with budget consistency (p1-p5 patch series in `PATCHES.md`). - **MPB toolchain**: `4793cc2` deterministic MPB manifest builder with test signing; `408df44` strict single-type MPB parser shared host/target; `796f9d2` host MPB corpus + policy CI lane. - **Plugin pipeline + probes**: `21d2842` plugin pipeline and first PSRAM execution on target; `cab9664` relocation/import allowlist matrix with probes; `c5d6c6c` C++ feature rejection matrix. - **Harness commands**: `e0e7159` generation coexistence with measured admission budget; `2a37556` thousand-cycle lifecycle soak with heap trend gate; `093a72b` on-target scheduler semantics validation (+ `eea3876` clang-format-18 sweep); `a302151` capacity ladder with signed budget; `f34dc72` fail-closed corpus with execution sentinel. - **Host prototypes**: `6198bca` strand FIFO prototype with TSan suite; `1c3ad59` completion-cancel CAS and cleanup semantics. - **Evidence + ADR/docs**: `887d0f7` Gate-A manifest and report; `1c29e8a` ADR-0002 outcome + frozen PoC values. ## QA evidence - `poc/evidence/poc-a-20260901/manifest.json` — 67-artifact hash index, every sha256 recomputed at assembly. - `poc/evidence/poc-a-20260901/GATE-A-REPORT.md` — full nine-item development-plan §4 mapping; TEST-003 10/10 clauses. - 14 verbatim per-task transcripts (`task-1` … `task-15-*.log`) + fresh build artifacts (`build/frame_poc_a.map`, size components). - Frozen in-repo references: `ALLOWLIST.md`, `REJECT-MATRIX.md`, `ADMISSION-BUDGET.md`, `soak_samples_1000.csv`, fc corpus (33 committed `.mpb` containers). - F1-F4 final-wave verdicts: **APPROVE**. - Key numbers: soak **18/18** trend gates over 1000 cycles; capacity **8/8** instances, **3356B** per-instance; fc corpus **14 rejection classes, zero attacker bytes executed**; **4 upstream loader defects found and patched** (p1-p5). ## Requirement IDs (GOV-006) ADR-0002; TEST-002, TEST-003; PLUG-001, PLUG-004, PLUG-008, PLUG-009; MEM-001, MEM-003, MEM-007, MEM-008; LIFE-001, LIFE-002, LIFE-005, LIFE-007; SEC-002, SEC-003, SEC-004, SEC-005; GH-003; GOV-004, GOV-005. ## Risks / known limitations From `GATE-A-REPORT.md` §(f) plus the trade-off table: 1. **Capacity descent path 7-5 unexercised** — rung 8 passed first attempt; rungs 7/6/5 and retry-once logic never ran on hardware (untested against real OOM). 2. **No Wi-Fi in the harness (MEM-001 caveat)** — all PSRAM/IRAM budget numbers are radio-off harness-class; product admission budgets must be re-measured with the network stack active. 3. **On-target scheduler vectors are a subset of the host suite** (256-node pool / 2e4 storm posts vs host 31000 / 1e5); consistency declaration covers only the vectors actually run. 4. **Quiesce is a no-op by ABI semantics** — plugin ABI 1.2 has no quiesce slot; NULL entry is defined as trivial success; real quiesce coordination is later-gate work. 5. **MEMPROT=n trade-off** — `CONFIG_ESP_SYSTEM_MEMPROT=n` is required for the IDF exec heap (`MALLOC_CAP_EXEC`) that `.plugin_iram` needs; software-only PMP config, no eFuse burned (documented in `PATCHES.md` p5); production must re-decide security vs plugin IRAM. 6. **Owner sign-off PENDING** — Gate-A PASS is the PoC team's verdict; formal acceptance of ADR-0002 awaits the owner. ## Not in scope - Product components (GOV-004) — this PR is PoC evidence only; no product code paths change. - **Merge is the owner's call** — do not merge without owner sign-off on ADR-0002. --------- Co-authored-by: ania-lain <[email protected]>
126 lines
5.0 KiB
CMake
126 lines
5.0 KiB
CMake
cmake_minimum_required(VERSION 3.25)
|
|
|
|
project(frame_poc_host LANGUAGES C CXX)
|
|
|
|
set(CMAKE_C_STANDARD 17)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(CMAKE_C_EXTENSIONS OFF)
|
|
set(CMAKE_CXX_STANDARD 26)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
option(ENABLE_SANITIZERS "Enable AddressSanitizer and UndefinedBehaviorSanitizer" OFF)
|
|
option(ENABLE_TSAN "Enable ThreadSanitizer" OFF)
|
|
option(ENABLE_COVERAGE "Enable LLVM source-based coverage" OFF)
|
|
option(ENABLE_FUZZER "Build the Clang libFuzzer contract target" OFF)
|
|
option(ENABLE_CLANG_TIDY "Run clang-tidy on Frame host targets" OFF)
|
|
|
|
include(FetchContent)
|
|
FetchContent_Declare(
|
|
googletest
|
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
|
GIT_TAG 52eb8108c5bdec04579160ae17225d66034bd723
|
|
GIT_SHALLOW FALSE
|
|
)
|
|
set(INSTALL_GTEST OFF CACHE BOOL "" FORCE)
|
|
FetchContent_MakeAvailable(googletest)
|
|
include(GoogleTest)
|
|
|
|
add_library(frame_poc_contract INTERFACE)
|
|
target_include_directories(frame_poc_contract INTERFACE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../common/components/frame_poc_runtime/include")
|
|
target_compile_options(frame_poc_contract INTERFACE
|
|
$<$<COMPILE_LANGUAGE:C>:-Wall;-Wextra;-Werror;-Wpedantic>
|
|
$<$<COMPILE_LANGUAGE:CXX>:-Wall;-Wextra;-Werror;-Wpedantic>)
|
|
|
|
if((ENABLE_SANITIZERS AND ENABLE_TSAN) OR
|
|
(ENABLE_FUZZER AND (ENABLE_SANITIZERS OR ENABLE_TSAN OR ENABLE_COVERAGE)))
|
|
message(FATAL_ERROR "Sanitizer, TSan, coverage, and fuzz modes require separate builds")
|
|
endif()
|
|
|
|
if(ENABLE_FUZZER)
|
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
message(FATAL_ERROR "ENABLE_FUZZER requires Clang")
|
|
endif()
|
|
add_executable(frame_contract_fuzz tests/frame_contract_fuzz.cc)
|
|
target_link_libraries(frame_contract_fuzz PRIVATE frame_poc_contract)
|
|
target_compile_options(frame_contract_fuzz PRIVATE
|
|
-fno-omit-frame-pointer -fsanitize=fuzzer,address,undefined)
|
|
target_link_options(frame_contract_fuzz PRIVATE
|
|
-fno-omit-frame-pointer -fsanitize=fuzzer,address,undefined)
|
|
endif()
|
|
|
|
if(ENABLE_SANITIZERS)
|
|
target_compile_options(frame_poc_contract INTERFACE
|
|
-fno-omit-frame-pointer -fsanitize=address,undefined)
|
|
target_link_options(frame_poc_contract INTERFACE
|
|
-fno-omit-frame-pointer -fsanitize=address,undefined)
|
|
endif()
|
|
|
|
if(ENABLE_TSAN)
|
|
target_compile_options(frame_poc_contract INTERFACE
|
|
-fno-omit-frame-pointer -fsanitize=thread)
|
|
target_link_options(frame_poc_contract INTERFACE
|
|
-fno-omit-frame-pointer -fsanitize=thread)
|
|
endif()
|
|
|
|
if(ENABLE_COVERAGE)
|
|
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
message(FATAL_ERROR "ENABLE_COVERAGE requires Clang")
|
|
endif()
|
|
target_compile_options(frame_poc_contract INTERFACE
|
|
-fprofile-instr-generate -fcoverage-mapping)
|
|
target_link_options(frame_poc_contract INTERFACE
|
|
-fprofile-instr-generate -fcoverage-mapping)
|
|
endif()
|
|
|
|
enable_testing()
|
|
|
|
add_library(frame_poc_strand STATIC src/frame_strand.cc)
|
|
target_include_directories(frame_poc_strand PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
target_link_libraries(frame_poc_strand PUBLIC frame_poc_contract)
|
|
|
|
add_executable(frame_abi_test tests/frame_abi_test.cc)
|
|
target_link_libraries(frame_abi_test PRIVATE frame_poc_contract GTest::gtest_main)
|
|
gtest_discover_tests(frame_abi_test)
|
|
|
|
add_executable(frame_abi_c_test tests/frame_abi_c_test.c)
|
|
target_link_libraries(frame_abi_c_test PRIVATE frame_poc_contract)
|
|
add_test(NAME frame_abi_c_test COMMAND frame_abi_c_test)
|
|
|
|
add_executable(frame_handle_test tests/frame_handle_test.cc)
|
|
target_link_libraries(frame_handle_test PRIVATE frame_poc_contract GTest::gtest_main)
|
|
gtest_discover_tests(frame_handle_test)
|
|
|
|
add_executable(lifecycle_state_test tests/lifecycle_state_test.cc)
|
|
target_link_libraries(lifecycle_state_test PRIVATE frame_poc_contract GTest::gtest_main)
|
|
gtest_discover_tests(lifecycle_state_test)
|
|
|
|
add_executable(mpb_parser_test
|
|
tests/mpb_parser_test.cc
|
|
tests/sha256_ref.c
|
|
../common/components/frame_poc_mpb/src/mpb_parser.c)
|
|
target_include_directories(mpb_parser_test PRIVATE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../common/components/frame_poc_mpb/include"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/tests")
|
|
target_compile_definitions(mpb_parser_test PRIVATE
|
|
MPB_CORPUS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/mpb_corpus")
|
|
target_link_libraries(mpb_parser_test PRIVATE frame_poc_contract GTest::gtest_main)
|
|
gtest_discover_tests(mpb_parser_test)
|
|
|
|
add_executable(frame_strand_test tests/frame_strand_test.cc)
|
|
target_link_libraries(frame_strand_test PRIVATE frame_poc_strand GTest::gtest_main)
|
|
gtest_discover_tests(frame_strand_test)
|
|
|
|
add_executable(frame_completion_test tests/frame_completion_test.cc)
|
|
target_link_libraries(frame_completion_test PRIVATE frame_poc_strand GTest::gtest_main)
|
|
gtest_discover_tests(frame_completion_test)
|
|
|
|
if(ENABLE_CLANG_TIDY)
|
|
find_program(CLANG_TIDY_EXECUTABLE NAMES clang-tidy-18 clang-tidy REQUIRED)
|
|
foreach(target frame_abi_test frame_handle_test lifecycle_state_test frame_strand_test
|
|
frame_completion_test)
|
|
set_property(TARGET ${target} PROPERTY CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
|
|
endforeach()
|
|
endif()
|