public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: fix arc4random after fork(2) Date: Mon, 29 Jan 2024 12:44:11 +0000 (GMT) [thread overview] Message-ID: <20240129124411.5ED9E3858402@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=030a762535c1e18bf5a7ecc73b0f49898a30b157 commit 030a762535c1e18bf5a7ecc73b0f49898a30b157 Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Mon Jan 29 13:38:14 2024 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Mon Jan 29 13:43:36 2024 +0100 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> Diff: --- winsup/cygwin/include/machine/_arc4random.h | 11 +++++++++++ winsup/cygwin/release/3.5.0 | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/winsup/cygwin/include/machine/_arc4random.h b/winsup/cygwin/include/machine/_arc4random.h index 2078c35972bb..fd3970f64ab2 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 611636b9029d..d756c07853f6 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
reply other threads:[~2024-01-29 12:44 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240129124411.5ED9E3858402@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).