Cygwin: fix arc4random after fork(2)

After using fork(), arc4random does not reseed itself, which
causes the results to become predictable.  Activate droppingfork-recognition

Fixes: e0fc33322d ("Delete Cygwin's arc4random in favor of new Newlib implementation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2024-01-29 13:38:14 +01:00
parent 1f68e88f0d
commit 030a762535
2 changed files with 17 additions and 0 deletions

View File

@ -25,4 +25,15 @@ extern int __isthreaded;
__lock_release (_arc4random_mutex); \
} while (0)
static inline void
_arc4random_forkdetect(void)
{
extern int __in_forkee;
if (__in_forkee)
rs = NULL;
}
#define _ARC4RANDOM_FORKDETECT() _arc4random_forkdetect ()
__END_DECLS
#endif /* _MACHINE_ARC4RANDOM_H */

View File

@ -67,3 +67,9 @@ What changed:
- The default RLIMIT_CORE is now 0, disabling the generation of core dump or
stackdump files.
Fixes:
------
- Fix arc4random reseeding after fork(2).
Addresses: https://cygwin.com/pipermail/cygwin/2024-January/255245.html