This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add getrandom implementation [BZ #17252]


On Fri, 10 Jun 2016, Paul Eggert wrote:

> How about if we use a simpler implementation instead, one that opens, reads,
> and closes /dev/whatever each time getrandom is called? That would be a bit
> slower slower but would avoid this problem and probably other problems.

That would certainly be my preference.  (You still need O_CLOEXEC on the 
open, as for all cases where file descriptors are used internally in 
glibc, to avoid leaking file descriptors to concurrent fork and exec from 
other threads.)

It's in the nature of this code - returning cryptographically-secure 
random numbers - to be used in security-critical places.  And for such 
code, there are advantages to being simple enough to be obviously safe and 
not to need lots of complicated defensive code.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]