delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org CF8693858296 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1706532396; | |
bh=njh49F8wH75Ub720pSi0CU4T2NsaBwt7YCnlwzJ4X6Q=; | |
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
From; | |
b=jpaPoj57GX3jPm1ThbaCcTxnw5Rmp/PpUXV2FqrBOVmYIrxT0RCvQOVhUTcHGZkQ0 | |
iOGkYaYJy+PCYRKrRHe7TjkpVhGlW/cM6YYwwb1TM8tEJHuNHARXWNJAA2r7UPBV8T | |
kBT6SXPG27mP9zMVtr+hAGuOUYh7JpicBBvmBiNg= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 0FF6E3858CDA |
Date: | Mon, 29 Jan 2024 13:46:07 +0100 |
To: | Johnothan King <johnothanking AT protonmail DOT com> |
Subject: | Re: arc4random does not reseed after using fork() |
Message-ID: | <ZbeeD4HWuACHa7oo@calimero.vinschen.de> |
Mail-Followup-To: | Johnothan King <johnothanking AT protonmail DOT com>, |
"cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> | |
References: | <x8PnzmkfTwFWHzycWtf77_bBJe1x2N7PmpAW7BMJZpaLNO53DxbWHn8RSDcBifPVNdO7zsJ_vAfhEq1bbQvOIQ1Gpvc6vB_fvpp754sw1UQ=@protonmail.com> |
MIME-Version: | 1.0 |
In-Reply-To: | <x8PnzmkfTwFWHzycWtf77_bBJe1x2N7PmpAW7BMJZpaLNO53DxbWHn8RSDcBifPVNdO7zsJ_vAfhEq1bbQvOIQ1Gpvc6vB_fvpp754sw1UQ=@protonmail.com> |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.30 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | cygwin AT cygwin DOT com |
Cc: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com>, |
"cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> | |
Errors-To: | cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com> |
Hi Johnothan, On Jan 26 22:06, Johnothan King via Cygwin wrote: > Hello, > > 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: > > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > #include <sys/wait.h> > int main(void) > { > pid_t child = fork(); > if(child==0) > { > printf("%u %u %u\n", arc4random(), arc4random(), arc4random()); > return 0; > } > else if(child==-1) > return 1; > waitpid(child, NULL, 0); > printf("%u %u %u\n", arc4random(), arc4random(), arc4random()); > return 0; > } Thanks for the testcase. I fixed that for Cygwin 3.5. Please try the latest test release cygwin-3.5.0-0.617.g030a762535c1, which should be finished building in about an hour. Thanks, Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |