[PATCH] member: fix PRNG seed reset in NitroSketch mode
Thomas Monjalon
thomas at monjalon.net
Thu Jul 6 18:20:19 CEST 2023
03/07/2023 17:54, Stephen Hemminger:
> On Wed, 21 Jun 2023 00:17:20 +0300
> Dmitry Kozlyuk <dmitry.kozliuk at gmail.com> wrote:
>
> > Seeding the global PRNG at sketch creation
> > does not make the sketch operation deterministic:
> > it uses rte_rand() later, the PRNG may be seeded again by that point.
> > On the other hand, seeding the global PRNG with a hash seed,
> > is likely undesired, because it may be low-entropy or even constant.
> > Deterministic operation can be achieved by seeding the PRNG externally.
> >
> > Remove the call to rte_srand() at sketch creation.
> > Document that hash seeds are not used by SKETCH set summary type.
> >
> > Fixes: db354bd2e1f8 ("member: add NitroSketch mode")
> > Cc: leyi.rong at intel.com
> >
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk at gmail.com>
>
> This raises a more global issue.
> rte_srand() overrides the system seed which is set during startup.
> This is a bad thing, it reduces the entropy in the random number generator.
>
> There are two possible solutions to this:
> 1. Remove all all calls to rte_srand() and deprecate it.
> 2. Make rte_srand() add a fixed value to existing entropy. This is what the
> kernel PRNG does. It adds any user supplied additional entropy to original
> state.
>
> Looking at current source.
> - code in tests seeding PRNG with TSC. This is unnecessary and can be removed.
> - this code in member library. Should be removed.
>
> Acked-by: Stephen Hemminger <stephen at networkplumber.org>
Applied, thanks.
What's next regarding rte_srand?
More information about the dev
mailing list