DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	dev@dpdk.org, leyi.rong@intel.com,
	Yipeng Wang <yipeng1.wang@intel.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	Alan Liu <zaoxingliu@gmail.com>
Subject: Re: [PATCH] member: fix PRNG seed reset in NitroSketch mode
Date: Thu, 06 Jul 2023 18:20:19 +0200	[thread overview]
Message-ID: <4969062.ejJDZkT8p0@thomas> (raw)
In-Reply-To: <20230703085458.23c383e6@hermes.local>

03/07/2023 17:54, Stephen Hemminger:
> On Wed, 21 Jun 2023 00:17:20 +0300
> Dmitry Kozlyuk <dmitry.kozliuk@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@intel.com
> > 
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@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@networkplumber.org>

Applied, thanks.

What's next regarding rte_srand?



  reply	other threads:[~2023-07-06 16:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 21:17 Dmitry Kozlyuk
2023-07-03 15:00 ` Thomas Monjalon
2023-07-03 15:54 ` Stephen Hemminger
2023-07-06 16:20   ` Thomas Monjalon [this message]
2023-07-06 17:22     ` 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=4969062.ejJDZkT8p0@thomas \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=leyi.rong@intel.com \
    --cc=sameh.gobriel@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=yipeng1.wang@intel.com \
    --cc=zaoxingliu@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).