arc4random does not reseed after using fork()

Glenn Strauss gs-cygwin.com@gluelogic.com
Fri Jan 26 23:50:19 GMT 2024


> While testing ksh93u+m's recently added SRANDOM variable[1], I have
> discovered a bug in Cygwin's arc4random function. After using fork(),
> arc4random does not reseed itself, which causes the results to become
> predictable[2]. Below is a test case C program exhibiting the bug:
> 
> ...
> 
> [1]: https://github.com/ksh93/ksh/commit/00b296c
> [2]: https://github.com/ksh93/ksh/issues/711

FYI: There was a thread in Nov 2023 about rand() which might be related.

rand is not ISO C compliant in Cygwin
https://cygwin.com/pipermail/cygwin/2023-November/254735.html

conclusion of that thread:
https://cygwin.com/pipermail/cygwin/2023-November/254764.html


More information about the Cygwin mailing list