From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v2 0/5] random: fix initial seed entropy
Date: Fri, 9 Oct 2026 19:27:02 -0700 [thread overview]
Message-ID: <20261010022851.1872825-1-stephen@networkplumber.org> (raw)
In-Reply-To: <20260915192207.3926217-1-stephen@networkplumber.org>
This series is about how the random number generator is seeded: where
the seed comes from, how it is expanded into the generator state, and
being able to pin it for repeatable test runs.
The build detection of getentropy() does not work, so DPDK has been
seeding its PRNG from RDSEED or the TSC on systems that do have
getentropy(). cc.has_function() probes with -std=c11, but glibc hides
getentropy() behind _DEFAULT_SOURCE, so the probe always fails.
A TSC derived seed only varies by process start time, which a local
attacker can determine.
1/5 adds a Windows getentropy() shim over BCryptGenRandom(), so the
EAL can call getentropy() unconditionally.
2/5 drops the broken probe and always uses getentropy(). The TSC
fallback remains but now logs at ERR with the errno, so a
blocked syscall can be told apart from other failures.
3/5 expands the seed with SplitMix64. The two halves of the seed
were folded together and run through a 32 bit LCG, so only 32
bits of the seed had any effect and the five state words had
correlated low bits. Per-lcore seeds were the seed plus the
lcore id, leaving neighbouring lcores with nearly identical
state; that sum now goes through SplitMix64 as well. A given
seed therefore produces a different sequence than in previous
releases.
4/5 removes the RDSEED fallback. It is unreachable once getentropy()
is always used, and RDSEED has known reliability problems and
errata. The kernel already mixes RDSEED into the pool that
getentropy() draws from.
5/5 adds a DPDK_TEST_SEED environment variable to the test
application, so runs that build input data with rte_rand() can
be made repeatable. Unset behaves as before.
Bugzilla ID: 2035
v2: - rebased
- reduced patch series to only seedinr related changes
Two checks warn deliberately:
1/5 carries Cc: stable@dpdk.org without a Fixes: tag. 2/5 is the
stable candidate and does not build on Windows without the shim, so
1/5 has to go back with it. The commit message says so.
3/5 has a Fixes: tag and no Cc: stable. It changes the sequence a
given seed produces, so a backport would change output for anyone
relying on rte_srand() reproducibility on a stable branch.
Stephen Hemminger (5):
eal/windows: add getentropy shim
random: always use getentropy
random: use all 64 bits of the seed
random: remove RDSEED fallback for initial seed
test: allow setting random seed for tests
app/test/test.c | 48 +++++++++++++
doc/guides/contributing/unit_test.rst | 15 ++++
doc/guides/rel_notes/release_26_11.rst | 10 +++
lib/eal/common/rte_random.c | 98 +++++++++++---------------
lib/eal/include/rte_random.h | 7 +-
lib/eal/meson.build | 3 -
lib/eal/windows/include/rte_os_shim.h | 30 ++++++++
lib/eal/windows/meson.build | 6 +-
8 files changed, 155 insertions(+), 62 deletions(-)
--
2.53.0
next prev parent reply other threads:[~2026-10-10 2:28 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 19:20 [PATCH 00/18] random number generator improvements Stephen Hemminger
2026-09-15 19:20 ` [PATCH 01/18] eal/windows: add getentropy shim Stephen Hemminger
2026-09-15 19:21 ` [PATCH 02/18] random: always use getentropy Stephen Hemminger
2026-09-15 19:21 ` [PATCH 03/18] eal: add 32 bit random number function Stephen Hemminger
2026-09-15 19:21 ` [PATCH 04/18] sched: fix data race in RED random number generation Stephen Hemminger
2026-09-15 19:21 ` [PATCH 05/18] eal/windows: add getrandom shim Stephen Hemminger
2026-09-15 19:21 ` [PATCH 06/18] eal: add function to get random bytes Stephen Hemminger
2026-09-15 19:21 ` [PATCH 07/18] hash: use secure random for Toeplitz hash key Stephen Hemminger
2026-09-15 19:21 ` [PATCH 08/18] pipeline: use secure random for IPsec salt Stephen Hemminger
2026-09-15 19:21 ` [PATCH 09/18] net: use secure random for random MAC address Stephen Hemminger
2026-09-15 19:21 ` [PATCH 10/18] ipsec: use secure random for SAD hash seed Stephen Hemminger
2026-09-15 19:21 ` [PATCH 11/18] net/intel: use secure random for default RSS key Stephen Hemminger
2026-09-15 19:21 ` [PATCH 12/18] random: use all 64 bits of the seed Stephen Hemminger
2026-09-15 19:21 ` [PATCH 13/18] drivers/net: use secure random for RSS key Stephen Hemminger
2026-09-15 19:21 ` [PATCH 14/18] drivers/net: use common random MAC address helper Stephen Hemminger
2026-09-15 19:21 ` [PATCH 15/18] random: remove RDSEED fallback for initial seed Stephen Hemminger
2026-09-16 7:44 ` Bruce Richardson
2026-09-15 19:21 ` [PATCH 16/18] test: allow setting random seed for tests Stephen Hemminger
2026-09-15 19:21 ` [PATCH 17/18] test: add random number generator tests Stephen Hemminger
2026-09-15 19:21 ` [PATCH 18/18] doc: recommend secure random for unpredictable values Stephen Hemminger
2026-09-22 12:32 ` Aaron Conole
2026-10-10 2:27 ` Stephen Hemminger [this message]
2026-10-10 2:27 ` [PATCH v2 1/5] eal/windows: add getentropy shim Stephen Hemminger
2026-10-10 2:27 ` [PATCH v2 2/5] random: always use getentropy Stephen Hemminger
2026-10-10 2:27 ` [PATCH v2 3/5] random: use all 64 bits of the seed Stephen Hemminger
2026-10-10 2:27 ` [PATCH v2 4/5] random: remove RDSEED fallback for initial seed Stephen Hemminger
2026-10-10 2:27 ` [PATCH v2 5/5] test: allow setting random seed for tests Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261010022851.1872825-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox