[PATCH] Use arc4random() to permutate talloc_magic number
Timur I. Bakeyev
timur at freebsd.org
Fri Feb 16 02:37:42 UTC 2018
On 14 February 2018 at 07:06, Volker Lendecke <Volker.Lendecke at sernet.de>
> On Wed, Feb 14, 2018 at 04:51:02PM +1300, Andrew Bartlett via
> samba-technical wrote:
> > On Wed, 2018-02-14 at 03:59 +0100, Timur I. Bakeyev via samba-technical
> > wrote:
> > So, this small patch adds support for the usage of arc4random() to
> > > random talloc_magic signature per invocation.
> > The problem I have with this being the default is that unlike on *BSD
> > arc4random on in libbsd relies on the recent getentropy() stuff or goes
> > back to /dev/urandom.
> > Now, you don't link against libbsd intentionally, but I can see that
> > happening.
> > I chose the getauxval() because we don't want the library constructor
> > for talloc looking to open files.
> Correct. And if we go there even for talloc, we must abstract
> lib/util/genrand.c in a way that it's usable even for the talloc
> library initialization. genrand.c is really small enough to be the one
> and only place to do the #ifdef-magic for the different flavors of
> urandom these days. It might be some library magic necessary, but I
> *really* don't want this in more than one file.
In general I'm all pro moving that "random without /dev/random" part to the
library code, possibly somewhere in libreplace, as ATM genrand.c is now
part of libutil, which is solely Samba lib.
More information about the samba-technical