This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Why is getentropy marked with warn_unused_result?
On 27/07/2017 21:12, Joseph Myers wrote:
> On Sun, 23 Jul 2017, Florian Weimer wrote:
>
>> I'm still open to implementing emulation within glibc if problems like
>> these convince the glibc community that this is necessary.
>
> I don't object to a straightforward emulation that opens /dev/urandom with
> O_CLOEXEC, does the read and closes the file, each time getentropy is
> called (if __NR_getrandom is not defined, or if the getrandom syscall
> returns an ENOSYS error). The argument for emulation in getentropy is
> stronger than that for emulating the lower-level getrandom interface.
>
If I recall correctly (and the summary at [1] helped as well), the main
issue with the getentropy emulation is how to handle correctly any file
operation issue (non existent urandom file for some reason, EMFILE/ENFILE,
ENOMEM) which leads to different function semantic whether the emulation
is used.
[1] https://lwn.net/Articles/711013/