Bug
In library/std/src/sys/random/linux.rs:143, the code uses:
assert_eq!(fd.revents, libc::POLLIN);
The Linux kernel's random_poll() function returns EPOLLIN | EPOLLRDNORM. When the kernel sets both flags in revents, the strict equality assertion panics even though the poll succeeded normally.
This affects any Linux system where the RNG is not yet initialized during early boot (the poll-for-readiness path).
Fix
Use a bitwise check: assert!(fd.revents & libc::POLLIN != 0) to verify POLLIN is set without requiring it to be the only flag.
Bug
In
library/std/src/sys/random/linux.rs:143, the code uses:The Linux kernel's
random_poll()function returnsEPOLLIN | EPOLLRDNORM. When the kernel sets both flags inrevents, the strict equality assertion panics even though the poll succeeded normally.This affects any Linux system where the RNG is not yet initialized during early boot (the poll-for-readiness path).
Fix
Use a bitwise check:
assert!(fd.revents & libc::POLLIN != 0)to verify POLLIN is set without requiring it to be the only flag.