Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp459033imi; Thu, 21 Jul 2022 04:44:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s0+PN7cegeh7aIM1YlJpR8nWeZanzdsYcDcsKiU6A3V/kxmJu1GqyDmn3cdle1XN59AMGW X-Received: by 2002:a63:ea05:0:b0:411:f94f:b80f with SMTP id c5-20020a63ea05000000b00411f94fb80fmr36523677pgi.189.1658403876773; Thu, 21 Jul 2022 04:44:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658403876; cv=none; d=google.com; s=arc-20160816; b=l/KwSxRK5SuQiYAfmZ+5nQrfjPhc6noIC0j4250BTJ2+rbikNLLw40ZJcP+MU8kz6l qsWb/buC9FVi8b2pQGItwSWMX0vME66+mXd/7/RBC0ywnQMxPz/eMwWwoTzm2nUv3YyY r7lXEmPjODXPEHNol7PZjTlQoC/+nEkoAa2b1y1WAh/acBDLJDwE0wP56K4BPXcUqNIy U6NWqCX3l41MQKiT2bdVZPREOCixngd6o210zKp/Haa9+S4jjea9WTBwQRL16zMUz+Ml 8CPdEB/q5tnhIzdnp0HYDth/aBhwVEVQFf7m6xXVvZ37r8b+55OVeY49ihk7rzoRxx2b yR9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=QKe7wYHXMMymWw6jXt6XypqsJTztByc4YoHp4GUkiSQ=; b=w49ePkDlyx7DlFcwD/Hrst6vY1GluormEBhchSMBiW1jS1E6Ir8sTaJMFi3kXvZyqH ld3tX+XdcqktTPPooRPT1/7g2qlRWNGAYyF3csbMyrKKQCWtsGbAei0frJVEctoudZhG 3Lk5PjZwzjAor8GXtcFgQtP9DL5shobqpxbFDxhNmN8y7F5ufmjVLdm+A/VpSG4RfiqI QYYAvOXBc3d/WRVZ5e5OSnl9FsGKq2gZKHBeZQdQxUH1/Y+nuT6PFBfSAqiWDX633kmT a3mbBRGxEk3ZMfhf9O85j2jK6hnLrj2ovbaHC/atiovR/kns8KhbJpD4SIQcUSaLQbZ8 C18A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 14-20020a63134e000000b00415abc3c2c6si1916393pgt.521.2022.07.21.04.44.21; Thu, 21 Jul 2022 04:44:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232549AbiGULaQ (ORCPT + 99 others); Thu, 21 Jul 2022 07:30:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbiGULaP (ORCPT ); Thu, 21 Jul 2022 07:30:15 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D92FD36 for ; Thu, 21 Jul 2022 04:30:12 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4LpVfN3dtVz1M8JK; Thu, 21 Jul 2022 19:27:24 +0800 (CST) Received: from [10.67.110.173] (10.67.110.173) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 21 Jul 2022 19:30:09 +0800 Message-ID: Date: Thu, 21 Jul 2022 19:30:09 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: Inquiry about the removal of flag O_NONBLOCK on /dev/random Content-Language: en-US To: "Jason A. Donenfeld" , Eric Biggers CC: , , References: <13e1fa9d-4df8-1a99-ca22-d9d655f2d023@huawei.com> From: "Guozihua (Scott)" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.110.173] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500024.china.huawei.com (7.185.36.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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-crypto@vger.kernel.org On 2022/7/21 18:37, Jason A. Donenfeld wrote: > Hi Guozihua, > > On Wed, Jul 20, 2022 at 11:50:46PM -0700, Eric Biggers wrote: >> On Thu, Jul 21, 2022 at 02:44:54PM +0800, Guozihua (Scott) wrote: >> >> That doesn't make any sense; you should just use /dev/urandom unconditionally. > > What Eric said: this flow doesn't really make sense. Why not use > /dev/urandom unconditionally or getrandom(GRND_INSECURE)? > > But also I have to wonder: you wrote '-EAGAIN' but usually userspace > checks errno==EAGAIN, a positive value. That makes me wonder whether you > wrote your email with your code is open. So I just wanted to triple > check that what you've described is actually what the code is doing, > just in case there's some ambiguity. > > I'm just trying to find out what this code is and where it is to assess > whether we change the userspace behavior again, given that this has been > sitting for several years now. > > Jason > . Hi Jason and Eric. To clarify, the code in question is not written by me and I did not see the code myself, the code is from another team. We discovered this change during the test when we try to run our userspace program on a newer version kernel, and it blocks for a long time during the boot process. It seems that the author use the -EAGAIN error code as an indication that /dev/random is not ready and they implemented a "best effort" mechanism in terms of getting random data. Honestly speaking I don't know what they are using those random data for, and I am trying to get some background knowledge for this flag and the change, maybe figure out whether that team is using the flag as intended, and bring this up with them. -- Best GUO Zihua