public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* fork bug in cygheap
@ 2023-06-14 12:20 paolo.zambotti
  2023-06-14 14:48 ` marco atzeri
  0 siblings, 1 reply; 2+ messages in thread
From: paolo.zambotti @ 2023-06-14 12:20 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1299 bytes --]

  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. 



VOUCHER CONNETTIVITÀ per P.IVA e PMI: internet a canone 0 per 48 mesi. ATTIVA ORA
 https://casa.tiscali.it/promo/?u=https://promozioni.tiscali.it/voucher_business/?r=TS00000A00025&dm=link&p=tiscali&utm_source=tiscali&utm_medium=link&utm_campaign=voucherbusiness&wt_np=tiscali.link.footermail.voucherbusiness.btb..


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: fork bug in cygheap
  2023-06-14 12:20 fork bug in cygheap paolo.zambotti
@ 2023-06-14 14:48 ` marco atzeri
  0 siblings, 0 replies; 2+ messages in thread
From: marco atzeri @ 2023-06-14 14:48 UTC (permalink / raw)
  To: paolo.zambotti; +Cc: cygwin

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-14 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 12:20 fork bug in cygheap paolo.zambotti
2023-06-14 14:48 ` marco atzeri

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).