[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9r4HLCatEi2s5WGsq1GiBPYs=3-SHE4Tw=+9_5u0q25DQ@mail.gmail.com>
Date: Thu, 24 Mar 2022 08:12:53 -0600
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: David Laight <David.Laight@...lab.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Guenter Roeck <linux@...ck-us.net>,
Dominik Brodowski <linux@...inikbrodowski.net>,
"Theodore Ts'o" <tytso@....edu>, Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH] random: allow writes to /dev/urandom to influence fast init
Hi Rasmus,
On Wed, Mar 23, 2022 at 2:43 AM Rasmus Villemoes
<linux@...musvillemoes.dk> wrote:
>
> On 23/03/2022 03.50, Jason A. Donenfeld wrote:
>
> > - Since these seeding shell scripts have always been broken, because
> > this is how the rng has always been, rather than trying to bolt on a
> > very imperfect fix in the kernel for something that never worked
> > right, we could suggest shell scripts take the path that I implemented
> > for systemd:
> > https://github.com/systemd/systemd/commit/da2862ef06f22fc8d31dafced6d2d6dc14f2ee0b
> > In shell, this would look like:
> >
> > #!/bin/bash
> > cat seedfile > /dev/urandom
> > { cat seedfile; head -c 32 /dev/urandom; } | sha256sum | cut -d ' ' -f 1 > seedfile
>
> Maybe stating the obvious, but in the interest of preventing
> proliferation of more broken shell scripts: The tail of the above should
> be spelled
>
> ... > seedfile.tmp && mv seedfile.tmp seedfile
>
> or seedfile would be truncated before cat had a chance to read it.
You're not wrong. The actual thing that got committed is:
https://git.buildroot.net/buildroot/commit/?id=f0986de551f46e72268857fd817986e9be697cd0
which thankfully doesn't have this issue.
Jason
Powered by blists - more mailing lists