diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2024-01-29 13:38:14 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2024-01-29 13:43:36 +0100 |
commit | 030a762535c1e18bf5a7ecc73b0f49898a30b157 (patch) | |
tree | caeec5cc844e49ade92921af5eeb328f5ce1420c | |
parent | 1f68e88f0dfdac54d71ed0fd2c3f9a9f65636e06 (diff) | |
download | newlib-030a762535c1e18bf5a7ecc73b0f49898a30b157.zip newlib-030a762535c1e18bf5a7ecc73b0f49898a30b157.tar.gz newlib-030a762535c1e18bf5a7ecc73b0f49898a30b157.tar.bz2 |
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: e0fc33322d50 ("Delete Cygwin's arc4random in favor of new Newlib implementation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/include/machine/_arc4random.h | 11 | ||||
-rw-r--r-- | winsup/cygwin/release/3.5.0 | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/winsup/cygwin/include/machine/_arc4random.h b/winsup/cygwin/include/machine/_arc4random.h index 2078c35..fd3970f 100644 --- a/winsup/cygwin/include/machine/_arc4random.h +++ b/winsup/cygwin/include/machine/_arc4random.h @@ -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 */ diff --git a/winsup/cygwin/release/3.5.0 b/winsup/cygwin/release/3.5.0 index 611636b..d756c07 100644 --- a/winsup/cygwin/release/3.5.0 +++ b/winsup/cygwin/release/3.5.0 @@ -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 |