Repository navigation
Conversation
Hosted x86 runners without SHA-NI hash with sha256.c's portable transform.
The daemon fingerprints each copied-image peer (the ~785 MB sanitized test
runner) before answering, and with ASan + UBSan instrumentation that took
~72-92 s per fingerprint on such runners, past the probes' 60 s exchange
budget: daemon_runtime's identical-copy HELLO and foreign activation tests
went red (exit 26 / 29) and the cli suite hit its 3600 s ceiling, depending
only on which CPU the job drew.
- sha256_transform (the portable block transform only) is compiled with
no_sanitize("address", "undefined"). Measured per full hash, same input:
GCC 13 x86-64 15.6 s -> 3.0 s, GCC 13 arm64 5.33 s -> 2.18 s, Apple clang
arm64 2.2x; release builds and the hardware backends are unchanged, and
cbm_sha256_update/final plus the block loop stay instrumented.
- The copied-image probes now exit 30 (HELLO) / 31 (activation) when the
daemon never answered inside the budget, so 26 / 29 mean only an answered
refusal. A slow fingerprint now fails as itself and can no longer satisfy
the changed-copy rejection assertion by timing out.
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
4 tasks done
…macro CI's clang-format 20 lays out an attribute on its own line between preprocessor guards differently from Homebrew's newer release, so the lint job failed on sha256.c:85 while the local format check passed. SHA256_NO_SANITIZE keeps the attribute on the signature line, as NO_BUILTIN_MEM does in mem_override_libc.c. No behaviour change: the macro expands to the same attribute (and to nothing on other compilers). Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
4 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the copied-image daemon tests independent of which CPU a hosted runner
draws. This is a test/CI-behaviour change. Release binaries are
unaffected, and the daemon's admission logic is not touched.
src/foundation/sha256.c: the portable block transform(
sha256_transform, and only that function) is compiled withoutASan/UBSan instrumentation via
no_sanitize("address", "undefined").It carries a
WHYcomment with the measured cost.cbm_sha256_update/cbm_sha256_final, the portable block loop that calls the transform, andthe x86 SHA-NI / ARMv8 SHA2 backends all stay instrumented. An
unsanitized (release) build compiles to the same code.
tests/test_main.c: when the daemon never answered within theexchange budget, the copied-image HELLO probe now exits 30 and the
activation probe exits 31. Exit 26 / 29 therefore mean only
that the daemon answered with a refusal. The daemon_runtime assertions
keep their expected values (0 for the accept cases, 26 for the rejection
cases), and a comment at each rejection assertion now records that a
timeout can no longer satisfy it.
Why
src/foundation/sha256.chashes on x86 SHA-NI or ARMv8 SHA2 when the CPUhas them, and on its portable transform otherwise. Some hosted x86 runners
have no SHA-NI (CPUID leaf 7, EBX bit 29).
the daemon fingerprints the peer's executable before it answers. On a
runner without SHA-NI, one such fingerprint took about 72-92 s on the
instrumented portable transform, against under 2 s on SHA-NI runners.
TF_RUNTIME_IMAGE_EXCHANGE_TIMEOUT_MS) is60 s. On those runners the identical-copy HELLO test therefore exited 26
and the foreign activation test exited 29. The
clisuite (66 full-imagefingerprints) ran into its 3600 s suite ceiling. The runner image version
did not decide the outcome; the CPU the job drew did.
wrong reason: "no answer yet" and "answered: rejected" both exited 26.
With this change a slow fingerprint fails loudly as itself.
Measured cost of the instrumentation (one full hash, same input, digests identical)
The input was the 786 MB sanitized Linux test runner, or the 456 MB macOS
runner on the clang row. Applying the x86-64 ratio to the hosted
observation puts a no-SHA-NI fingerprint at roughly 14-18 s, inside the
60 s budget.
Verification
RED/GREEN under the failing condition, reproduced locally. Setup: Linux
arm64, GCC 13.3, the repository's test image, and the 786 MB sanitized test
runner. That hardware has SHA2, so a proof-only patch (never committed)
recreates a no-SHA-NI runner: it forces the portable backend and scales the
exchange budget from 60 s to 4 s. One local portable fingerprint costs 5.3 s
against 4 s, the same ratio as hosted 72-92 s against 60 s. Line numbers are
origin/main's.
identical_exit == 26(:5088),foreign_exit == 29(:2400)identical_exit == 30,foreign_exit == 31clisuiteIn the passing portable run, the daemon's fingerprint verdicts match the
hardware run exactly. In particular, the changed copy receives an answered
rejection rather than a timeout.
Final tree (no proof patch), natural backend:
cli410 passed, 1 skipped (the Windows-only case);cli_sha256_hardware_matches_portable_issue2441passes.cli_sha256_hardware_matches_portable_issue2441passes (it alsoasserts that the backend is
arm-sha2);cli: 408 passed, 1 skipped (Windows-only). The one failure,cli_vscode_only_installs_copilot_durable_context, is specific to themachine it ran on: that machine has the Copilot CLI installed under
/opt/homebrew/bin, which the CLI's agent detection always probes, soa test that assumes no Copilot CLI fails there. It fails the same way
when run alone, does not involve any code this PR touches, and passes
on the Linux leg.
sha256.ccompiles warning-free with-Wall -Wextra -Werroras arelease, TSan and ASan+UBSan build (GCC 13.3 and Apple clang 21).
sha256.cand on the changedtest lines; cppcheck 2.20.0 (the CI lint image) is clean on
sha256.c;lint-memory-corepasses (no file grew).Notes
fingerprint logic are untouched. Only the sanitizer instrumentation of one
pure arithmetic function changes, and only in sanitized builds.
covered by
cli_sha256_hardware_matches_portable_issue2441(every length0-299 plus 4 KiB to 1 MiB+13, eight chunkings each) and the NIST vectors.