Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1458865imj; Sun, 17 Feb 2019 06:23:23 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ8/XqZtivyxX7XLZ7v7mV+/TDssRUEdCs1nuKK3ZdJPF0KJA7i8ayP0t7aUnLOfzSQiFy0 X-Received: by 2002:a65:4784:: with SMTP id e4mr14244505pgs.12.1550413403387; Sun, 17 Feb 2019 06:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550413403; cv=none; d=google.com; s=arc-20160816; b=HRuFR4DkmyQG+aU5SF3HDLYwtO35kYwdl4C0zJbSdO/KEOEV1EINxug876jEZFJ56G 3BzoPkPL2HkWyRAx1szEWP1ig8JPh0p6s1qlpb5ygL/feciPsZ51iRMI+qG+GBqXZ0mb XA7ncynNbr1d5au408A7wzVImG808uXfaLN0b69G28m2gSt64EGNVmrC4dA5qlgcT01V BRnt/4McPZyHJWPlgL0km1jpqoBMDREdnFqtgPUTu7kNVBprDF/UftqnNKM4Uf9YOeT6 iGy/WXP6PLl1KK1F3CZxfSJTqRSTwmAsrDCjSabfb5QOD9MUpcDTniiuHnmaFt8uUA/z bkzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:to:from; bh=eH0+LQogGPinqcgoZbW5snhUb0BB8FSKipsE54bYy24=; b=Ikkd3zuTmzZYdz8DRyQkL8UehmjL95piVDOAhgH02M3IahvhNXOXOT1vYcO5bzmEV2 vb6AN638xqZlZtBEWc0214Mu3JGeLjzPMxkbPWrIPKdOq4IsUhUAKOzJm1BzhXBbNn0w XeUE6HXIoc2Pc7ZRd+WJ2g4m/e/p6Ao2SZIg8jjMjMmAMzYq1I9qHAffpGCCq5effU8h XreR8YDd/kw+0bxbME/zyafrDEC/AMvxlviu97QVRUjIzQ4QHLMbDxsgvhmIPdV9BwKp Za5Cy68uBNCrb3fnN7yplZaTJ9JlY7R3LbG3EFIkWr0J22/YDCATYDtqCuFaBARYceL7 uX0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si10329682pgd.256.2019.02.17.06.23.05; Sun, 17 Feb 2019 06:23:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729072AbfBQNso convert rfc822-to-8bit (ORCPT + 99 others); Sun, 17 Feb 2019 08:48:44 -0500 Received: from mail-oln040092070100.outbound.protection.outlook.com ([40.92.70.100]:3200 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727442AbfBQNso (ORCPT ); Sun, 17 Feb 2019 08:48:44 -0500 Received: from DB5EUR03FT048.eop-EUR03.prod.protection.outlook.com (10.152.20.57) by DB5EUR03HT023.eop-EUR03.prod.protection.outlook.com (10.152.21.177) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1580.17; Sun, 17 Feb 2019 13:48:42 +0000 Received: from HE1PR0702MB3834.eurprd07.prod.outlook.com (10.152.20.52) by DB5EUR03FT048.mail.protection.outlook.com (10.152.21.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.11 via Frontend Transport; Sun, 17 Feb 2019 13:48:42 +0000 Received: from HE1PR0702MB3834.eurprd07.prod.outlook.com ([fe80::c2e:20b8:445d:e9af]) by HE1PR0702MB3834.eurprd07.prod.outlook.com ([fe80::c2e:20b8:445d:e9af%2]) with mapi id 15.20.1622.018; Sun, 17 Feb 2019 13:48:41 +0000 From: Bernd Edlinger To: "Theodore Y. Ts'o" , Arnd Bergmann , "Greg Kroah-Hartman" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCHv3] random: Make /dev/random wait for crng_ready Thread-Topic: [PATCHv3] random: Make /dev/random wait for crng_ready Thread-Index: AQHUxp0Npbqs83BkVEynF/QYRVMIGKXkAb6A Date: Sun, 17 Feb 2019 13:48:41 +0000 Message-ID: References: <20190216182355.GE23000@mit.edu> In-Reply-To: Accept-Language: en-US, en-GB, de-DE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5P189CA0030.EURP189.PROD.OUTLOOK.COM (2603:10a6:206:15::43) To HE1PR0702MB3834.eurprd07.prod.outlook.com (2603:10a6:7:8e::30) x-incomingtopheadermarker: OriginalChecksum:9D4502516549F696AE45C76E194427B1AC033BF453A3EED20D8A19EC03DACB2B;UpperCasedChecksum:D0D4B450A5E4D85A8183FF693A9FB0369D7BD9FDDE01845CDB17E4C11BDABD5E;SizeAsReceived:8778;Count:62 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [+NW7BeRom402ppoYXaTXmFUjmRfbRIe8] x-microsoft-original-message-id: x-ms-publictraffictype: Email x-incomingheadercount: 62 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);SRVR:DB5EUR03HT023; x-ms-traffictypediagnostic: DB5EUR03HT023: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(4566010)(82015058);SRVR:DB5EUR03HT023;BCL:0;PCL:0;RULEID:;SRVR:DB5EUR03HT023; x-microsoft-antispam-message-info: 1LwlFIvIT7bqXGhVH0Ip5zTs8IbkksZLHqjYjX54pE/YxSvBzbEe//tEQ7c0FAL8 Content-Type: text/plain; charset="Windows-1252" Content-ID: <0F88F59EDCC3B44DBCCD7C3B59D9789D@eurprd07.prod.outlook.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-Network-Message-Id: ed05564d-d9c5-4a1b-1dc3-08d694dea049 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: d4d70346-2c10-4f39-8c00-e767963926d9 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Feb 2019 13:48:40.8628 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5EUR03HT023 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/17/19 9:44 AM, Bernd Edlinger wrote: > > + if (crng_ready() && !blocking_pool.initialized && After some more debugging I realize that blocking_pool.initialized is true after 128 bits of input entropy, but that is only 80 bits credited, due to the asymptotic 3/4 crediting formula. I see that will also enable the code path below: if (entropy_bits > random_write_wakeup_bits && r->initialized && r->entropy_total >= 2*random_read_wakeup_bits) { struct entropy_store *other = &blocking_pool; if (other->entropy_count <= 3 * other->poolinfo->poolfracbits / 4) { schedule_work(&other->push_work); r->entropy_total = 0; } when random_write_wakeup_bits is below 80, and random_read_wakeup_bits is also smallish. This depletes the input_pool in favor of the blocking pool, while we are actually waiting for the input_pool to reach 128 bits security strength, in order to seed the CRNG. I am testing a new version and will post it later today. Sorry for all the back-and forth. Bernd.