Re: Inquiry about the removal of flag O_NONBLOCK on /dev/random

Jason A. Donenfeld
2022-09-08T09:52:49Z

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