Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3007133ybe; Sun, 15 Sep 2019 05:39:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLDnwvxwgFSc79ZFbL724MMZUYnqdSUfvqsu2kWLrA0YPCn9C9xNepEwqPIU7FiMQ/FpOH X-Received: by 2002:a50:981b:: with SMTP id g27mr56990247edb.105.1568551173843; Sun, 15 Sep 2019 05:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568551173; cv=none; d=google.com; s=arc-20160816; b=BCg3gwlpuCgd/uh4twS7RiLt+I5YgH2wafV57MHwg7X+7qftqHmZ7kAGXR/D24MT4x 2pSpmqLPIRGhnfbd25LBA6lAPEnngmHXifknCBSh4VtQrkhhPmNTeHjdvI2j8MAhgfAw F7BDqCzh0hGPhBbEKwl5xi9ob4l43UBo0MCEbu/HhqdyXWFWJU/R0XkmvngEY6Czsk9u 2g65laHtks+VTyhrEM3d7avG7qrUPWJ0Gk6AI80tyUjE0mCKIcSHg3uUFRIe3lYpTyOw U+CcbaOrlEJTi90vuaAfu6mN9771CIVl9NW7EZAvggp7pkBdrmo1Zx5CFjULjCxeSYQm c20w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=R3LqYYMBT+nWIT12Cdfqk6UPzHE/cc0WsDTckw4FJZs=; b=pO3tWyiyIpSZJc8YVI6RVJoQDY4I47ETOtVaXsEKoVbRULA0NgMScTal9OLk2sjKYN 2/tB+3nVgkaARDo5kJ7aqOr6qbxnCjkRm++l+1jaPiNEbBVUQF5gVufJLhmWCc+vM4Vm udY0jg2RUMI5rhANNWkHZ47mYp1Ns+neuRFttbJPNlPuFIbJIZ+qqkYTpDHgfX1Iwli/ p8YNGd8mV7tn9CRJu2GYE6Tq3eBbJYo4DO+sq8AzHNE74j6PHfaP93kYUAeKZOR7FSmJ gLj9vKWC0JHR/8O6hrRac7MckBZYC9nfD6GauUDSwaMLDPbsM0sSfIE7U/dbxpMOQDGu xL+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Brx6abDN; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a38si19102779edf.260.2019.09.15.05.39.09; Sun, 15 Sep 2019 05:39:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Brx6abDN; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728574AbfIOKzv (ORCPT + 99 others); Sun, 15 Sep 2019 06:55:51 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51913 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728308AbfIOKzv (ORCPT ); Sun, 15 Sep 2019 06:55:51 -0400 Received: by mail-wm1-f66.google.com with SMTP id 7so6993907wme.1; Sun, 15 Sep 2019 03:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=R3LqYYMBT+nWIT12Cdfqk6UPzHE/cc0WsDTckw4FJZs=; b=Brx6abDNQchwDnbthBGpqed/0B0BQnxO3vHj2PRO6R2BjfrK9epv0p1PWsmSZMgK98 tGfPfMFR3PV0H1xO6x/5lWdzkgLfZl7deSOmxgC4JyNfs6P6+bx0705L54Yk9Rd10g7J c/ZvKQ/gx3sYV4RJ1Zsj5Hd3PE6DOdWg/RH94Pl5kyLQc90MB/fm4XlhzWSHtTNE6uRZ 6zLWfKEcUAx69QT+NKcE4fEeUiaR42F5MgF/oaE13g7Uf04/lhIgcD615FwenAvYs9xb T2vPPGZ8Sv7WdLdpZVNVPChii+FAtH/uS4+CtBqTrKVwQtKQXvu2maXFaX8qFJy+RYe1 irhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=R3LqYYMBT+nWIT12Cdfqk6UPzHE/cc0WsDTckw4FJZs=; b=Z9kRHl1pZ0ilEExzRg07HNsKCk3Q9xslWdPvbqChkK8wLMF6mGdEaqpXsQ9Hwf8Jeu V73CYajPk45c3X/xiXjacEDGVs+ZD7adGH2yzGH/vE6KMWA0FClWltkBZo+ZTYzkscF/ GWwlXxIJ7dBJ8EH5AYdzRiki7IxBEEMN8FsvRamsSrtVpoqC3jNVgeKOwOcuvdcUtad8 AkT1a/RNGfwPsCFwCt9E2P4cQMhpeScCCoNk3g89e6VXgnkOtiGSQSOnh6rVLu81+Vmm 6sMzuqAWjvjm+590hfqdQUeKJe10gdH5fggN+mfRJp7bfQVQBCOiQoJolIcMUZrPyadi HeMQ== X-Gm-Message-State: APjAAAVh/Dyfna224jnSoXBeYBSnHEshNdzXLWk2y6cvKDLGMQgy3s5n 9sg+5PS27wh+UWmvtV/Yots= X-Received: by 2002:a1c:2d85:: with SMTP id t127mr10791113wmt.81.1568544947023; Sun, 15 Sep 2019 03:55:47 -0700 (PDT) Received: from darwi-home-pc (p200300D06F2D1401AF0812D8DEE03BEC.dip0.t-ipconnect.de. [2003:d0:6f2d:1401:af08:12d8:dee0:3bec]) by smtp.gmail.com with ESMTPSA id 33sm42989155wra.41.2019.09.15.03.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Sep 2019 03:55:46 -0700 (PDT) Date: Sun, 15 Sep 2019 12:55:39 +0200 From: "Ahmed S. Darwish" To: Willy Tarreau Cc: Lennart Poettering , "Theodore Y. Ts'o" , Linus Torvalds , "Alexander E. Patrakov" , Michael Kerrisk , Andreas Dilger , Jan Kara , Ray Strode , William Jon McCann , zhangjs , linux-ext4@vger.kernel.org, lkml Subject: Re: [PATCH RFC v3] random: getrandom(2): optionally block when CRNG is uninitialized Message-ID: <20190915105539.GA1082@darwi-home-pc> References: <20190912082530.GA27365@mit.edu> <20190914122500.GA1425@darwi-home-pc> <008f17bc-102b-e762-a17c-e2766d48f515@gmail.com> <20190915052242.GG19710@mit.edu> <20190915081747.GA1058@darwi-home-pc> <20190915085907.GC29771@gardel-login> <20190915093057.GF20811@1wt.eu> <20190915100201.GA2663@darwi-home-pc> <20190915104027.GG20811@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190915104027.GG20811@1wt.eu> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sun, Sep 15, 2019 at 12:40:27PM +0200, Willy Tarreau wrote: > On Sun, Sep 15, 2019 at 12:02:01PM +0200, Ahmed S. Darwish wrote: > > On Sun, Sep 15, 2019 at 11:30:57AM +0200, Willy Tarreau wrote: > > > On Sun, Sep 15, 2019 at 10:59:07AM +0200, Lennart Poettering wrote: [...] > > > > If Linux lets all that stuff run with awful entropy then > > > > you pretend things where secure while they actually aren't. It's much > > > > better to fail loudly in that case, I am sure. > > > > > > This is precisely what this change permits : fail instead of block > > > by default, and let applications decide based on the use case. > > > > > > > Unfortunately, not exactly. > > > > Linus didn't want getrandom to return an error code / "to fail" in > > that case, but to silently return CRNG-uninitialized /dev/urandom > > data, to avoid user-space even working around the error code through > > busy-loops. > > But with this EINVAL you have the information that it only filled > the buffer with whatever it could, right ? At least that was the > last point I manage to catch in the discussion. Otherwise if it's > totally silent, I fear that it will reintroduce the problem in a > different form (i.e. libc will say "our randoms are not reliable > anymore, let us work around this and produce blocking, solid randoms > again to help all our users"). > V1 of the patch I posted did indeed return -EINVAL. Linus then suggested that this might make still some user-space act smart and just busy-loop around that, basically blocking the boot again: https://lkml.kernel.org/r/CAHk-=wiB0e_uGpidYHf+dV4eeT+XmG-+rQBx=JJ110R48QFFWw@mail.gmail.com https://lkml.kernel.org/r/CAHk-=whSbo=dBiqozLoa6TFmMgbeB8d9krXXvXBKtpRWkG0rMQ@mail.gmail.com So it was then requested to actually return what /dev/urandom would return, so that user-space has no way whatsoever in knowing if getrandom has failed. Then, it's the job of system integratos / BSP builders to fix the inspect the big fat WARN on the kernel and fix that. This is the core of Lennart's critqueue of V3 above. > > I understand the rationale behind that, of course, and this is what > > I've done so far in the V3 RFC. > > > > Nonetheless, this _will_, for example, make systemd-random-seed(8) > > save week seeds under /var/lib/systemd/random-seed, since the kernel > > didn't inform it about such weakness at all.. > > Then I am confused because I understood that the goal was to return > EINVAL or anything equivalent in which case the userspace knows what > it has to deal with :-/ > Yeah, the discussion moved a bit beyond that. thanks, --darwi