[Gc] Re: Powerpc/m68k issue running test_stack

Thorsten Glaser tg at mirbsd.de
Tue Nov 20 12:42:54 PST 2012


Dixi quod…

> Ivan Maidanski dixit:
> 
> >1. Could you please verify that the problem exists in the recent 
libatomic_ops-7.2:
> 
> Yes, it does (see attached file).

By the way:

root at aranym:~/libatomic_ops-7_2 # tests/
test_stack                                                              
Segmentation fault 
139|root at aranym:~/libatomic_ops-7_2 # gdb tests/
test_stack                                                      
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 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 "m68k-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /root/libatomic_ops-7_2/tests/test_stack...done.
(gdb) r
Starting program: /root/libatomic_ops-7_2/tests/test_stack 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/m68k-linux-gnu/libthread_db.so.1".
[New Thread 0xc41664c0 (LWP 22160)]
[Thread 0xc41664c0 (LWP 22160) exited]

Program received signal SIGSEGV, Segmentation fault.
0x80000bbc in add_elements (n=741812669) at test_stack.c:66
66        add_elements(n-1);
(gdb) bt
#0  0x80000bbc in add_elements (n=741812669) at test_stack.c:66
#1  0x80000bc2 in add_elements (n=741812670) at test_stack.c:66
#2  0x80000bc2 in add_elements (n=741812671) at test_stack.c:66
#3  0x80000bc2 in add_elements (n=741812672) at test_stack.c:66
#4  0x80000bc2 in add_elements (n=741812673) at test_stack.c:66
#5  0x80000bc2 in add_elements (n=741812674) at test_stack.c:66
#6  0x80000bc2 in add_elements (n=741812675) at test_stack.c:66
#7  0x80000bc2 in add_elements (n=741812676) at test_stack.c:66
#8  0x80000bc2 in add_elements (n=741812677) at test_stack.c:66
[… this repeats … more than 2100 times…]

With debugging:

# ./
test_stack2
                                                                                                  
Debug: nthreads=1; list_length=1
Debug: nthreads=2; list_length=3
Debug: nthreads=-1073636204; list_length=746006802
Segmentation fault 

That is:
  199     for (nthreads = 1; nthreads <= max_nthreads; ++nthreads)
  200       {
  201         int i;
  202         pthread_t thread[MAX_NTHREADS];
  203         int list_length = nthreads*(nthreads+1)/2;
  204         long long start_time;
  205         list_element * le;
  206 
  207 /* + */ printf("Debug: nthreads=%d; list_length=%d\n", nthreads, 
list_length);
  208         add_elements(list_length);
  209 #       ifdef VERBOSE

That number is actually C0019C94, constant across runs. According to /proc/$$/
maps this is:
c0000000-c0019000 r-xp 00000000 fe:81 1030344    /lib/m68k-linux-gnu/ld-2.13.so
c0019000-c001b000 rw-p 00000000 00:00 0 
c001b000-c001c000 r--p 00019000 fe:81 1030344    /lib/m68k-linux-gnu/ld-2.13.so

So, maybe something with the dynamic linker?

Anyway, an idea why/how nthreads could be corrupted here?

bye,
//mirabilos (please Cc me, I’m not on the list)



More information about the Gc mailing list