Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2346014rwb; Mon, 19 Sep 2022 03:52:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5G4DN6neyvLEX9ZDTObuXS5eBaI8lUzmXSgvb5kEPwgNgad2GE1QWW/eq5fZ/9zlKJ1dR0 X-Received: by 2002:a17:907:60c9:b0:77f:be6d:d870 with SMTP id hv9-20020a17090760c900b0077fbe6dd870mr12406579ejc.348.1663584735632; Mon, 19 Sep 2022 03:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663584735; cv=none; d=google.com; s=arc-20160816; b=DMWn1ai+MMl0JtXjO0Rtl5bzQZUWrA3DtNzfKpoCIuPS5bsD6e7wZxGTqaeVgNYaCw ezjs2go1CpOKmKoZ/muKcAmC/72VxF0YOvYlu6g81VAvWxsbdStvGclR8Bj4FmM+BLZm JeCILQyQU0rP3NQs+3PmwNbz30Gj4ImUx2flK1ttCTc239kRd5qHFDdQ3LDSs1fItlp7 VNufVxQ5cSasQlfZHRUQ1Bt9lruZ0bQ8q2VTb2y2HFgG6hobStmpoxiKoWF5aWIApOEc VL3iV7X5h6lutv/moWClr/krBON/2VSusUDYj4HpaE3NrzGNw0CFzC8vaNrB6vE9VQpP NMJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=rKJHJGF2FSzK4SEwoZS/WLudBmKt7sV9Hh0wjdhk3Dc=; b=FSHEIDQeBR8fq7bUXteQoJtiM39w4SXW+B6pMaMNIS2I1E2xf2pIVQkQ6aboYt8UFo BKMbeZg9GEE3ynNcU4IiHWl9xpG3J4hPKtC/Y4TFOd8E3B3HS9gCNDCuZUBe+TWqk38p 6PcCo2VqL/Gif+TtLN2Rp1i2EhFOn/cXcIrQROygPxlDOGB2U1QLpmWQtOn/2nWfpMHM ZNYL0rWalMtMnSvmm4vxLnh1kTmo89w4irkzsL51QuwrcS76vfSHoPA60hhEh4Yqp2ih Rw5KdcNezDItuNW3efXyn9An2hVesfFZcTLbgEJocXG5fvlvbWWZdXw6GYIjsK1CGzO/ Ialg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=R4Mocjmo; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a0564021e8b00b00451bd163c57si11648089edf.534.2022.09.19.03.51.51; Mon, 19 Sep 2022 03:52:15 -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=@zx2c4.com header.s=20210105 header.b=R4Mocjmo; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbiISKtV (ORCPT + 99 others); Mon, 19 Sep 2022 06:49:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbiISKsq (ORCPT ); Mon, 19 Sep 2022 06:48:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401F1237FA for ; Mon, 19 Sep 2022 03:40:31 -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 C1C956194C for ; Mon, 19 Sep 2022 10:40:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C94D7C433D6 for ; Mon, 19 Sep 2022 10:40:29 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="R4Mocjmo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1663584027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rKJHJGF2FSzK4SEwoZS/WLudBmKt7sV9Hh0wjdhk3Dc=; b=R4MocjmocevKbXuJ+axRCQr41SijqTxsc1wRjOsjLT/dfTw+rUfCB6vVNPe+6Uzs8A7x70 p7lUXFrdjyLfhdU5yaOjmGzjsBcbiwHL7Q/HC2EYw9v1wf/OWC2I1FR/fOMoJEvEG7WpSU YDBeT2E6HOz4Dn3oHccF5meRKW0Egro= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a87f5d6b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Mon, 19 Sep 2022 10:40:26 +0000 (UTC) Received: by mail-ua1-f46.google.com with SMTP id e1so6238131uaa.1 for ; Mon, 19 Sep 2022 03:40:26 -0700 (PDT) X-Gm-Message-State: ACrzQf1kMYn3cw0VoIOKmdBuS6UqjgV+1+yUOUfywJR9gNlvdERG/eYp WAXKgm0ATVjXSFd+PrNlLXjALtwACiWA+wWEHpQ= X-Received: by 2002:ab0:5a24:0:b0:3af:fbb1:2dfb with SMTP id l33-20020ab05a24000000b003affbb12dfbmr6001091uad.27.1663584025966; Mon, 19 Sep 2022 03:40:25 -0700 (PDT) MIME-Version: 1.0 References: <29c4a3ec-f23f-f17f-da49-7d79ad88e284@huawei.com> <4a794339-7aaa-8951-8d24-9bc8a79fa9f3@huawei.com> <761e849c-3b9d-418e-eb68-664f09b3c661@huawei.com> In-Reply-To: From: "Jason A. Donenfeld" Date: Mon, 19 Sep 2022 11:40:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Inquiry about the removal of flag O_NONBLOCK on /dev/random To: "Guozihua (Scott)" Cc: Eric Biggers , Linux Crypto Mailing List , Andrew Lutomirski , "Theodore Ts'o" , zhongguohua Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, 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 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