Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2408773ybe; Sat, 14 Sep 2019 14:27:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyf91VIySJomXBN/4Xz9AcZGxNhiMTtxnfywZgSAALeJlsZ8B79JFW+JaHBTcwwLGO5q3ip X-Received: by 2002:a17:906:688d:: with SMTP id n13mr31383869ejr.65.1568496439886; Sat, 14 Sep 2019 14:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568496439; cv=none; d=google.com; s=arc-20160816; b=w01A/dzq7iaA/Zj2QsRJjYP4Hr3MU9pDaz9glsURMiW7RrMjrz39KroFy1KseBnKZ8 csUuLKKyhXFSVtv0//Yklh378Y+PTVeyY6wN36Vvezjhwg9aqk2UXDozsjAE59yqpeWC j37WZabmP9BJQU6FqfDCgFWIp3k9G2pW7eQO/CdmAL0UKvzIIBW8NmCDusB+t6jvMzis N0HSAcP5jjDdsjEKjEMi2v6tF4EzrYx/jectpDPGAM1Ue8Oiy2epEn0FXZCI7eVpCFHI 6eqv0YKxVvzoLUihv+kPGdDSDn77TqDMQbJBWLhXNNMnUX9AMKDw7ICdWhCHBuES/JJh IVJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=zF94AwdVKK7RKbQpXTMiMshxoycEBwVhKtPGWg7jXVE=; b=jX5ujCY+QXLSaqjiDkLTMQwUOH+SsoC+Wk6c+Cc0iYb/nBNG2SMwfr5SxpKw8AtOKW nJduOECw0PP56Qxm8xUcGICiOgPU47e3PzSa4FR11hFAjK1TNlCnAKo/0SQkjY8F3aL3 AaEs4D/IUNDMHdxoIvDUqaWR/bgI8VOuYeH2UK/vLQRPBP815h1Dja3K+bIrJZml9Kka ODExo1ro4/qvFXjK+Y73q6gr+62Ij+rlaBMWPhKXsXo/tda2BGUr6JJaDflIyffU7kvq ZDPJ94nRKt9yPjPh5B+T/P0gbXTfvWAkEIpyLfhyfnH3S8pSCNzM5IzeWpLvTZf4U8Qp 7KkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N2ulPpyZ; 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 g90si4453622edd.329.2019.09.14.14.26.54; Sat, 14 Sep 2019 14:27:19 -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=N2ulPpyZ; 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 S1727403AbfINQfU (ORCPT + 99 others); Sat, 14 Sep 2019 12:35:20 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:34038 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727237AbfINQfU (ORCPT ); Sat, 14 Sep 2019 12:35:20 -0400 Received: by mail-lf1-f68.google.com with SMTP id r22so13031223lfm.1; Sat, 14 Sep 2019 09:35:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to; bh=zF94AwdVKK7RKbQpXTMiMshxoycEBwVhKtPGWg7jXVE=; b=N2ulPpyZnI66VnzTH5ZKle/GAd4ONKC6p82dg0VPD/IRMPfcftpiUx87amcc0j9mjG LW6r1XrVX5xskRSdHK9lFUeOakxuB15ezFrK/nnEinxhZHWxVj2+ncxBYBWfQwHU0QTv ehtaX/T1TCtkwfZM9lBp27EQiBypfFzWqTZYNr666FYi9ZoQbrtAsrZdgViYUFig7+DL TQl/QJzF+u6bhgOoqZxMBwClOTQMafQcTOewoBFNmuV0B6sVGx14vgSBEiBCCy9ji7kq x7Bt/o5sExTnx7nV3QmIYT36ime1DLN2ISIgOnf8PUJa+G6uXL11zZ42IKcT/hiIdQNk FFuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=zF94AwdVKK7RKbQpXTMiMshxoycEBwVhKtPGWg7jXVE=; b=mcHbgnDgLCY/oCjkWzKbKFg9jPfzVrSWKLwJlKDh6Bs5tOgV5ZyeHDz+r+iryPQaAb bicABOKtljZKG9gq7OrGkIvwnDVP0xvJw9f38Hyr1tuPiKWXujFlx8lX6LIOXlzq8Vij NGFh2tGkhJIub+pRlU64cGYF+7F/gV9KjOefiFBV5oHW9LAKBpLOg4QuNSZ05yivokF5 29kxSpMw8W+sgBVJB1aqrTdA435CoLg7lKr3pThFbGvMzg0AMaiUQ3R0eA1trUrIGt/W 5YjMXaxVowm6dyYHKmmV8iO1LZpKShUnCX2VMzgrrR3yg+knaXP6ONOAvPHa6CRriTD0 PPuw== X-Gm-Message-State: APjAAAUGDd+9Dj3kJ8sb5IsmEgXhUxYl/QxE5XjuGlSHt31MgyGcOJLP aFRBSKJuxFJJ4brvQ943Dtx1fB4hNWDw1A== X-Received: by 2002:a19:5d53:: with SMTP id p19mr12612716lfj.109.1568478914802; Sat, 14 Sep 2019 09:35:14 -0700 (PDT) Received: from ?IPv6:2a02:17d0:4a6:5700::a11? ([2a02:17d0:4a6:5700::a11]) by smtp.googlemail.com with ESMTPSA id z20sm694288ljk.63.2019.09.14.09.35.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 Sep 2019 09:35:13 -0700 (PDT) Subject: Re: Linux 5.3-rc8 To: Linus Torvalds , "Ahmed S. Darwish" Cc: "Theodore Y. Ts'o" , Andreas Dilger , Jan Kara , Ray Strode , William Jon McCann , zhangjs , linux-ext4@vger.kernel.org, Lennart Poettering , lkml References: <20190910173243.GA3992@darwi-home-pc> <20190911160729.GF2740@mit.edu> <20190911173624.GI2740@mit.edu> <20190912034421.GA2085@darwi-home-pc> <20190912082530.GA27365@mit.edu> <20190914150206.GA2270@darwi-home-pc> From: "Alexander E. Patrakov" Message-ID: <214fed0e-6659-def9-b5f8-a9d7a8cb72af@gmail.com> Date: Sat, 14 Sep 2019 21:35:12 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="------------ms070301000708070209070806" Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This is a cryptographically signed message in MIME format. --------------ms070301000708070209070806 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-PH Content-Transfer-Encoding: quoted-printable 14.09.2019 21:30, Linus Torvalds =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > On Sat, Sep 14, 2019 at 8:02 AM Ahmed S. Darwish = wrote: >> >> On Thu, Sep 12, 2019 at 12:34:45PM +0100, Linus Torvalds wrote: >>> >>> An alternative might be to make getrandom() just return an error >>> instead of waiting. Sure, fill the buffer with "as random as we can" >>> stuff, but then return -EINVAL because you called us too early. >> >> ACK, that's probably _the_ most sensible approach. Only caveat is >> the slight change in user-space API semantics though... >> >> For example, this breaks the just released systemd-random-seed(8) >> as it _explicitly_ requests blocking behvior from getrandom() here: >> >=20 > Actually, I would argue that the "don't ever block, instead fill > buffer and return error instead" fixes this broken case. >=20 >> =3D> src/random-seed/random-seed.c: >> /* >> * Let's make this whole job asynchronous, i.e. let's make >> * ourselves a barrier for proper initialization of the >> * random pool. >> */ >> k =3D getrandom(buf, buf_size, GRND_NONBLOCK); >> if (k < 0 && errno =3D=3D EAGAIN && synchronous) { >> log_notice("Kernel entropy pool is not initialized yet, " >> "waiting until it is."); >> >> k =3D getrandom(buf, buf_size, 0); /* retry synchronously */= >> } >=20 > Yeah, the above is yet another example of completely broken garbage. >=20 > You can't just wait and block at boot. That is simply 100% > unacceptable, and always has been, exactly because that may > potentially mean waiting forever since you didn't do anything that > actually is likely to add any entropy. >=20 >> if (k < 0) { >> log_debug_errno(errno, "Failed to read random data with " >> "getrandom(), falling back to " >> "/dev/urandom: %m"); >=20 > At least it gets a log message. >=20 > So I think the right thing to do is to just make getrandom() return > -EINVAL, and refuse to block. Let me repeat: not -EINVAL, please. Please find some other error code,=20 so that the application could sensibly distinguish between this case=20 (low quality entropy is in the buffer) and the "kernel is too dumb" case = (and no entropy is in the buffer). --=20 Alexander E. Patrakov --------------ms070301000708070209070806 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: Криптографическая подпись S/MIME MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCC C5wwggVNMIIENaADAgECAhArQ2N9hOajPiuqD20bI16wMA0GCSqGSIb3DQEBCwUAMIGCMQsw CQYDVQQGEwJJVDEPMA0GA1UECAwGTWlsYW5vMQ8wDQYDVQQHDAZNaWxhbm8xIzAhBgNVBAoM GkFjdGFsaXMgUy5wLkEuLzAzMzU4NTIwOTY3MSwwKgYDVQQDDCNBY3RhbGlzIENsaWVudCBB dXRoZW50aWNhdGlvbiBDQSBHMTAeFw0xOTA2MDYwODAxMzVaFw0yMDA2MDYwODAxMzVaMB0x GzAZBgNVBAMMEn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