This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a bug in a week old mmap


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]