Issue #4709 RFC: reseed task_rng#4885
Closed
cpeterso wants to merge 2 commits intorust-lang:incomingfrom
cpeterso:issue-4709-reseed-task-rng
Closed
Issue #4709 RFC: reseed task_rng#4885cpeterso wants to merge 2 commits intorust-lang:incomingfrom cpeterso:issue-4709-reseed-task-rng
cpeterso wants to merge 2 commits intorust-lang:incomingfrom
cpeterso:issue-4709-reseed-task-rng
Conversation
Contributor
|
The second commit reseeds the scheduler's random number generator, which is probably desirable, but is not the same as the TLS generator mentioned in #4709. That rng is created by |
Contributor
Author
|
doh! |
RalfJung
added a commit
to RalfJung/rust
that referenced
this pull request
Mar 14, 2026
explain how to control target features with Miri
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.
@graydon for issue #4709.
The first change (commit 294b4a9) is straightforward. It adds a new
isaac_reseed()function and uninlinesisaac_seed()andisaac_init().The second change (commit 2ef8a32) is more questionable. It adds a
rust_sched_loop::idle()function, which is called whenrust_sched_driver::start_main_loop()has no runnable tasks.idle()checks whetherrctxhas drained its entropy pool, i.e. generated more than 256 randomuint32_ts. If not reseeded,rctxwill be stirring the same entropy bits to generate new random numbers.Possible improvements:
idle(). For example, Schneier and Ferguson's Fortuna PRNG doesn't reseed more often 10 times per second.RANDSIZ)?This change also adds a fast path to
rust_sched_loop::schedule_task()when there is only 1 runnable task to avoid depletingtask_rng's precious entropy.