fork bug in cygheap

marco atzeri marco.atzeri@gmail.com
Wed Jun 14 14:48:41 GMT 2023


On Wed, Jun 14, 2023 at 2:20 PM Paolo via Cygwin <cygwin@cygwin.com> wrote:
>
>   Hi all,
>
> I just found a bug (I think) in cygheap_fixup_in_child
> function (cygheap.cc).
> the effect is that, sometimes a command from a
> script ends with the following error message
>
> 0 [main] openssl (17784)
> child_copy: cygheap read copy failed, 0x0..0x8003D8538, done 0, windows
> pid 17784, Win32 error 299
>
> Digging a little bit in the code I found
> that commit_size in cygheap_fixup_in_child is wrongly calculated if the
> condition (child_proc_info->cygheap_max > (void *)
> CYGHEAP_STORAGE_INITIAL) is met.
>
> Currently, in that case, its value is
> evaluated as
>
> commit_size = allocsize
> (child_proc_info->cygheap_max);
>
> but I think this is wrong and it should
> be
>
> commit_size = allocsize (child_proc_info->cygheap_max) -
> CYGHEAP_STORAGE_LOW;
>
> The wrong value avoids the successful execution of
> the following second VirtualAlloc and the the error in child_copy
> function.
>
> I tried to recompile the cygwin dll with the above change and
> indeed the error disappears.
>
> I'm I correct?
> Paolo.
>

it looks like
https://cygwin.com/pipermail/cygwin-developers/2023-April/012620.html


More information about the Cygwin mailing list