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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

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.

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, Eric and Theodore,

Thanks for all the comments on this inquiry. Does the community has any channel to publishes changes like these? And will the man pages get updated? If so, are there any time frame?

--
Best
GUO Zihua



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux