Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5959623pxb; Mon, 14 Feb 2022 11:43:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvwcae0iFVNRj64PFn8kquy8HdqdZFayKmVVJcUaY/QTJ8djK6MqD95Wg0YDdVCEMWfm4Y X-Received: by 2002:a17:903:244b:: with SMTP id l11mr534761pls.153.1644867827541; Mon, 14 Feb 2022 11:43:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644867827; cv=none; d=google.com; s=arc-20160816; b=xUwfDO7dKUpoFwrib8/0K2d49577mpFoLP1OnDn08rSX2+JZifZ8IsHjLektag+84r KkmOvtnXu80aUreq/Y3LRS+IlYbTMqbOV4PDIaCx5STcE0nL6q4wV8suP9VtnGhVwNIB 3sxCz5atAExPmsUtwIryLE16YRJZpZLpXIWwqtRWZGlgdNbvOodSI/3UaZOjsskjl2fa 5zFZKXPr2bkttGyo62BkhyV2HRS0JB8V1cV6L/Fhr7lbGDZ9WcwAMqvGZYVAym3TH4L+ v5TgJxmp0vy+yNxjQz9yZKhf4SI/OPjyUXS4VJkpJbeLKJhlW5LM+ve+O3xDCxgRwge7 ivmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=sVk9sFcsOryYj7ZcVSYGO/C8tkftqugCexnbNpSEyn0=; b=nagx/L4SQPQcDXgjBU2lV4qLIcyVSwAelwxfy9dEtxbynZW+Uqqqf+Vj0FB+jAvg5w cq1JIIB7WLyNMoFtGp0ZEzJa0QlwqxTll0l0i5/wtwEnGCucdw6HMBpOB8jwExMWcs+M nqpfcUbfLVCxWzPNLpYSchfX4VJVQ6onjY+X18NHsmqV6o8YOUbNRRtiY3bSYuxruHRT f/ok5VQnkG8c3zxWfZSHVs+etMntXQ/XyDjce/c/b8/hMM1qwyMGm9VV5XdHu0GZFlZK DCafEzgJU4HBSsBNFgHBsxhRx6ZcSQEx3TAN+S01HaVQpo4h9NKKFILFdvjwqn+2Etes O0Qw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bd9si12781090plb.486.2022.02.14.11.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:43:47 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B56F91133C8; Mon, 14 Feb 2022 11:28:51 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355383AbiBNOx1 (ORCPT + 99 others); Mon, 14 Feb 2022 09:53:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:55692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242807AbiBNOxY (ORCPT ); Mon, 14 Feb 2022 09:53:24 -0500 X-Greylist: delayed 21564 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 14 Feb 2022 06:53:16 PST Received: from gardel.0pointer.net (gardel.0pointer.net [85.214.157.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C3ED42EE3; Mon, 14 Feb 2022 06:53:16 -0800 (PST) Received: from gardel-login.0pointer.net (gardel-mail [85.214.157.71]) by gardel.0pointer.net (Postfix) with ESMTP id 2D1E0E8045A; Mon, 14 Feb 2022 15:53:14 +0100 (CET) Received: by gardel-login.0pointer.net (Postfix, from userid 1000) id BF6CC16010E; Mon, 14 Feb 2022 15:53:13 +0100 (CET) Date: Mon, 14 Feb 2022 15:53:13 +0100 From: Lennart Poettering To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Thomas Bogendoerfer , linux-mips@vger.kernel.org, Dominik Brodowski , Eric Biggers , Ard Biesheuvel , Arnd Bergmann , Thomas Gleixner , Andy Lutomirski , Kees Cook , Linus Torvalds , Greg Kroah-Hartman , Theodore Ts'o Subject: Re: [PATCH RFC v0] random: block in /dev/urandom Message-ID: References: <20220211210757.612595-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mo, 14.02.22 15:13, Jason A. Donenfeld (Jason@zx2c4.com) wrote: > Hi Lennart, > > On Mon, Feb 14, 2022 at 9:53 AM Lennart Poettering wrote: > > So, systemd uses (potentially half-initialized) /dev/urandom for > > seeding its hash tables. For that its kinda OK if the random values > > have low entropy initially, as we'll automatically reseed when too > > many hash collisions happen, and then use a newer (and thus hopefully > > better) seed, again acquired through /dev/urandom. i.e. if the seeds > > are initially not good enough to thwart hash collision attacks, once > > the hash table are actually attacked we'll replace the seeds with > > someting better. For that all we need is that the random pool > > eventually gets better, that's all. > > > > So for that usecase /dev/urandom behaving the way it so far does is > > kinda nice. > > Oh that's an interesting point. But that sounds to me like the problem > with this patch is not that it makes /dev/urandom block (its primary > purpose) but that it also removes GRND_INSECURE (a distraction). So > perhaps an improved patch would be something like the below, which > changes /dev/urandom for new kernels but doesn't remove GRND_INSECURE. > Then your hash tables could continue to use GRND_INSECURE and all would > be well. (And for kernels without getrandom(), they'd just fall back to > /dev/urandom like normal which would have old semantics, so works.) In fact, systemd already uses getrandom(GRND_INSECURE) for this, if it is supported, and falls back to /dev/urandom only if it is not. So as long as GRND_INSECURE remains available we are good. Lennart -- Lennart Poettering, Berlin