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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B67BAC49ED7 for ; Mon, 16 Sep 2019 19:16:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8CC78206C2 for ; Mon, 16 Sep 2019 19:16:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390793AbfIPTQf (ORCPT ); Mon, 16 Sep 2019 15:16:35 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:46291 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbfIPTQf (ORCPT ); Mon, 16 Sep 2019 15:16:35 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id x8GJGFgj025977; Mon, 16 Sep 2019 21:16:15 +0200 Date: Mon, 16 Sep 2019 21:16:15 +0200 From: Willy Tarreau To: Lennart Poettering Cc: Linus Torvalds , "Theodore Y. Ts'o" , "Alexander E. Patrakov" , "Ahmed S. Darwish" , Michael Kerrisk , Andreas Dilger , Jan Kara , Ray Strode , William Jon McCann , zhangjs , linux-ext4@vger.kernel.org, lkml Subject: Re: [PATCH RFC v2] random: optionally block in getrandom(2) when the CRNG is uninitialized Message-ID: <20190916191615.GE24547@1wt.eu> References: <20190911173624.GI2740@mit.edu> <20190912034421.GA2085@darwi-home-pc> <20190912082530.GA27365@mit.edu> <20190914122500.GA1425@darwi-home-pc> <008f17bc-102b-e762-a17c-e2766d48f515@gmail.com> <20190915052242.GG19710@mit.edu> <20190916180801.GB30990@gardel-login> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190916180801.GB30990@gardel-login> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 16, 2019 at 08:08:01PM +0200, Lennart Poettering wrote: > I mean, as I understand you are unhappy with behaviour you saw on > systemd systems; we can certainly improve behaviour of systemd in > userspace alone, i.e. abort the getrandom() after a while in userspace > and log about it using typical userspace logging to the console. I am > not sure why you want to do all that in the kernel, the kernel isn't > great at user interaction, and really shouldn't be. Because the syscall will have the option to return what random data was available in this case, while if you try to fix it only from within systemd you currently don't even get that data. > It appears to me you subscribe too much to an idea that userspace > people are not smart enough and couldn't implement something like > this. Turns out we can though, and there's no need to add logic that > appears to follow the logic of "never trust userspace"... I personally see this very differently. If randoms were placed into a kernel compared to other operating systems doing everything in userspace, it's in part because it requires to collect data very widely to gather some entropy and that no isolated userspace alone can collect as much as the kernel. Or they each have to reimplement their own method, each with their own bugs, instead of fixing them all at a single place. All applications need random, there's no reason for having to force them all to implement them in detail. Willy