Skip to content

eal: choose initial PRNG seed source at runtime

Dan Gora dpdk-dev 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 10 repliesIn review
  2. v32 patches 0 repliesSuperseded
  3. v2 posting 2/22 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 posting 1/21 patch3 repliesSuperseded
v11 patch5 repliesSuperseded

Changes in v4 from the cover letter

* Replace dlopen/dlsym method with reading from /dev/urandom.
* Try rdseed method before getentropy() method since the latter should never fail.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2eal: check for rdseed at run time for random seedconfig/x86/meson.build lib/librte_eal/common/rte_random.c mk/rte.cpuflags.mk+26 -130 replies
2/2eal: emulate glibc getentropy for initial random seedlib/librte_eal/common/rte_random.c lib/librte_eal/meson.build+54 -115 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [dpdk-dev] [PATCH v4 0/2] eal: choose initial PRNG seed source at runtime

Hi All,

The following patches updates the rte_random subsystem to dynamically find the best source of the initial seed to the PRNG at run time.

The first patch enables dynamic checking for the rdseed instruction and removes the requirement for it on the execution system. It also ensures that the code to use the rdseed instruction is generated, even if the host compilation system does not support it (on x86 systems).

The second patch emulates the getentropy() glibc function by reading bytes from /dev/urandom. This removes an unnecessary dependency on glibc 2.25.

v4: Note that emulating getentropy by reading from /dev/urandom should never fail, so now the question is if we should just remove the rdseed method entirely since it's x86 only? Should we remove the fallback to rte_get_tsc_cycles()?

Thanks
Dan

-----
v2:
* Fix patch apply issue.
* dlclose() handle if dlsym() fails in __rte_getentropy().

v3:
* Fix error checking of dlsym() in __rte_getentropy().
* Style changes recommended by Mattias.

v4:
* Replace dlopen/dlsym method with reading from /dev/urandom.
* Try rdseed method before getentropy() method since the latter should never fail.

Dan Gora (2):
eal: check for rdseed at run time for random seed
eal: emulate glibc getentropy for initial random seed

 config/x86/meson.build             | 11 +++--
 lib/librte_eal/common/rte_random.c | 79 ++++++++++++++++++++++++------
 lib/librte_eal/meson.build         |  3 --
 mk/rte.cpuflags.mk                 |  9 +++-
 4 files changed, 79 insertions(+), 23 deletions(-)
Signature · 1 line
2.24.1.425.g7034cd094b