delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/17/12:04:41

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 17 Feb 2010 18:04:29 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: a bug in a week old mmap
Message-ID: <20100217170429.GL5683@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <354754 DOT 66525 DOT qm AT web88302 DOT mail DOT re4 DOT yahoo DOT com>
MIME-Version: 1.0
In-Reply-To: <354754.66525.qm@web88302.mail.re4.yahoo.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Feb 17 07:51, Ilguiz Latypov wrote:
> 
> $ gdb --args perl -i -pe 's/\r//g' f.txt
> GNU gdb 6.8.0.20080328-cvs (cygwin-special)
> Copyright (C) 2008 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> and "show warranty" for details.
> This GDB was configured as "i686-pc-cygwin"...
> (gdb) file /usr/bin/perl
> Load new symbol table from "/usr/bin/perl"? (y or n) y
> Reading symbols from /usr/bin/perl...done.
> (gdb) run
> Starting program: /usr/bin/perl -i -pe s/\\r//g f.txt
> [New thread 4136.0x1514]
> [New thread 4136.0x1214]
> 
> Program received signal SIGSEGV, Segmentation fault.
> mmap_is_attached_or_noreserve (addr=0x4, len=1) at /c/work/cygwin/src/winsup/cygwin/mmap.cc:691
> 691       LIST_LOCK ();
> Current language:  auto; currently c++
> (gdb) bt
> #0  mmap_is_attached_or_noreserve (addr=0x4, len=1) at /c/work/cygwin/src/winsup/cygwin/mmap.cc:691
> #1  0x610296dc in _cygtls::handle_exceptions (e=0x33208, frame=0x82ce68, in=0x33224) at /c/work/cygwin/src/winsup/cygwin/exceptions.cc:559
> #2  0x7c9032a8 in ntdll!RtlCopyOutOfProcessMemoryStreamTo () from /c/WINDOWS/system32/ntdll.dll
> #3  0x00033208 in ?? ()
> #4  0x0082ce68 in ?? ()
> #5  0x00033224 in ?? ()
> #6  0x000331dc in ?? ()
> #7  0x0082ce68 in ?? ()
> #8  0x7c9032bc in ntdll!RtlCopyOutOfProcessMemoryStreamTo () from /c/WINDOWS/system32/ntdll.dll
> #9  0x0082ce68 in ?? ()
> #10 0x000331f0 in ?? ()
> #11 0x7c90327a in ntdll!RtlCopyOutOfProcessMemoryStreamTo () from /c/WINDOWS/system32/ntdll.dll
> #12 0x00033208 in ?? ()
> #13 0x0082ce68 in ?? ()
> #14 0x00033224 in ?? ()
> #15 0x000331dc in ?? ()
> #16 0x61028d70 in sigignore () at /c/work/cygwin/src/winsup/cygwin/exceptions.cc:1114
> Backtrace stopped: previous frame inner to this frame (corrupt stack?)
> (gdb) 

I tested this on a 500K file input file with DOS line endings and it
works fine for me.  In the above case, mmap_is_attached_or_noreserve()
gets already called as result of a previous SEGV, but it's not possible
to see the cause in the above backtrace.  The fact that it eventually
crashes in mmap_is_attached_or_noreserve, line 691 points to overwritten
memory due to some unknown reason.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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

- Raw text -


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