www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/09/06/21:04:53

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Date: Thu, 6 Sep 2001 21:04:58 -0400
From: Christopher Faylor <cgf AT redhat DOT com>
To: cygwin-developers AT cygwin DOT com
Subject: Re: Figured out how to reproduce vfork/rsync bug! (proposed fix)
Message-ID: <20010906210458.A8242@redhat.com>
Reply-To: cygwin-developers AT cygwin DOT com
Mail-Followup-To: cygwin-developers AT cygwin DOT com
References: <20010906142836 DOT 7323 DOT qmail AT lizard DOT curl DOT com> <20010906164756 DOT 19885 DOT qmail AT lizard DOT curl DOT com> <20010906203947 DOT Q537 AT cygbert DOT vinschen DOT de> <20010906184747 DOT 20476 DOT qmail AT lizard DOT curl DOT com> <20010906185326 DOT 20521 DOT qmail AT lizard DOT curl DOT com> <20010906161343 DOT A4873 AT redhat DOT com>
Mime-Version: 1.0
In-Reply-To: <20010906161343.A4873@redhat.com>
User-Agent: Mutt/1.3.21i

On Thu, Sep 06, 2001 at 04:13:43PM -0400, Christopher Faylor wrote:
>On Thu, Sep 06, 2001 at 02:53:26PM -0400, Jonathan Kamens wrote:
>>I think I'll try the patch that cgf just sent out and see if it makes
>>this problem go away.
>>
>>It will be very amusing if we discover that the bug I'm encountering
>>is the same as Egor's.
>
>Try this.

I think this is the actual fix.  I noticed this about four hours ago but
concluded that there just HAD to be something wrong with the cygheap
stuff since that is what I had previously been working on.

I believe that cygheap was not the problem in this case.  What is actually
happening is that the it is assumed prot_info_ptr is a zero filled array --
that is not the case when you set that long environment variable.  The
environment variable space was freed and then reused by the cmalloc
in fhandler_socket::fhandler_socket.  So, when you look at the buffer
it actually contains the contents of the environment variable.  That is
acceptable behavior for cmalloc, of course but it looks like the
subsequent code in fhandler_socket.cc needs assumes that this buffer
is zeroed.

Anyway, I checked in the fix below.  It seems to resolve the problems.
On further investigation, my previous fix was bogus.  It just resulted
in never freeing space for the cygwin environment, which is incorrect.

Jonathan, Corinna, could you try the CVS version of cygwin and see
if it fixes the problem?

cgf

Index: fhandler_socket.cc
===================================================================
RCS file: /cvs/uberbaum/winsup/cygwin/fhandler_socket.cc,v
retrieving revision 1.19
retrieving revision 1.20
diff -p -r1.19 -r1.20
*** fhandler_socket.cc	2001/09/06 04:41:59	1.19
--- fhandler_socket.cc	2001/09/07 00:07:49	1.20
*************** fhandler_socket::fhandler_socket (const 
*** 45,51 ****
  {
    set_cb (sizeof *this);
    set_need_fork_fixup ();
!   prot_info_ptr = (LPWSAPROTOCOL_INFOA) cmalloc (HEAP_BUF,
  					         sizeof (WSAPROTOCOL_INFOA));
  }
  
--- 45,51 ----
  {
    set_cb (sizeof *this);
    set_need_fork_fixup ();
!   prot_info_ptr = (LPWSAPROTOCOL_INFOA) ccalloc (HEAP_BUF, 1,
  					         sizeof (WSAPROTOCOL_INFOA));
  }
  

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019