mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 00:25:07 -05:00
util: fall back to reading /dev/urandom when getrandom() blocks
With recent changes in the Linux kernel, the getrandom() system call may block for a long time after boot on machines that don't have enough entropy. It blocks the chronyd's initialization before it can detach from the terminal and may cause a chronyd service to fail to start due to a timeout. At least for now, enable the GRND_NONBLOCK flag to make the system call non-blocking and let the code fall back to reading /dev/urandom (which never blocks) if the system call failed with EAGAIN or any other error. This makes the start of chronyd non-deterministic with respect to files that it needs to open and possibly also makes it slightly easier to guess the transmit/receive timestamp in client requests until the urandom source is fully initialized.
This commit is contained in:
Reference in New Issue
Block a user