Skip to content

UPSTREAM: <carry>: Rate-limit concurrent DRBG inits at request entry …#2711

Draft
sdodson wants to merge 1 commit into
openshift:release-4.20from
sdodson:fips/bench/drbg-prewarm
Draft

UPSTREAM: <carry>: Rate-limit concurrent DRBG inits at request entry …#2711
sdodson wants to merge 1 commit into
openshift:release-4.20from
sdodson:fips/bench/drbg-prewarm

Conversation

@sdodson

@sdodson sdodson commented Jul 1, 2026

Copy link
Copy Markdown
Member
In FIPS/CGo mode, the first crypto/rand call on a new OS thread triggers
per-thread DRBG initialization via OpenSSL. Go creates a new OS thread for
each concurrent CGo call, so a kubelet watch reconnect storm after apiserver
restart can simultaneously trigger thousands of DRBG inits, exhausting the
10k OS thread limit.

Add a 64-slot semaphore at APIServerHandler.ServeHTTP that gates each request's
initial crypto/rand read. This caps concurrent DRBG inits to 64, staggering
thread creation over time rather than allowing an instantaneous burst.

Note: a nil or zero-length read does not trigger DRBG init in OpenSSL; at
least one byte must be read to force initialization.

This approach covers all crypto/rand callers in the request path rather than
individual call sites, and is complementary to the WithAuditInit fix (042a4ae).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

…point

In FIPS/CGo mode, the first crypto/rand call on a new OS thread triggers
per-thread DRBG initialization via OpenSSL. Go creates a new OS thread for
each concurrent CGo call, so a kubelet watch reconnect storm after apiserver
restart can simultaneously trigger thousands of DRBG inits, exhausting the
10k OS thread limit.

Add a 64-slot semaphore at APIServerHandler.ServeHTTP that gates each request's
initial crypto/rand read. This caps concurrent DRBG inits to 64, staggering
thread creation over time rather than allowing an instantaneous burst.

Note: a nil or zero-length read does not trigger DRBG init in OpenSSL; at
least one byte must be read to force initialization.

This approach covers all crypto/rand callers in the request path rather than
individual call sites, and is complementary to the WithAuditInit fix (042a4ae).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added the backports/unvalidated-commits Indicates that not all commits come to merged upstream PRs. label Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a1814f4e-b2b9-425e-b489-585f595af93a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci-robot

Copy link
Copy Markdown

@sdodson: the contents of this pull request could not be automatically validated.

The following commits could not be validated and must be approved by a top-level approver:

Comment /validate-backports to re-evaluate validity of the upstream PRs, for example when they are merged upstream.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2026
@openshift-ci

openshift-ci Bot commented Jul 1, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added the vendor-update Touching vendor dir or related files label Jul 1, 2026
@openshift-ci

openshift-ci Bot commented Jul 1, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sdodson
Once this PR has been reviewed and has the lgtm label, please assign p0lyn0mial for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backports/unvalidated-commits Indicates that not all commits come to merged upstream PRs. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. vendor-update Touching vendor dir or related files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants