DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>
Cc: "David Marchand" <david.marchand@redhat.com>, <dev@dpdk.org>,
	<thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,
	<stable@dpdk.org>, "Marcin Wojtas" <mw@semihalf.com>,
	"Michal Krawczyk" <mk@semihalf.com>,
	"Shai Brandes" <shaibran@amazon.com>,
	"Evgeny Schemeilin" <evgenys@amazon.com>,
	"Igor Chauskin" <igorch@amazon.com>
Subject: RE: [PATCH 04/12] net/ena: fix build with GCC 12
Date: Sun, 22 May 2022 22:30:35 +0200	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35D87095@smartserver.smartshare.dk> (raw)
In-Reply-To: <20220521092357.783b8f7f@hermes.local>

> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Saturday, 21 May 2022 18.24
> 
> On Sat, 21 May 2022 11:49:47 +0200
> Morten Brørup <mb@smartsharesystems.com> wrote:
> 
> > >
> > > Also, worth considering dropping DPDK random number generator
> > > in userspace for security reasons and just using more secure kernel
> > > code.
> >
> > Absolutely not! We need a fast pseudorandom number generator in DPDK.
> >
> > If anything, we could consider renaming the functions and header file
> to reflect that they are pseudorandom number generators, and not
> (cryptographically) random generators. That would cause an API/ABI
> breakage, so it's probably not going to happen. ;-)
> 
> 
> The Linux kernel has received an way more attention on random numbers
> than
> DPDK. If you follow the history, what happens is that a simple dumb LCG
> or similar random number generator gets invented, and then gets used
> for
> lots of things that people don't think need a strong generator.
> 
> Followed by DoS and other attacks where the weak random number
> generator
> is broken when used for doing things like creating sequence numbers of
> TCP port assignment.  This is then followed by even more work on the
> kernel random number generator to make the default random number
> generator
> stronger.
> 
> I bring up this history, so that DPDK won't have to repeat it.
> 
> Right now the DPDK random number generator is insecure because it uses
> long but weak PRNG and never reseeds itself.
> 
> See:
> https://lwn.net/Articles/884875/
> 
> There is also FIPS to consider.
> https://lwn.net/Articles/877607/
> 
> Since random number generators are hard, prefer that someone else do it
> :-)

First of all, I would like to thank you for the history lesson and references, Stephen, it made my Saturday evening much more nerdy and interesting than expected! Not being a native English speaker, please understand that I mean this sincerely. I really enjoyed reading about this corner of the Linux kernel history.

Overall, I think that RNGs generally fall into two categories: Unsafe (regardless how advanced) and safe for crypto use.

It should be OK for DPDK to provide something blazing fast, but unsafe. The DPDK documentation clearly states that the provided random functions are not safe for crypto, so I would expect the developers to use them accordingly.

Having thought about it, I came to this conclusion: Regardless if we provide unsafe RNG functions in DPDK or not, it is ultimately up to the application developers to choose which RNG category to use for different purposes. If we don't provide something fast, developers will just use the standard rand48() functions or similar. And a blazing fast (but unsafe) RNG is useful for simple things like pseudo-random packet sampling in the data plane.

Who would have thought that using a simple RNG for TCP port assignment could end up being a security problem... The developers will always have a choice between secure and fast, and the risk of a developer making the wrong decision is not affected by DPDK providing some unsafe RNG or not.

At a higher level, I come to think of the RFCs, which all have a Security Considerations chapter. Ideally, all patches had such a chapter, and all reviews considered the security aspects, so someone would catch the use of an unsafe RNG where a safe RNG should be used. Removing the rand() functions from DPDK will not have the desired effect, only raising security awareness will.

And just to leave off where you left off: I 100 % agree that we should not try to invent our own crypto safe RNG!

PS: I assume that safe RNGs cannot generate numbers at the same rate as unsafe RNGs. If this was not generally true, there should be no need to use unsafe RNGs (except for test purposes, where reproducibility is a requirement).

In cases where the safe RNG can generate numbers at a sufficiently high rate, why not use it? This, however, requires that the application developer knows both the required rate and the rate of the safe RNG, which I guess very few developers do.


  reply	other threads:[~2022-05-22 20:30 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 10:16 [PATCH 00/12] Fix compilation with gcc 12 David Marchand
2022-05-18 10:16 ` [PATCH 01/12] common/cpt: fix build with GCC 12 David Marchand
2022-05-20 20:23   ` Stephen Hemminger
2022-06-10 13:11   ` David Marchand
2022-06-13 11:40     ` [EXT] " Ankur Dwivedi
2022-06-16  9:30       ` David Marchand
2022-06-16 11:59         ` Ankur Dwivedi
2022-05-18 10:16 ` [PATCH 02/12] crypto/cnxk: " David Marchand
2022-05-20 20:24   ` Stephen Hemminger
2022-05-18 10:16 ` [PATCH 03/12] crypto/ipsec_mb: " David Marchand
2022-06-02  9:50   ` Bruce Richardson
2022-06-10 13:07     ` David Marchand
2022-06-11 15:34   ` Stephen Hemminger
2022-05-18 10:16 ` [PATCH 04/12] net/ena: " David Marchand
2022-05-20 20:28   ` Stephen Hemminger
2022-05-21  9:49     ` Morten Brørup
2022-05-21 16:23       ` Stephen Hemminger
2022-05-22 20:30         ` Morten Brørup [this message]
2022-06-11 15:34   ` Stephen Hemminger
2022-05-18 10:16 ` [PATCH 05/12] net/enetfec: " David Marchand
2022-06-10 13:08   ` David Marchand
2022-06-13  5:22     ` Sachin Saxena (OSS)
2022-06-14  8:16     ` Sachin Saxena (OSS)
2022-06-11 15:35   ` Stephen Hemminger
2022-05-18 10:16 ` [PATCH 06/12] net/ice: " David Marchand
2022-06-11 15:36   ` Stephen Hemminger
2022-05-18 10:16 ` [PATCH 07/12] net/ice/base: " David Marchand
2022-05-18 10:16 ` [PATCH 08/12] net/qede/base: " David Marchand
2022-05-20 20:29   ` Stephen Hemminger
2022-06-21 23:17   ` Stephen Hemminger
2022-06-22 15:42     ` David Marchand
2022-05-18 10:16 ` [PATCH 09/12] vdpa/ifc: " David Marchand
2022-05-18 11:48   ` Wang, Xiao W
2022-06-11 15:36   ` Stephen Hemminger
2022-05-18 10:16 ` [PATCH 10/12] vhost/crypto: " David Marchand
2022-06-02 10:08   ` Bruce Richardson
2022-06-14  9:22     ` David Marchand
2022-06-14  9:25       ` Bruce Richardson
2022-06-16  9:27         ` David Marchand
2022-06-11 15:36   ` Stephen Hemminger
2022-06-16  9:32   ` [PATCH v2] " David Marchand
2022-06-16 14:53     ` David Marchand
2022-05-18 10:16 ` [PATCH 11/12] app/flow-perf: " David Marchand
2022-06-02 10:21   ` Bruce Richardson
2022-06-08  9:03   ` Wisam Monther
2022-06-08 12:20     ` David Marchand
2022-06-13  7:49       ` Wisam Monther
2022-06-11 15:37   ` Stephen Hemminger
2022-05-18 10:16 ` [PATCH 12/12] test/ipsec: " David Marchand
2022-06-02 18:41   ` Medvedkin, Vladimir
2022-06-03  7:45     ` David Marchand
2022-06-03  7:56       ` Bruce Richardson
2022-06-03  9:41         ` David Marchand
2022-06-03 15:57           ` Medvedkin, Vladimir
2022-06-11 15:38   ` Stephen Hemminger
2022-06-16  9:33   ` [PATCH v2] " David Marchand
2022-06-17 12:06     ` David Marchand
2022-06-20  9:07       ` [EXT] " Akhil Goyal
2022-06-20 15:06       ` Medvedkin, Vladimir
2022-06-16 14:46   ` [PATCH v3] vhost/crypto: " David Marchand
2022-06-17 13:59     ` Maxime Coquelin
2022-06-21  9:31     ` Maxime Coquelin
2022-06-22  9:01       ` Poczatek, Jakub
2022-06-22  9:26         ` Zhang, Roy Fan
2022-06-22 14:07         ` David Marchand
2022-06-22 15:21           ` Poczatek, Jakub
2022-06-22 15:31             ` David Marchand
2022-05-20 20:13 ` [PATCH 00/12] Fix compilation with gcc 12 Stephen Hemminger
2022-05-21  9:39   ` Morten Brørup
2022-06-15  8:49 ` David Marchand
2022-06-15 14:45   ` Stephen Hemminger
2022-06-15 14:59     ` Thomas Monjalon
2022-06-15 15:15       ` 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=98CBD80474FA8B44BF855DF32C47DC35D87095@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=evgenys@amazon.com \
    --cc=ferruh.yigit@xilinx.com \
    --cc=igorch@amazon.com \
    --cc=mk@semihalf.com \
    --cc=mw@semihalf.com \
    --cc=shaibran@amazon.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).