Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp276317imi; Wed, 20 Jul 2022 23:51:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sX7PAVLD1wsVzRFB7SuI3RrpCbs6dp9y86r/VdfbhFgK+GWM+yI8v0wJ+ViGIiFX8vYLJD X-Received: by 2002:a05:6402:25c6:b0:43b:7797:d953 with SMTP id x6-20020a05640225c600b0043b7797d953mr15337978edb.254.1658386301715; Wed, 20 Jul 2022 23:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658386301; cv=none; d=google.com; s=arc-20160816; b=b276Kt2WjtDScrCjbC9uplHYZT4sI0GCtP6duHKHOXUV8Lae+EPsj8Dm+WSqMdYTlw uKpEZ4frA8UmpbQw6fWDWGAlMk6pAA++WFzQCkg4E+Okd32sFybLfVnby4vU8PTI7TfP TAoi8T1FtnacEHxOER1we+k3EztN2Jdf54kHcDKQKIfKkPxOzt3CVzWCttuPBD5vS0P6 6UgZ9TJ2605B/3sAOsP7PR7MCsFziGAZfZgzlp9Fb1wC/SICa+VbWywJHUkqkSh//bQ2 RCSTihrQxW7W9h5YHFErBkewfporZm2h1BDx09zhGPw6MzM9Faj1RJ5O9oL5MjfydKFF eSSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hfRWuf1CCkWm3DKCb6dftOGsQAv2NF6QjvQ0VHYhAXE=; b=kV2+6pUmLSeA5AMbEhR3oX0SIsrcKXYJ7oLunPUd9IrYioKndT0XV4RTAV9iwGotMn Gc+0d1ZZ2X8CrjM5fookiVwbw9AwVFxLp+wSW8u0hbp+t9VGMm28TbtIUAK/YirfG7HV v4/8U/VWhCliINwuigalsVqDmfVNOWkR3m1wn/c87GqpeiL+C4hXX7eF4LJpOVpB1+B6 HHXPRFqsfm8Kuz7pEqSq4Xx9e+MQ7jZVLTYT3SdLEs0ci6Ua5aKIZdonSVCMrgsJZxZX T6MVt5KEt13LrTi7o2/xeKgq2RcJELxClsZw4BolNwGl7AKSajIfLhqBR7xw0W7DUjIx tq2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LHFz3E2N; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id zo18-20020a170906ff5200b00722a6137b0csi1320983ejb.280.2022.07.20.23.51.17; Wed, 20 Jul 2022 23:51:41 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LHFz3E2N; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbiGUGuu (ORCPT + 99 others); Thu, 21 Jul 2022 02:50:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbiGUGuu (ORCPT ); Thu, 21 Jul 2022 02:50:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E39B42ADA for ; Wed, 20 Jul 2022 23:50:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DEF2761D9D for ; Thu, 21 Jul 2022 06:50:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C695C3411E; Thu, 21 Jul 2022 06:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658386248; bh=UHUsl9CtsXcyKDgHf6BH2bn/4luWzcIbgh/lZOrmzyA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LHFz3E2NtB3HKKV5MRMM2Yj0kXCQgi/oe0Y8tYCPUwxyCs29M4E5on1aU2HYvYgco e97Nok9nfITPSvzZmpFamTDZ2miQibuirYmMja5n3uFtfDAbAPVbmmgUXrW/2WAMwJ kMeDLuoIOU0BXsRGTJrZ2m+005U19mssKn4JABAAULt74d5nnOuq2FI7CINWnKUSyK iE3z6EWtAlnLH5fQpJipr7VmnRadbjQk86PMS0tTleI06aAUw1xQVhVyvk4f9xF5ke p+uIGmXnSFhduxcyH+Lvuja9i48TXxAuavfoe3Vyd08MeVeYMfBE7ZhVhVfFLu2WKO YHS/EDe3uqqNw== Date: Wed, 20 Jul 2022 23:50:46 -0700 From: Eric Biggers To: "Guozihua (Scott)" Cc: "Jason A. Donenfeld" , linux-crypto@vger.kernel.org, luto@kernel.org, tytso@mit.edu Subject: Re: Inquiry about the removal of flag O_NONBLOCK on /dev/random Message-ID: References: <13e1fa9d-4df8-1a99-ca22-d9d655f2d023@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Thu, Jul 21, 2022 at 02:44:54PM +0800, Guozihua (Scott) wrote: > > Hi Eric > > We have a userspace program that starts pretty early in the boot process and > it tries to fetch random bits from /dev/random with O_NONBLOCK, if that > returns -EAGAIN, it turns to /dev/urandom. Is this a correct handling of > -EAGAIN? Or this is not one of the intended use case of O_NONBLOCK? That doesn't make any sense; you should just use /dev/urandom unconditionally. - Eric