Menu

#212 Segfault in xextract with long filenames

Both
closed-fixed
None
5
2014-06-27
2012-09-20
No

The Sage buildbot ends up building ATLAS in directories with > 128 characters, which leads to a segfault in xextract:

--------------------------------------------
OUTPUT OF system():
make[7]: Entering directory `/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/tune/blas/gemv'
cd /var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/bin ; make xextract
make[8]: Entering directory `/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/bin'
/usr/bin/gcc -DL2SIZE=4194304 -I/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/include -I/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//include -I/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//include/contrib -DAdd_ -DF77_INTEGER=int -DStringSunStyle -DATL_OS_Linux -DATL_ARCH_x86SSE3 -DATL_CPUMHZ=3301 -DATL_SSE3 -DATL_SSE2 -DATL_SSE1 -DATL_GAS_x8632 -m32 -DATL_FULL_LAPACK -DATL_NCPU=4 -O -fomit-frame-pointer -fPIC -m32 -o xextract /var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//bin/extract.c
/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//bin/extract.c: In function ‘Extract’:
/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//bin/extract.c:3196:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘struct EXTENV *’ [-Wformat]
/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//bin/extract.c:3252:4: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘struct EXTENV *’ [-Wformat]
/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//bin/extract.c: In function ‘LnIsExtCmnd’:
/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//bin/extract.c:3566:16: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
make[8]: Leaving directory `/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/bin'
mkdir EXTDIR
/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/bin/xextract -b /var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/../src//tune/blas/gemv/atlas-l2g.base -langC \ order=clmajor rout=mvn_C nu=1 type=DREAL \ -def MU 8 -o EXTDIR/dmvn_C.c
make[7]: *** [dmvnext_C] Aborted (core dumped)
make[7]: Leaving directory `/var/lib/buildbot/build/sage/arando-1/arando_full/build/sage-5.4.beta2/spkg/build/atlas-3.10.0.p0/ATLAS-build/tune/blas/gemv'
--------------------------------------------

I've confirmed the issue in a debugger session where I ran a debug build of xextract with long arguments:

--------------------------------------------
(gdb) bt
#0 0xf7ffd430 in __kernel_vsyscall ()
#1 0x4212798f in raise () from /lib/libc.so.6
#2 0x421292d5 in abort () from /lib/libc.so.6
#3 0x4216802a in __libc_message () from /lib/libc.so.6
#4 0x4216ef12 in malloc_printerr () from /lib/libc.so.6
#5 0x42170068 in _int_free () from /lib/libc.so.6
#6 0x4214c006 in _IO_vfscanf_internal () from /lib/libc.so.6
#7 0x4215c592 in __isoc99_vsscanf () from /lib/libc.so.6
#8 0x4215c4df in __isoc99_sscanf () from /lib/libc.so.6
#9 0x080490db in Wstr2int (str=0xffffb290 "1 -1 + ", iptr=0xffffb0d8)
at /home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/ATLAS/build/..//bin/extract.c:473
#10 0x0804daf0 in icalc (EE=0xffffbb0c, line=0xffffb290 "1 -1 + ")
at /home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/ATLAS/build/..//bin/extract.c:2052
#11 0x08053195 in LnIsExtCmnd (EE=0xffffbb0c, line=0xffffbb54 "NUm1")
at /home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/ATLAS/build/..//bin/extract.c:3514
#12 0x080541a8 in HandleLine (EE=0xffffbb0c, line=0xffffbb54 "NUm1")
at /home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/ATLAS/build/..//bin/extract.c:3797
#13 0x08052435 in Extract (OldEnv=0x0, wp=0x8058008)
at /home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/ATLAS/build/..//bin/extract.c:3205
#14 0x080543fb in main (nargs=13, args=0xffffcc44)
at /home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/ATLAS/build/..//bin/extract.c:3840
(gdb) frame 10
#10 0x0804daf0 in icalc (EE=0xffffbb0c, line=0xffffb290 "1 -1 + ")
at /home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/ATLAS/build/..//bin/extract.c:2052
2052 i = Wstr2int(line, &istack[k]);
(gdb) print EE->FpIn.Fnam
$19 = "/home/vbraun/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/0123456789/01234"
--------------------------------------------

A patched extract.c with longer buffer sizes fixes this, for example the attached patch

Discussion

  • Volker Braun

    Volker Braun - 2012-09-20

    Patch that increases the size of buffers in extract.c

     
  • R. Clint Whaley

    R. Clint Whaley - 2012-10-09
    • assigned_to: nobody --> rwhaley
     
  • R. Clint Whaley

    R. Clint Whaley - 2012-10-09

    OK, didn't even think of extract dying on us (that is some oooold code).

    Thanks for the workaround, I've made the change to the developer basefiles, and you can continue to hand-patch it for yourself I guess.

    I'll leave this open on the bugs list so I remember to backpatch it for next stable update.

    Thanks,
    Clint

     
  • R. Clint Whaley

    R. Clint Whaley - 2012-10-30
    • milestone: 148062 -->
    • labels: 320139 -->
     
  • R. Clint Whaley

    R. Clint Whaley - 2013-10-03

    Change is made in basefiles, can close with release of 3.10.2

     
  • R. Clint Whaley

    R. Clint Whaley - 2014-06-27

    Fixed in stable as well. Closing, should be fixed in 3.10.2

     
  • R. Clint Whaley

    R. Clint Whaley - 2014-06-27
    • status: open --> closed-fixed
    • Group: --> Both
     

Log in to post a comment.