HomeFreeBSD

getentropy(3): Fallback to kern.arandom sysctl on older kernels

Description

getentropy(3): Fallback to kern.arandom sysctl on older kernels

On older kernels, when userspace program disables SIGSYS, catch ENOSYS and
emulate getrandom(2) syscall with the kern.arandom sysctl (via existing
arc4_sysctl wrapper).

Special care is taken to faithfully emulate EFAULT on NULL pointers, because
sysctl(3) as used by kern.arandom ignores NULL oldp. (This was caught by
getentropy(3) ATF tests.)

Reported by: kib
Reviewed by: kib
Discussed with: delphij
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14785

Details

Provenance
cemAuthored on
Reviewer
kib
Differential Revision
D14785: getentropy(3): Fallback to kern.arandom sysctl on older kernels
Parents
rS331333: Fix kernel memory disclosure in drm_infobufs
Branches
Unknown
Tags
Unknown