public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* sort utility goes berzerk (x86_64) -- output from gdb
@ 2017-12-01 17:31 Houder
  0 siblings, 0 replies; only message in thread
From: Houder @ 2017-12-01 17:31 UTC (permalink / raw)
  To: cygwin

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

L.S.,

Reference:

     https://cygwin.com/ml/cygwin/2017-11/msg00251.html

Second attempt ... as far as I can tell Cygwin causes a segment
violation in ntdll.dll ...

As written, I have stripped my system of all software, that I
easily remove ...

I executed 'sfc /scannow' from an elevated DOS prompt (x86_64).

Next I downloaded gdb, and debuginfo for coreutils and cygwin.

For both x86 and x86_64 ...

As mentioned, my system is Windows 7 (8 cores) ...

64-@@ uname -a
CYGWIN_NT-6.1 Seven 2.9.0(0.318/5/3) 2017-09-12 10:18 x86_64 Cygwin

@@ uname -a
CYGWIN_NT-6.1-WOW Seven 2.9.0(0.318/5/3) 2017-09-12 10:41 i686 Cygwin

Tests carried out (both on x86 and x86_64):

  1. sort tt | /usr/bin/less
  2. LC_COLLATE=C sort tt | /usr/bin/less
  3. trap '' PIPE; sort tt | /usr/bin/less

Attached:

a. gdb-out_x64.txt <==== FAILURE
b. gdb-out2_x64.txt
c. gdb-out3_x64.txt

d. gdb-out_x86.txt
e. gdb-out2_x86.txt
f. gdb-out3_x86.txt

=====

[-- Attachment #2: gdb-out_x64.txt --]
[-- Type: text/plain, Size: 6165 bytes --]

...

sort tt | /usr/bin/less
process attached to gdb using -p <Cygwin-pid>
Terminate less with 'q' while process is running

64-@@ ./gdb.sh 5180
...

Attaching to process 5140
[New Thread 5140.0xd80]
[New Thread 5140.0xc08]
[New Thread 5140.0x1a2c]
Reading symbols from /usr/bin/sort.exe...Reading symbols from /usr/lib/debug//usr/bin/sort.exe.dbg...done.
done.
0x0000000076f6afb1 in ntdll!DbgBreakPoint () from /drv/c/Windows/SYSTEM32/ntdll.dll
(gdb) cont
Continuing.
[Thread 5140.0x1a2c exited with code 0]

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 5140.0xd80]
0x00000001004026f6 in write_line (line=0xffffb9d0, fp=0x134, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x00000001004026f6 in write_line (line=0xffffb9d0, fp=0x134, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0x00000000ffffb9cc in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) cont
Continuing.

Program received signal SIGPIPE, Broken pipe.
0x00000001004026f6 in write_line (line=0xffffb520, fp=0x134, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x00000001004026f6 in write_line (line=0xffffb520, fp=0x134, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0x00000000ffffb51c in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) cont
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x0000000076f385fd in ntdll!RtlUnwindEx () from /drv/c/Windows/SYSTEM32/ntdll.dll
(gdb) bt
#0  0x0000000076f385fd in ntdll!RtlUnwindEx () from /drv/c/Windows/SYSTEM32/ntdll.dll
#1  0x000000018005eba3 in __unwind_single_frame (ctx=0xffffde50) at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/exceptions.cc:287
#2  _cygtls::call_signal_handler (this=0xffffce00) at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/exceptions.cc:1660
#3  0x00000001801211ad in sig_send (p=<optimized out>, p@entry=0x180010000, si=..., tls=tls@entry=0x0)
    at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/sigproc.cc:735
#4  0x000000018011db41 in _pinfo::kill (this=0x180010000, si=...) at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/signal.cc:249
#5  0x000000018011dfe9 in kill0 (pid=5180, si=...) at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/signal.cc:300
#6  0x000000018011e1ba in kill (sig=13, pid=<optimized out>) at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/signal.cc:309
#7  raise (sig=sig@entry=13) at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/signal.cc:285
#8  0x00000001800676c9 in fhandler_base_overlapped::wait_overlapped (this=this@entry=0x1802fde40, inres=<optimized out>,
    writing=writing@entry=true, bytes=bytes@entry=0xffffbe6c, nonblocking=false, len=65536)
    at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/fhandler.cc:2035
#9  0x0000000180067c31 in fhandler_base_overlapped::raw_write (this=0x1802fde40, ptr=0x600039b00, len=65536)
    at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/fhandler.cc:2141
#10 0x0000000180062426 in fhandler_base::write (this=0x1802fde40, ptr=0x600039b00, len=65536)
    at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/fhandler.cc:852
#11 0x0000000180131bd6 in write (fd=1, ptr=0x600039b00, len=65536) at /usr/src/debug/cygwin-2.9.0-3/winsup/cygwin/syscalls.cc:1232
#12 0x00000001801c4033 in _write_r (ptr=0xffffd680, fd=<optimized out>, buf=<optimized out>, cnt=<optimized out>)
    at /usr/src/debug/cygwin-2.9.0-3/newlib/libc/reent/writer.c:58
#13 0x000000018017fb48 in __sflush_r (ptr=ptr@entry=0xffffd680, fp=fp@entry=0x1801fc870 <reent_data+1520>)
    at /usr/src/debug/cygwin-2.9.0-3/newlib/libc/stdio/fflush.c:225
#14 0x000000018017fceb in _fflush_r (ptr=ptr@entry=0xffffd680, fp=fp@entry=0x1801fc870 <reent_data+1520>)
    at /usr/src/debug/cygwin-2.9.0-3/newlib/libc/stdio/fflush.c:281
#15 0x0000000180185471 in __sfvwrite_r (ptr=ptr@entry=0xffffd680, fp=fp@entry=0x1801fc870 <reent_data+1520>, uio=uio@entry=0xffffc5c0)
    at /usr/src/debug/cygwin-2.9.0-3/newlib/libc/stdio/fvwrite.c:190
#16 0x0000000180185a49 in _fwrite_unlocked_r (ptr=0xffffd680, buf=<optimized out>, size=1, count=26, fp=0x1801fc870 <reent_data+1520>)
    at /usr/src/debug/cygwin-2.9.0-3/newlib/libc/stdio/fwrite.c:170
#17 0x0000000180185aaa in fwrite_unlocked (buf=<optimized out>, size=<optimized out>, count=<optimized out>, fp=<optimized out>)
    at /usr/src/debug/cygwin-2.9.0-3/newlib/libc/stdio/fwrite.c:211
#18 0x00000001801197eb in _sigfe () at sigfe.s:35
#19 0x00000001004026f6 in write_line (line=0x6fffffb6910, fp=fp@entry=0x1801fc870 <reent_data+1520>, output_file=0x0)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#20 0x0000000100403bf5 in write_unique (line=<optimized out>, tfp=tfp@entry=0x1801fc870 <reent_data+1520>,
    temp_output=temp_output@entry=0x0) at /usr/src/debug/coreutils-8.26-2/src/sort.c:3422
#21 0x0000000100405319 in mergelines_node (temp_output=0x0, tfp=0x1801fc870 <reent_data+1520>, total_lines=8150, node=0x6000390a0)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:3485
#22 merge_loop (temp_output=0x0, tfp=0x1801fc870 <reent_data+1520>, total_lines=8150, queue=0xffffc9d0)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:3553
#23 sortlines (lines=lines@entry=0x6ffffff1a50, nthreads=nthreads@entry=8, total_lines=8150, node=node@entry=0x6000390a0,
    queue=queue@entry=0xffffc9d0, tfp=0x1801fc870 <reent_data+1520>, temp_output=temp_output@entry=0x0)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:3670
#24 0x00000001004103e0 in sort (nthreads=8, output_file=0x0, nfiles=<optimized out>, files=0x600000948)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:3976
#25 main (argc=2, argv=0xffffcc50) at /usr/src/debug/coreutils-8.26-2/src/sort.c:4770
(gdb) cont
Continuing.
[Inferior 1 (process 5140) exited with code 01] <==== as result of taskkill /f /im sort.exe
(gdb) quit
64-@@ 

=====

[-- Attachment #3: gdb-out2_x64.txt --]
[-- Type: text/plain, Size: 1865 bytes --]

...

LC_COLLATE=C sort tt | /usr/bin/less
process attached to gdb using -p <Cygwin-pid>
Terminate less with 'q' while process is running

64-@@ ./gdb.sh 7036
...

Attaching to process 6888
[New Thread 6888.0x1ae4]
[New Thread 6888.0x1ad4]
[New Thread 6888.0x1630]
Reading symbols from /usr/bin/sort.exe...Reading symbols from /usr/lib/debug//usr/bin/sort.exe.dbg...done.
done.
0x0000000076f6afb1 in ntdll!DbgBreakPoint () from /drv/c/Windows/SYSTEM32/ntdll.dll
(gdb) cont
Continuing.
[Thread 6888.0x1630 exited with code 0]

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 6888.0x1ae4]
0x00000001004026f6 in write_line (line=0xffffb9d0, fp=0x130, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x00000001004026f6 in write_line (line=0xffffb9d0, fp=0x130, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0x00000000ffffb9cc in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) cont
Continuing.

Program received signal SIGPIPE, Broken pipe.
0x00000001004026f6 in write_line (line=0xffffb520, fp=0x130, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x00000001004026f6 in write_line (line=0xffffb520, fp=0x130, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0x00000000ffffb51c in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) cont
Continuing.
[Inferior 1 (process 6888) exited with code 015] <==== NOT killed by me
(gdb) quit
64-@@ 

=====

[-- Attachment #4: gdb-out3_x64.txt --]
[-- Type: text/plain, Size: 1376 bytes --]

...

64-@@ trap '' PIPE
64-@@ trap -p
trap -- '' SIGPIPE
64-@@ sort tt | /usr/bin/less
process attached to gdb using -p <Cygwin-pid>
Terminate less with 'q' while process is running
sort: write failed: 'standard output': Broken pipe
sort: write error

64-@@ ./gdb.sh 6316
...

Attaching to process 6372
[New Thread 6372.0x1514]
[New Thread 6372.0x13c4]
[New Thread 6372.0x1160]
Reading symbols from /usr/bin/sort.exe...Reading symbols from /usr/lib/debug//usr/bin/sort.exe.dbg...done.
done.
0x0000000076f6afb1 in ntdll!DbgBreakPoint () from /drv/c/Windows/SYSTEM32/ntdll.dll
(gdb) cont
Continuing.
[Thread 6372.0x1160 exited with code 0]

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 6372.0x1514]
0x00000001004026f6 in write_line (line=0xffffb9d0, fp=0x134, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x00000001004026f6 in write_line (line=0xffffb9d0, fp=0x134, output_file=0xb0 <error: Cannot access memory at address 0xb0>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0x00000000ffffb9cc in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) cont
Continuing.
[Inferior 1 (process 6372) exited with code 01000] <==== NOT killed by me
(gdb) quit
64-@@ 

=====

[-- Attachment #5: gdb-out_x86.txt --]
[-- Type: text/plain, Size: 1712 bytes --]

...

sort tt | /usr/bin/less
process attached to gdb using -p <Cygwin-pid>
Terminate less with 'q' while process is running

@@ ./gdb.sh 5664
...

Attaching to process 2112
[New Thread 2112.0x15b4]
[New Thread 2112.0x16b8]
[New Thread 2112.0xd88]
Reading symbols from /usr/bin/sort.exe...Reading symbols from /usr/lib/debug//usr/bin/sort.exe.dbg...done.
done.
0x7711000d in ntdll!DbgBreakPoint () from /drv/c/Windows/SysWOW64/ntdll.dll
(gdb) cont
Continuing.
[Thread 2112.0xd88 exited with code 0]

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 2112.0x15b4]
0x0040273f in write_line (line=0x14c, fp=0x28be38, output_file=0x6ae9759b <error: Cannot access memory at address 0x6ae9759b>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x0040273f in write_line (line=0x14c, fp=0x28be38, output_file=0x6ae9759b <error: Cannot access memory at address 0x6ae9759b>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0xffffffff in ?? ()
#2  0x00000000 in ?? ()
(gdb) cont
Continuing.

Program received signal SIGPIPE, Broken pipe.
0x0040273f in write_line (line=0x14c, fp=0x28bb58, output_file=0x6ae970bb <error: Cannot access memory at address 0x6ae970bb>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x0040273f in write_line (line=0x14c, fp=0x28bb58, output_file=0x6ae970bb <error: Cannot access memory at address 0x6ae970bb>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0xffffffff in ?? ()
#2  0x00000000 in ?? ()
(gdb) cont
Continuing.
[Inferior 1 (process 2112) exited with code 015]
(gdb) quit
@@ 

======

[-- Attachment #6: gdb-out2_x86.txt --]
[-- Type: text/plain, Size: 1724 bytes --]

...

LC_LOCCATE=C sort tt | /usr/bin/less
process attached to gdb using -p <Cygwin-pid>
Terminate less with 'q' while process is running

@@ ./gdb.sh 5704
...

Attaching to process 1576
[New Thread 1576.0xf30]
[New Thread 1576.0x14d4]
[New Thread 1576.0x1118]
Reading symbols from /usr/bin/sort.exe...Reading symbols from /usr/lib/debug//usr/bin/sort.exe.dbg...done.
done.
0x7711000d in ntdll!DbgBreakPoint () from /drv/c/Windows/SysWOW64/ntdll.dll
(gdb) cont
Continuing.
[Thread 1576.0x1118 exited with code 0]

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 1576.0xf30]
0x0040273f in write_line (line=0x148, fp=0x28be38, output_file=0xc5d665ee <error: Cannot access memory at address 0xc5d665ee>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x0040273f in write_line (line=0x148, fp=0x28be38, output_file=0xc5d665ee <error: Cannot access memory at address 0xc5d665ee>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0xffffffff in ?? ()
#2  0x00000000 in ?? ()
(gdb) cont
Continuing.

Program received signal SIGPIPE, Broken pipe.
0x0040273f in write_line (line=0x148, fp=0x28bb58, output_file=0xc5d660ce <error: Cannot access memory at address 0xc5d660ce>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x0040273f in write_line (line=0x148, fp=0x28bb58, output_file=0xc5d660ce <error: Cannot access memory at address 0xc5d660ce>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0xffffffff in ?? ()
#2  0x00000000 in ?? ()
(gdb) cont
Continuing.
[Inferior 1 (process 1576) exited with code 015]
(gdb) quit
@@ 

=====

[-- Attachment #7: gdb-out3_x86.txt --]
[-- Type: text/plain, Size: 1279 bytes --]

...

@@ trap '' PIPE
@@ trap -p
trap -- '' SIGPIPE
@@ sort tt | /usr/bin/less
process attached to gdb using -p <Cygwin-pid>
Terminate less with 'q' while process is running
sort: write failed: 'standard output': Broken pipe
sort: write error

@@ ./gdb.sh 6056
...

Attaching to process 5628
[New Thread 5628.0x14b0]
[New Thread 5628.0x1518]
[New Thread 5628.0x1134]
Reading symbols from /usr/bin/sort.exe...Reading symbols from /usr/lib/debug//usr/bin/sort.exe.dbg...done.
done.
0x7711000d in ntdll!DbgBreakPoint () from /drv/c/Windows/SysWOW64/ntdll.dll
(gdb) cont
Continuing.
[Thread 5628.0x1134 exited with code 0]

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 5628.0x14b0]
0x0040273f in write_line (line=0x14c, fp=0x28be38, output_file=0x6b17ccd6 <error: Cannot access memory at address 0x6b17ccd6>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
2792          if (fwrite (buf, 1, n_bytes, fp) != n_bytes)
(gdb) bt
#0  0x0040273f in write_line (line=0x14c, fp=0x28be38, output_file=0x6b17ccd6 <error: Cannot access memory at address 0x6b17ccd6>)
    at /usr/src/debug/coreutils-8.26-2/src/sort.c:2792
#1  0xffffffff in ?? ()
#2  0x00000000 in ?? ()
(gdb) cont
Continuing.
[Inferior 1 (process 5628) exited with code 01000]
(gdb) quit
@@ 

=====

[-- Attachment #8: Type: text/plain, Size: 219 bytes --]


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-12-01 17:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01 17:31 sort utility goes berzerk (x86_64) -- output from gdb Houder

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