[PATCH v9] Add getentropy, getrandom, <sys/random.h> [BZ #17252]
Florian Weimer
fweimer@redhat.com
Wed Nov 30 16:15:00 GMT 2016
On 11/30/2016 02:33 PM, Florian Weimer wrote:
> 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.
I received a request off-list to align the getentropy behavior more
closely to the OpenBSD and Solaris behavior. I think this makes sense
(I had not realized before they were so closely aligned), so I've added
the 256-byte check to the glibc version which is performed by the other
implementation in the attached version of the patch.
Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getentropy-v9.patch
Type: text/x-patch
Size: 43310 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20161130/050f5801/attachment.bin>
More information about the Libc-alpha
mailing list