Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2346725rwb; Mon, 19 Sep 2022 03:53:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6rROvky5j2Yg8n/i6pWbYJEMlc5DH/oSC+t8t5LSJqn5OubFw/HgebEGZehBc/FRhSEBBQ X-Received: by 2002:a05:6402:440c:b0:43a:1124:e56a with SMTP id y12-20020a056402440c00b0043a1124e56amr15291593eda.134.1663584787268; Mon, 19 Sep 2022 03:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663584787; cv=none; d=google.com; s=arc-20160816; b=CjiAa9aY30RR1wNfT2kRKH52UI9vpNNcyH/iIbjkarLul72NDqsNo5bIaX1RjhKQkK jJHDmINdux3mfAoka3Fk3fcBiJvQrLMDoi61cxWc8xH20obZdwrCZAMG/C0ENMKzPOoy ZijgpEehP2oVIjDJkNRaQlIARjpic//uUUkkM9zOz2lSgiDPuOddC6fDMg6Yi+6XOYAc w2qsTQI6gMygzTtcyA2DbPrQ2ElTumwvuBH9Svi2bVbb78io4DXXZx21ryW+k/20jtie 3NtDJIxV2Y3kSg6l9UsJrxU+0BEdgu/d9oBOkt70GZhWqjo19SAX+B40q1ge5+mDll3x aYjQ== 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=50uGTH/biw7K6ZbK4nmJ3GY6JZW8N5ZgDICwm4DBV30=; b=vWYQTOvHU0nBIioi21tByNMkodEpgR3uclxEJl1PBSp6sO4o+TkkP+TmovYQso6T1W xlmFweuNBaAXJIXrpoLwfkLIszgL1vC7eKblvq/2ZqSRvbX6ey/s4cq/40VA+yz4wumm j2bw6Jk/pgJ2aJPXj+nk3j9uUr4miwEpXgYJTyICE0BPfUiIwtwpcpq/rSaWsZQVRzuH PFXpc4OH203J4W+O7PnnEVww6zjs8IEleBUth/beppi1Jk/LO0F2wjJNeodcumFeqYm0 G87TQ1JoXC6P7cNrWIKAVmpzxVD7s+l/zrw9mMHbZmygHSizAyY3mDDeWMvwXmlCtjDg baVw== 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 fd16-20020a056402389000b00447c736ddaasi9134103edb.611.2022.09.19.03.52.42; Mon, 19 Sep 2022 03:53:07 -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 S229952AbiISKvO (ORCPT + 99 others); Mon, 19 Sep 2022 06:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiISKuv (ORCPT ); Mon, 19 Sep 2022 06:50:51 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94EF712A8B for ; Mon, 19 Sep 2022 03:45:24 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MWLql0JkxzHnx5; Mon, 19 Sep 2022 18:43:15 +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.31; Mon, 19 Sep 2022 18:45:22 +0800 Message-ID: <5a375c35-66f6-b377-8ffb-58006b151d60@huawei.com> Date: Mon, 19 Sep 2022 18:45:22 +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" CC: Eric Biggers , Linux Crypto Mailing List , Andrew Lutomirski , Theodore Ts'o , zhongguohua References: <29c4a3ec-f23f-f17f-da49-7d79ad88e284@huawei.com> <4a794339-7aaa-8951-8d24-9bc8a79fa9f3@huawei.com> <761e849c-3b9d-418e-eb68-664f09b3c661@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: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500024.china.huawei.com (7.185.36.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.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/9/19 18:40, Jason A. Donenfeld wrote: > Hi, > > On Mon, Sep 19, 2022 at 11:27 AM Guozihua (Scott) wrote: >> >> On 2022/9/8 17:51, Jason A. Donenfeld wrote: >>> Hi, >>> >>> On Thu, Sep 08, 2022 at 11:31:31AM +0800, Guozihua (Scott) wrote: >>>> For example: >>>> >>>> >>>> -- >>>> Best >>>> GUO Zihua >>>> >>>> -- >>>> Best >>>> GUO Zihua >>> >>> Looks like you forgot to paste the example... >>> >>>> Thank you for the timely respond and your patient. And sorry for the >>>> confusion. >>>> >>>> First of all, what we think is that this change (removing O_NONBLOCK) is >>>> reasonable. However, this do cause issue during the test on one of our >>>> product which uses O_NONBLOCK flag the way I presented earlier in the >>>> Linux 4.4 era. Thus our colleague suggests that returning -EINVAL when >>>> this flag is received would be a good way to indicate this change. >>> >>> No, I don't think it's wise to introduce yet *new* behavior (your >>> proposed -EINVAL). That would just exacerbate the (mostly) invisible >>> breakage from the 5.6-era change. >>> >>> The question now before us is whether to bring back the behavior that >>> was there pre-5.6, or to keep the behavior that has existed since 5.6. >>> Accidental regressions like this (I assume it was accidental, at least) >>> that are unnoticed for so long tend to ossify and become the new >>> expected behavior. It's been around 2.5 years since 5.6, and this is the >>> first report of breakage. But the fact that it does break things for you >>> *is* still significant. >>> >>> If this was just something you noticed during idle curiosity but doesn't >>> have a real impact on anything, then I'm inclined to think we shouldn't >>> go changing the behavior /again/ after 2.5 years. But it sounds like >>> actually you have a real user space in a product that stopped working >>> when you tried to upgrade the kernel from 4.4 to one >5.6. If this is >>> the case, then this sounds truly like a userspace-breaking regression, >>> which we should fix by restoring the old behavior. Can you confirm this >>> is the case? And in the meantime, I'll prepare a patch for restoring >>> that old behavior. >>> >>> Jason >>> . >> >> Hi Jason >> >> Thank for your patience. >> >> To answer your question, yes, we do have a userspace program reading >> /dev/random during early boot which relies on O_NONBLOCK. And this >> change do breaks it. The userspace program comes from 4.4 era, and as >> 4.4 is going EOL, we are switching to 5.10 and the breakage is reported. >> >> It would be great if the kernel is able to restore this flag for >> backward compatibility. > > Alright then. Sounds like a clear case of userspace being broken. I'll > include https://git.zx2c4.com/linux-rng/commit/?id=b931eaf6ef5cef474a1171542a872a5e270e3491 > or similar in my pull for 6.1, if that's okay with you. For 6.0, we're > already at rc6, so maybe better to let this one stew for a bit longer, > given the change, unless you feel strongly about having it earlier, I > guess. > > Jason > . Hi Jason That's OK with us. Thanks. -- Best GUO Zihua