Skip to content

Add CBMC target platform support#1760

Open
tob-joe wants to merge 2 commits into
pq-code-package:mainfrom
tob-joe:ptp/cbmc-target-platforms-v3
Open

Add CBMC target platform support#1760
tob-joe wants to merge 2 commits into
pq-code-package:mainfrom
tob-joe:ptp/cbmc-target-platforms-v3

Conversation

@tob-joe

@tob-joe tob-joe commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • add explicit CBMC target platform selection for i386-linux, x86_64-linux, aarch64-linux, riscv64-linux, and ppc64le-linux
  • add a cbmc32 Nix shell with the matching target compilers
  • use the selected target compiler as the preprocessor/header provider for goto-cc and goto-instrument
  • add a target ABI canary proof for pointer, size_t, long, and uint64_t widths
  • run that target ABI canary in CBMC CI for every supported explicit target through the cbmc32 shell
  • tune the 32-bit ML-KEM proof blockers found during full-suite runs

Verification

  • nix develop .#ci -c lint
  • git diff --check
  • python3 -B -m py_compile scripts/tests proofs/cbmc/run-cbmc-proofs.py
  • ./scripts/tests cbmc --help | rg -- '--cbmc-target|i386-linux|x86_64-linux|aarch64-linux|riscv64-linux|ppc64le-linux|native|ilp32'
  • cbmc_target_model passed locally for i386-linux, x86_64-linux, aarch64-linux, riscv64-linux, and ppc64le-linux under .#cbmc32
  • nix eval --raw .#devShells.aarch64-linux.cbmc32.drvPath
  • earlier full ML-KEM CBMC evidence for the i386 Linux target: K=2, K=3, and K=4 each completed with 192 successes

This work was completed by Trail of Bits as part of the Patch The Planet project in collaboration with OpenAI. The issue was identified primarily by the Codex coding agent, and manually reviewed before submission.

tob-joe and others added 2 commits June 25, 2026 21:39
Add explicit CBMC target platform selection for the proof infrastructure,
including i386 Linux support with an i686 preprocessor and matching
CBMC target-model flags.

Add target compiler shims for goto-instrument, a target ABI canary proof, and
the solver/proof configuration tweaks needed by the 32-bit ML-KEM suite. Do
not expose riscv32 as a CBMC target because this CBMC toolchain does not
support that architecture model.

Verification: git diff --check; python3 -B -m py_compile scripts/tests proofs/cbmc/run-cbmc-proofs.py; ./scripts/tests cbmc --help target list; canary dry-runs for i386-linux, x86_64-linux, aarch64-linux, riscv64-linux, and ppc64le-linux; nix eval --raw .#devShells.aarch64-linux.cbmc32.drvPath.

Signed-off-by: Joe Doyle <joseph.doyle@trailofbits.com>
Co-authored-by: Codex <codex@openai.com>
Add CBMC workflow inputs for selecting a target platform, proof subset, single-step execution, timeout, report mode, and Nix shell. Use those inputs to run the cbmc_target_model canary across every supported explicit CBMC target in the cbmc32 shell, while leaving the existing full-suite CBMC jobs unchanged.

Also format flake.nix with nixpkgs-fmt and add the SPDX/copyright headers required by lint to the target compiler shims.

Verification:
- nix develop .#ci -c lint
- python3 -B -m py_compile scripts/tests proofs/cbmc/run-cbmc-proofs.py
- ./scripts/tests cbmc --help
- cbmc_target_model passed locally for i386-linux, x86_64-linux, aarch64-linux, riscv64-linux, and ppc64le-linux under .#cbmc32

Signed-off-by: Joe Doyle <joseph.doyle@trailofbits.com>
Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant