On Wed, 21 Jun 2023 00:17:20 +0300
Dmitry Kozlyuk <[email protected]> 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: [email protected]
>
> Signed-off-by: Dmitry Kozlyuk <[email protected]>
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 <[email protected]>