Back in Linux 6.11 support for getrandom() in the vDSO was upstreamed for much better performance in providing speedy yet secure random number generation (RNG) needs. Since Linux 6.11 getrandom in the vDSO has expanded to more CPU architectures and now there’s a notable user-space user ready to go: the GNU C Library “glibc” support was merged.
The patch enabling getrandom() vDSO usage by the GNU C Library was upstreamed yesterday into Glibc Git. Adhemerval Zanella of Linaro and co-author Jason Donenfeld explain in the Glibc support patch:
“linux: Add support for getrandom vDSO
Linux 6.11 has getrandom() in vDSO. It operates on a thread-local opaque state allocated with mmap using flags specified by the vDSO.
Multiple states are allocated at once, as many as fit into a page, and these are held in an array of available states to be doled out to each thread upon first use, and recycled when a thread terminates. As these states run low, more are allocated.
To make this procedure async-signal-safe, a simple guard is used in the LSB of the opaque state address, falling back to the syscall if there’s reentrancy contention.
…
It is currently enabled for x86_64, which is available in Linux 6.11, and aarch64, powerpc32, powerpc64, loongarch64, and s390x, which are available in Linux 6.12.”
Thus with the Glibc 2.41 release due out around the start of February, getrandom vDSO will be utilized when running on recent Linux kernel versions in providing faster yet secure RNG.