[PATCH v8] Add getentropy, getrandom, <sys/random.h> [BZ #17252]

Florian Weimer fweimer@redhat.com
Wed Nov 30 13:33:00 GMT 2016


This iteration of the patch implements both getrandom and getentropy at 
the same time.  getrandom is a cancellation point, has short reads, can 
return EINTR etc., but getentropy is the more uniform interface.  I 
added a retry loop in the getentropy implementation, to avoid exposing 
an implicit magic number in the kernel implementation (the maximum size 
of a single read; it differs between Solaris/OpenBSD/Linux).

(You get to decide which function is Mulready and which one is Lang.)

getentropy definitely needs interposition protection because it is 
frequently redefined.  We'll need to rebuild a distribution to see if 
the current approach is sufficient.  For consistency, I also added 
interposition protection for getrandom.

In addition, I had to make a few fixes so that the ABI is stable across 
supported kernel headers, and had to tweak the stub implementations, too.

Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getentropy.patch
Type: text/x-patch
Size: 42554 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20161130/a98e1b16/attachment.bin>


More information about the Libc-alpha mailing list