Summary: | getentropy(3) should not use ENOSYS to test existence of getrandom(2) | ||
---|---|---|---|
Product: | Base System | Reporter: | Xin LI <delphij> |
Component: | bin | Assignee: | Xin LI <delphij> |
Status: | Closed FIXED | ||
Severity: | Affects Some People | CC: | cem |
Priority: | --- | ||
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Xin LI
![]() ![]() Analysis: In https://reviews.freebsd.org/D14500 I have suggested using ENOSYS to test the existence of the new entropy system call. This will not work unless application already handles SIGSYS. The solution is to check osreldate instead, I'll create a review soon. A commit references this bug: Author: delphij Date: Mon Aug 20 02:17:56 UTC 2018 New revision: 338084 URL: https://svnweb.freebsd.org/changeset/base/338084 Log: In r331279 the code used ENOSYS to check the existence of getrandom(2). This will only work if the caller already handles SIGSYS, which is not always the case. Address this by checking osreldate instead. Note that because there was not __FreeBSD_version bump when the system call was added, use 1200061 (r332100) which is the first bump after the introduction of the system call. PR: 230762 Reported by: Jenkins via Mark Millard Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D16807 Changes: head/lib/libc/gen/getentropy.c |