GNU C Library Merges Support for getrandom vDSO

Written by Michael Larabel in GNU on 13 November 2024 at 09:20 AM EST. 1 Comment
GNU
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.

glibc getrandom vDSO merged

Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week