Repository navigation
Rewrite the Secure Partition Manager core around constant generated tables - #97
Conversation
4f733fe to
f503035
Compare
f503035 to
ae2973f
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Changes to TrustZone isolation proofs, coroutine exception-frame layout, and Secure stack budgets require human security review and target validation of fault recovery and stack headroom.
No open issues 🎉
What changed in this PR
This PR reworks wolfTrust’s Secure Partition Manager around constant generated tables to reduce Secure flash and RAM usage. It adapts boot, service transports, scheduling, and host fixtures to the new core.
Changes:
- Replaces runtime manifest binding with generated configuration and simplifies scheduler, measurement, and architecture interfaces.
- Migrates host and fuzz harnesses, with additional restart-disabled and trimmed-API test configurations.
- Adds footprint classification, per-port size ceilings, and supporting layout checks and documentation.
| File | Description |
|---|---|
tools/secure_owners.txt |
Updates object ownership for the core and privileged operations. |
tools/l3_layout_args.py |
Supplies SPM-private memory ranges to validation. |
tools/footprint/wolftrust.rules |
Adds wolfTrust footprint categories. |
tools/footprint/tfm.rules |
Adds matching TF-M footprint categories. |
tools/check-core-port-split.sh |
Restricts dependencies of the architecture-neutral SPM. |
tests/host/wolfhsm_relay/Makefile |
Links the shared SPM host fixture. |
tests/host/wolfhsm_relay/main.c |
Migrates relay tests to the SPM fixture. |
tests/host/vnet_relay/Makefile |
Links the shared SPM host fixture. |
tests/host/vnet_relay/main.c |
Updates VNET calls, memory checks, and restart handling. |
tests/host/vault_service/Makefile |
Links the shared SPM host fixture. |
tests/host/tpm_relay/Makefile |
Builds relay tests against the new core. |
tests/host/tpm_relay/main.c |
Migrates TPM transactions to the SPM fixture. |
tests/host/support/spm_tables.h |
Declares host table-derivation support. |
tests/host/support/spm_tables.c |
Derives SPM rows from test manifests. |
tests/host/support/spm_host.mk |
Centralizes core and host-fixture build rules. |
tests/host/support/spm_host.h |
Declares host client and service helpers. |
tests/host/support/secure_domain_resolve.h |
Declares manifest-based reference domain helpers. |
tests/host/support/secure_domain_resolve.c |
Moves reference domain composition into test support. |
tests/host/storage_service/Makefile |
Links the shared SPM host fixture. |
tests/host/spm/Makefile |
Updates production-manifest test sources. |
tests/host/spm/main.c |
Retains validation checks after removing generated binding. |
tests/host/spm_start/Makefile |
Adds a restart-disabled test variant. |
tests/host/spm_gate/trims_main.c |
Checks rejection of trimmed partition APIs. |
tests/host/spm_gate/Makefile |
Builds and runs the trimmed-API variant. |
tests/host/spm_core/Makefile |
Adds core restart and guest-count variants. |
tests/host/psa_storage_client/Makefile |
Links the shared SPM host fixture. |
tests/host/psa_storage_client/main.c |
Migrates storage client integration calls. |
tests/host/psa_ffm_client/Makefile |
Replaces legacy runtime test sources. |
tests/host/psa_ffm_client/main.c |
Updates client fixtures and memory-check controls. |
tests/host/psa_ff_upstream/README.md |
Updates state names and test-suite references. |
tests/host/psa_ff_upstream/psa_binding.h |
Defines host PSA identity bindings. |
tests/host/psa_ff_upstream/psa_binding.c |
Implements PSA bindings over the SPM fixture. |
tests/host/psa_ff_upstream/Makefile |
Builds upstream tests with the new bindings. |
tests/host/ps_service/Makefile |
Links the shared SPM host fixture. |
tests/host/port_flash/Makefile |
Migrates flash tests to the SPM fixture. |
tests/host/port_binding/main.c |
Adapts fixtures to pointer-based memory windows. |
tests/host/pkcs11_relay/Makefile |
Links the shared SPM host fixture. |
tests/host/pkcs11_relay/main.c |
Migrates PKCS#11 relay transactions. |
tests/host/negatives/Makefile |
Links negative tests against the new core. |
tests/host/negatives/main.c |
Renames the key-isolation test secret. |
tests/host/monitor/Makefile |
Adds a guest-restart-disabled variant. |
tests/host/monitor/main.c |
Updates monitor stubs and quarantine coverage. |
tests/host/manifest_ports/run.sh |
Uses table derivation in port-manifest checks. |
tests/host/manifest_ports/main.c |
Checks constant guest rows and derived SPM tables. |
tests/host/Makefile |
Registers core and footprint suites; removes legacy suites. |
tests/host/layout_config/test_layout_config.py |
Checks per-guest sizing in manifest templates. |
tests/host/keystore_isolation/main.c |
Removes comparative wording from a comment. |
tests/host/keystore_ipc/Makefile |
Links the shared SPM host fixture. |
tests/host/irq_claim/main.c |
Replaces callback fixtures with architecture stubs. |
tests/host/ipc/Makefile |
Removes the retired IPC suite build. |
tests/host/ipc/main.c |
Removes tests for the retired IPC implementation. |
tests/host/guest_verify/main.c |
Adapts measurement tests to pointer-backed records. |
tests/host/fwu_service/Makefile |
Links the shared SPM host fixture. |
tests/host/fwu_restore/main.c |
Captures restore hooks during scheduler registration. |
tests/host/footprint_classify/Makefile |
Adds the footprint-classifier suite entry point. |
tests/host/ffm_veneer/Makefile |
Builds veneer tests with the SPM fixture. |
tests/host/ffm_domain/Makefile |
Links reference domain-resolution helpers. |
tests/host/ffm_domain/main.c |
Uses host-only domain helpers and updated structures. |
tests/host/boot_seed/main.c |
Replaces runtime accessor stubs with core state. |
tests/host/attestation_service/Makefile |
Links the shared SPM host fixture. |
tests/host/attestation_service/main.c |
Migrates attestation routing tests. |
tests/host/attestation_iak/main.c |
Simplifies the key-isolation description comment. |
tests/host/attestation_golden/Makefile |
Disables wolfCOSE text-encoding validation. |
tests/host/attest_restore/main.c |
Updates restore-hook and measurement stubs. |
tests/fuzz/Makefile |
Fuzzes the new core through host and gateway support. |
src/sync/mutex.c |
Reuses queued acquisition and rejects recursive locking. |
src/spm.c |
Removes the generated-manifest binding initializer. |
src/spm_partitions.c |
Supplies restore hooks during scheduler registration. |
src/services/vnet/vnet_relay_service.c |
Uses the build-specific default transport. |
src/services/vault_service.c |
Uses the build-specific default transport. |
src/services/storage_service.c |
Uses the new core’s transfer-budget constant. |
src/services/native/keyvault.c |
Removes a comparative security claim from a comment. |
src/services/msg_relay.c |
Restores the build-specific default transport. |
src/services/initial_attestation.c |
Centralizes challenge checks and restricts direct target access. |
src/services/hsm_relay_service.c |
Uses the build-specific default transport. |
src/services/boot_handoff.c |
Consolidates handoff copying, validation, and clearing. |
src/partition.c |
Updates the port-binding validation comment. |
src/monitor.c |
Uses generated configuration and conditional validation/restart paths. |
src/irq_claim.c |
Calls linked architecture operations directly. |
src/guest_verify.c |
Stores pointers to pinned measurement records. |
src/ffm_domain.c |
Removes manifest-derived domain construction from production code. |
src/ffm_api.c |
Removes the legacy direct PSA binding implementation. |
src/client/psa_storage_client.c |
Updates the transfer-budget comment. |
src/boot.c |
Writes lifecycle information directly into core state. |
src/arch/common/spm_sp_api.c |
Conditionally compiles optional partition APIs. |
src/arch/common/measure_ops.c |
Separates privileged measurement retrieval. |
src/arch/common/keystore_ops.c |
Separates privileged flash and entropy operations. |
src/arch/common/fwu_ops.c |
Separates privileged firmware-update operations. |
src/arch/armv8m/start_armv8m.c |
Makes image initialization and stack clearing table-driven. |
src/arch/armv8m/sp_fault_armv8m.c |
Gates optional forensics and uses shared coroutine offsets. |
src/arch/armv8m/irq_armv8m.c |
Exposes directly linked interrupt-controller operations. |
src/arch/armv8m/ffm_nsc.c |
Uses consolidated guest-buffer checks. |
src/arch/armv8m/coroutine_armv8m.c |
Replaces assembly offset literals with shared definitions. |
src/arch/armv8m/cmse.c |
Consolidates guest-window and hardware access checks. |
port/stm32l562/port.json |
Adds non-crypto and SPM flash ceilings. |
port/stm32h563/port.json |
Adds non-crypto and SPM flash ceilings. |
port/mimxrt700/port.json |
Adds non-crypto and SPM flash ceilings. |
port/mcxn947/port.json |
Adds non-crypto and SPM flash ceilings. |
port/common/armv8m/platform_armv8m.c |
Removes obsolete gateway installation. |
port/common/armv8m/l3_layout.h |
Reduces the default wolfHSM crypto stack allocation. |
mk/layout.mk |
Applies assembly crypto stack sizing to both engines. |
Makefile |
Replaces legacy IPC/FF-M targets with SPM-core targets. |
include/wolftrust/vnet/vnet_abi.h |
Updates the transfer-budget comment. |
include/wolftrust/spm.h |
Removes the generated-binding declaration. |
include/wolftrust/spm_sp_mem.h |
Defines generated partition memory rows. |
include/wolftrust/spm_sched.h |
Integrates restore hooks and gates boot validation. |
include/wolftrust/spm_ops.h |
Declares privileged service-operation handlers. |
include/wolftrust/spm_gate.h |
Defines default transports and the shared run entry point. |
include/wolftrust/services/msg_relay.h |
Updates relay initialization and transport documentation. |
include/wolftrust/sched/tasklet.h |
Removes the obsolete scheduler-run wrapper. |
include/wolftrust/sched/coroutine.h |
Removes runqueue APIs and updates scheduling contracts. |
include/wolftrust/sched/coroutine_internal.h |
Sizes coroutine storage from generated counts. |
include/wolftrust/partition.h |
Uses constant memory arrays and manifest comparison. |
include/wolftrust/manifest.h |
Defines when boot isolation validation is enabled. |
include/wolftrust/irq_claim.h |
Replaces callback tables with architecture declarations. |
include/wolftrust/ipc.h |
Removes the retired IPC interface. |
include/wolftrust/guest_verify.h |
Documents pointer-backed measurement lifetimes. |
include/wolftrust/ffm_gateway.h |
Removes the gateway-install declaration. |
include/wolftrust/ffm_domain.h |
Removes runtime domain-construction interfaces and stack fields. |
include/wolftrust/ffm_boot.h |
Simplifies boot initialization and removes runtime accessors. |
include/wolftrust/arch/armv8m/cmse.h |
Declares the consolidated guest-buffer check. |
docs/Security-Model.md |
Updates documented main-stack size and measured usage. |
docs/Project-Structure.md |
Documents the SPM core and footprint tools. |
docs/Porting.md |
Documents per-port flash ceilings. |
.gitignore |
Removes the redundant retired IPC build entry. |
.github/workflows/cross-compile.yml |
Adds flash ceilings and expands feature-flag build coverage. |
Review effort: Balanced
|
Reviewed and tested at 60c92d7. Host suites pass, the SPM fuzzer ran 23M executions clean under ASan, and the STM32H563 native smoke tier plus One thing I would like settled before merge:
Follow-ups, fine as separate PRs:
Unrelated to this PR, found while testing: |
SPM and non-crypto Secure code, non-LTO, bytes, against main:
Whole Secure image, LTO, bytes, against main:
Testing: