Skip to content

Recover from CPU Jitter failures in non-FIPS builds - #3631

Open
justsmth wants to merge 1 commit into
aws:mainfrom
justsmth:jitter-adaptive-osr
Open

justsmth wants to merge 1 commit into
aws:mainfrom
justsmth:jitter-adaptive-osr

Conversation

@justsmth

@justsmth justsmth commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Related issues

Addresses #3604.

Context and motivation

CPU Jitter failures can abort applications on platforms with coarse timers.

Description of changes

Non-FIPS builds select an explicit policy that retries Jitter at higher oversampling rates, then permanently falls back to OS entropy. Source policy stays in entropy_sources.c; FIPS retains its existing retry and abort behavior.

Testing

Failure-injection tests, macOS/Linux/Windows builds, and GCC 4.8 syntax checks; 200 non-FIPS process starts without aborts using a simulated 2 MHz clock.

Review considerations

Fallback loses Jitter as an independent source, leaving only OS entropy without hardware RNG support; FIPS_is_entropy_cpu_jitter() returns zero afterward.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

@justsmth
justsmth requested a review from a team as a code owner October 7, 2026 19:40
@justsmth
justsmth requested a review from torben-hansen October 7, 2026 19:40
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🔒 Security Review — View Report

Please review before merging.

@codecov-commenter

codecov-commenter commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.16858% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.58%. Comparing base (694c44b) to head (fc9d1a0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...pto/fipsmodule/rand/entropy/entropy_source_test.cc 73.91% 3 Missing and 3 partials ⚠️
crypto/fipsmodule/rand/entropy/entropy_sources.c 95.34% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3631      +/-   ##
==========================================
+ Coverage   78.46%   78.58%   +0.12%     
==========================================
  Files         705      705              
  Lines      130585   130919     +334     
  Branches    17906    17934      +28     
==========================================
+ Hits       102460   102883     +423     
+ Misses      27149    27052      -97     
- Partials      976      984       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth
justsmth force-pushed the jitter-adaptive-osr branch from f50548b to f6e491a Compare October 8, 2026 17:13
CPU Jitter failures on coarse-timer platforms can terminate applications (aws#3604). Give non-FIPS builds an explicit Jitter-with-OS-fallback configuration: retry at higher oversampling rates, then permanently use OS entropy if recovery fails.

Centralize source selection and recovery policy in entropy_sources.c. The tree consumes its configured root provider and aborts if that provider cannot supply a seed, without choosing alternative sources or embedding FIPS-specific behavior. Preserve default-rate Jitter retries in FIPS, omit FIPS failure-injection hooks, and retain VM UBE and build-time opt-out precedence.

FIPS_is_entropy_cpu_jitter reports the active root, returning zero after fallback. Fallback loses Jitter as an independent source; without hardware RNG support, randomness relies on OS entropy alone. Cover startup and reseed failures, partial-output replacement, cross-thread persistence, and silent recovery.

Testing: macOS non-FIPS, shared-FIPS, and Jitter-disabled builds; Linux x86-64 non-FIPS and static FIPS; Windows MSVC non-FIPS; GCC 4.8 normal/FIPS syntax checks. With a quantized 2 MHz clock, 200 FIPS process starts never fell back to OS entropy and 200 non-FIPS starts never aborted.
@justsmth
justsmth force-pushed the jitter-adaptive-osr branch from f6e491a to fc9d1a0 Compare October 8, 2026 19:17

This branch has not been deployed

No deployments
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.

2 participants