delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/16/11:30:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 16 Mar 2005 11:29:49 -0500
From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: autossh crash with 20050314 and earlier cygwin1.dll [autossh maintainer please note]
Message-ID: <20050316162949.GA14571@trixie.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mime-Version: 1.0
User-Agent: Mutt/1.5.6i

On Tue, Mar 15, 2005 at 08:20:28PM -0800, David Rothenberger wrote:
>I've been having some problems with autossh crashing with 1.5.13 and
>later snapshots. These problems did not occur with 1.5.12. (The problem
>may be related to the one reported by Andrew Schulman in
><http://sourceware.org/ml/cygwin/2005-03/msg00410.html>.)

I managed to duplicate this but, in duplicating the problem, I was
surprised to find out that my debugging symbols were all gone when I
went to investigate the problem in gdb.

The reason the symbols were gone is that I was using the released
version of 1.5.13.  Doh, on me but this indicates that is not just a
snapshot problem.

Once I installed a CVS-version of cygwin, I quickly discovered that, as
Dave Korn unsurprisingly and correctly diagnosed, this is a heap
corruption problem.  I'd noted that the stack trace which was previously
provided looked "funny" and I couldn't figure out how cygwin could get
in the state indicated by the stack trace.  Well, heap corruption is what
caused the funniness.

The problem is that autossh is freeing the return value of
gethostbyname().  I can't find any reference which says that is a
acceptable thing to do.  It certainly screws up cygwin, and I can't
think of any way to avoid having it screw up cygwin.  Maybe it won't
screw up other systems since they may not malloc the return value of
gethostbyname.  I dunno.

I haven't run an exhaustive test, but the patch below seems to fix this
problem.

Could the autossh maintainer look into getting this applied upstream?

cgf

--- autossh.c.orig	2004-08-07 00:07:11.000000000 -0400
+++ autossh.c	2005-03-16 11:17:43.000000000 -0500
@@ -1034,15 +1034,14 @@
 	if ((h = gethostbyname(host)) == NULL)
 		xerrlog(LOG_ERR, "%s: %s", host, hstrerror(h_errno));
 
 	resp->sin_family = h->h_addrtype;
 	resp->sin_port = htons(atoi(port));
 	resp->sin_addr = *((struct in_addr *) h->h_addr_list[0]);
 
-	free(h);
 	return;
 }
 
 /*
  * Open connection we're writing to.
  */
 int


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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