From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE614C43334 for ; Sun, 19 Jun 2022 16:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235072AbiFSQoZ convert rfc822-to-8bit (ORCPT ); Sun, 19 Jun 2022 12:44:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbiFSQoX (ORCPT ); Sun, 19 Jun 2022 12:44:23 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AE91D113; Sun, 19 Jun 2022 09:44:21 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id E38071C0B8F; Sun, 19 Jun 2022 18:44:19 +0200 (CEST) Date: Sun, 19 Jun 2022 18:44:16 +0200 From: Pavel Machek To: "Jason A. Donenfeld" Cc: "Alex Xu (Hello71)" , Jann Horn , Dominik Brodowski , Guenter Roeck , Linus Torvalds , Theodore Ts'o , Linux Crypto Mailing List , LKML Subject: Re: [PATCH] random: allow writes to /dev/urandom to influence fast init Message-ID: <20220619164416.GA3362@bug> References: <20220322191436.110963-1-Jason@zx2c4.com> <1648009787.fah6dos6ya.none@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! > > Very much so, thanks again. What I take away from your results is: > > > > - RNDADDTOENTCNT is in active use in a safe way. Sure, RNDADDENTROPY > > is still much better, but RNDADDTOENTCNT isn't entirely broken in the > > above configurations either. > > - This patch would make RNDADDTOENTCNT unsafe for some of the above > > configurations in a way that it currently isn't unsafe. > > - Plenty of things are seeding the RNG correctly, and buildroot's > > shell script is just "doing it wrong". > > > > On that last point, I should reiterate that buildroot's shell script > > still isn't actually initializing the RNG, despite what it says in its > > echo; there's never been a way to initialize the RNG from a shell > > script, without calling out to various special purpose ioctl-aware > > binaries. > > Based on this, the fact that shell scripts cannot seed the RNG anyway, > and due to the hazards in trying to retrofit some heuristics onto an > interface that was never designed to work like this, I'm convinced at > this point that the right course of action here is to leave this > alone. There's no combination of /dev/urandom write hacks/heuristics > that do the right thing without creating some big problem elsewhere. > It just does not have the right semantics for it, and changing the > existing semantics will break existing users. > > In light of that conclusion, I'm going to work with every userspace > downstream I can find to help them fix their file-based seeding, if it > has bugs. I've started talking with the buildroot folks, and then I'll > speak with the OpenRC people (being a Gentoo dev, that should be easy > going). Systemd does the right thing already. > > I wrote a little utility for potential inclusion in > busybox/util-linux/whatever when it matures beyond its current age of > being half hour old: > - https://git.zx2c4.com/seedrng/about/ > - https://git.zx2c4.com/seedrng/tree/seedrng.c > So I'll see what the buildroot people think of this and take it from there. You could put it into the kernel into tools/ directory... Best regards, Pavel