05-12-2009, 19:53
Hello,
I observe a strange behaviour of missfits, both versions 2.2.7 and 2.2.11.
When slicing a fits cube with missfits, compiled from source under ubuntu 9.04 with gcc 4.3.3, i run immediately into a memory leak (see below). Slicing the very same image with the same missfits compiled under gcc 4.2.4 (ubuntu 8.04) yields no problem. This is on a 64bit machines with Intel and AMD CPUs.
The problem disappears when running the 64bit precompiled rpm missfits. The same was just observed a few minutes ago by a third person on paranal on his 64bit machine. It crashes when self-compiled with gcc 4.3.3, but the 64bit rpm works.
However, on a 32bit AMD (ubuntu 9.04, gcc 4.3.3) the problem persists, either if compiled from source, or with the 32bit precompiled rpm.
Thus I think this is a "problem" with the c-compiler. Could this be related to the open() function or similar, which under gcc 4.3 is required to have a third argument, i.e. in xmemory.c
open(fname, O_RDWR | O_CREAT) must be replaced with
open(fname, O_RDWR | O_CREAT,0666)
However, i do not see such a all in the missfits source.
Here is what i get:
*************************************************************
/home/mischa> missfits test.fits -OUTFILE_TYPE SLICE
> WARNING: default.missfits not found, using internal defaults
----- MissFITS 2.2.11 started on 2009-05-12 at 20:27:36 with 1 thread
>
*** buffer overflow detected ***: missfits terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f411f846617]
/lib/libc.so.6[0x7f411f844d00]
/lib/libc.so.6[0x7f411f8442d9]
/lib/libc.so.6(_IO_default_xsputn+0x8e)[0x7f411f7c967e]
/lib/libc.so.6(_IO_vfprintf+0x12ae)[0x7f411f79e87e]
/lib/libc.so.6(__vsprintf_chk+0x9d)[0x7f411f84437d]
/lib/libc.so.6(__sprintf_chk+0x80)[0x7f411f8442c0]
./missfits_source[0x41799a]
./missfits_source[0x41816a]
./missfits_source[0x417255]
/lib/libc.so.6(__libc_start_main+0xf4)[0x7f411f7771c4]
./missfits_source[0x401d79]
======= Memory map: ========
00400000-00466000 r-xp 00000000 08:01 37250746 /home/mischa/missfits
00665000-00666000 r--p 00065000 08:01 37250746 /home/mischa/missfits
00666000-00698000 rw-p 00066000 08:01 37250746 /home/mischa/missfits
00698000-0130c000 rw-p 00698000 00:00 0 [heap]
7f411f54b000-7f411f558000 r-xp 00000000 08:01 9142284 /lib/libgcc_s.so.1
7f411f558000-7f411f758000 ---p 0000d000 08:01 9142284 /lib/libgcc_s.so.1
7f411f758000-7f411f759000 rw-p 0000d000 08:01 9142284 /lib/libgcc_s.so.1
7f411f759000-7f411f8b1000 r-xp 00000000 08:01 9142884 /lib/libc-2.7.so
7f411f8b1000-7f411fab1000 ---p 00158000 08:01 9142884 /lib/libc-2.7.so
7f411fab1000-7f411fab4000 r--p 00158000 08:01 9142884 /lib/libc-2.7.so
7f411fab4000-7f411fab6000 rw-p 0015b000 08:01 9142884 /lib/libc-2.7.so
7f411fab6000-7f411fabb000 rw-p 7f411fab6000 00:00 0
7f411fabb000-7f411fb3b000 r-xp 00000000 08:01 9142888 /lib/libm-2.7.so
7f411fb3b000-7f411fd3a000 ---p 00080000 08:01 9142888 /lib/libm-2.7.so
7f411fd3a000-7f411fd3c000 rw-p 0007f000 08:01 9142888 /lib/libm-2.7.so
7f411fd3c000-7f411fd59000 r-xp 00000000 08:01 9142341 /lib/ld-2.7.so
7f411ff3d000-7f411ff3f000 rw-p 7f411ff3d000 00:00 0
7f411ff54000-7f411ff59000 rw-p 7f411ff54000 00:00 0
7f411ff59000-7f411ff5b000 rw-p 0001d000 08:01 9142341 /lib/ld-2.7.so
7fff27f46000-7fff27f5b000 rw-p 7ffffffea000 00:00 0 [stack]
7fff27ffe000-7fff28000000 r-xp 7fff27ffe000 00:00 0 [vdso]
test.fits Abortedffffff601000 r-xp 00000000 00:00 0 [vsyscall]
*****************************************
running it through valgrind is a bit more informative:
*** buffer overflow detected ***: ./missfits_source terminated
==20458== Invalid read of size 8
==20458== at 0x4015EE4 (within /lib/ld-2.7.so)
==20458== by 0x400AB93: (within /lib/ld-2.7.so)
...
thank you for any input!
mischa
PS: I uploaded a test fits cube here:
http://www.astro.uni-bonn.de/~mischa/download/test.fits
I forgot to mention that I also tried to switch off the three optimisation flags in the Makefile to see if that remedies the situation, but the problem persists.
mischa
I observe a strange behaviour of missfits, both versions 2.2.7 and 2.2.11.
When slicing a fits cube with missfits, compiled from source under ubuntu 9.04 with gcc 4.3.3, i run immediately into a memory leak (see below). Slicing the very same image with the same missfits compiled under gcc 4.2.4 (ubuntu 8.04) yields no problem. This is on a 64bit machines with Intel and AMD CPUs.
The problem disappears when running the 64bit precompiled rpm missfits. The same was just observed a few minutes ago by a third person on paranal on his 64bit machine. It crashes when self-compiled with gcc 4.3.3, but the 64bit rpm works.
However, on a 32bit AMD (ubuntu 9.04, gcc 4.3.3) the problem persists, either if compiled from source, or with the 32bit precompiled rpm.
Thus I think this is a "problem" with the c-compiler. Could this be related to the open() function or similar, which under gcc 4.3 is required to have a third argument, i.e. in xmemory.c
open(fname, O_RDWR | O_CREAT) must be replaced with
open(fname, O_RDWR | O_CREAT,0666)
However, i do not see such a all in the missfits source.
Here is what i get:
*************************************************************
/home/mischa> missfits test.fits -OUTFILE_TYPE SLICE
> WARNING: default.missfits not found, using internal defaults
----- MissFITS 2.2.11 started on 2009-05-12 at 20:27:36 with 1 thread
>
*** buffer overflow detected ***: missfits terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f411f846617]
/lib/libc.so.6[0x7f411f844d00]
/lib/libc.so.6[0x7f411f8442d9]
/lib/libc.so.6(_IO_default_xsputn+0x8e)[0x7f411f7c967e]
/lib/libc.so.6(_IO_vfprintf+0x12ae)[0x7f411f79e87e]
/lib/libc.so.6(__vsprintf_chk+0x9d)[0x7f411f84437d]
/lib/libc.so.6(__sprintf_chk+0x80)[0x7f411f8442c0]
./missfits_source[0x41799a]
./missfits_source[0x41816a]
./missfits_source[0x417255]
/lib/libc.so.6(__libc_start_main+0xf4)[0x7f411f7771c4]
./missfits_source[0x401d79]
======= Memory map: ========
00400000-00466000 r-xp 00000000 08:01 37250746 /home/mischa/missfits
00665000-00666000 r--p 00065000 08:01 37250746 /home/mischa/missfits
00666000-00698000 rw-p 00066000 08:01 37250746 /home/mischa/missfits
00698000-0130c000 rw-p 00698000 00:00 0 [heap]
7f411f54b000-7f411f558000 r-xp 00000000 08:01 9142284 /lib/libgcc_s.so.1
7f411f558000-7f411f758000 ---p 0000d000 08:01 9142284 /lib/libgcc_s.so.1
7f411f758000-7f411f759000 rw-p 0000d000 08:01 9142284 /lib/libgcc_s.so.1
7f411f759000-7f411f8b1000 r-xp 00000000 08:01 9142884 /lib/libc-2.7.so
7f411f8b1000-7f411fab1000 ---p 00158000 08:01 9142884 /lib/libc-2.7.so
7f411fab1000-7f411fab4000 r--p 00158000 08:01 9142884 /lib/libc-2.7.so
7f411fab4000-7f411fab6000 rw-p 0015b000 08:01 9142884 /lib/libc-2.7.so
7f411fab6000-7f411fabb000 rw-p 7f411fab6000 00:00 0
7f411fabb000-7f411fb3b000 r-xp 00000000 08:01 9142888 /lib/libm-2.7.so
7f411fb3b000-7f411fd3a000 ---p 00080000 08:01 9142888 /lib/libm-2.7.so
7f411fd3a000-7f411fd3c000 rw-p 0007f000 08:01 9142888 /lib/libm-2.7.so
7f411fd3c000-7f411fd59000 r-xp 00000000 08:01 9142341 /lib/ld-2.7.so
7f411ff3d000-7f411ff3f000 rw-p 7f411ff3d000 00:00 0
7f411ff54000-7f411ff59000 rw-p 7f411ff54000 00:00 0
7f411ff59000-7f411ff5b000 rw-p 0001d000 08:01 9142341 /lib/ld-2.7.so
7fff27f46000-7fff27f5b000 rw-p 7ffffffea000 00:00 0 [stack]
7fff27ffe000-7fff28000000 r-xp 7fff27ffe000 00:00 0 [vdso]
test.fits Abortedffffff601000 r-xp 00000000 00:00 0 [vsyscall]
*****************************************
running it through valgrind is a bit more informative:
*** buffer overflow detected ***: ./missfits_source terminated
==20458== Invalid read of size 8
==20458== at 0x4015EE4 (within /lib/ld-2.7.so)
==20458== by 0x400AB93: (within /lib/ld-2.7.so)
...
thank you for any input!
mischa
PS: I uploaded a test fits cube here:
http://www.astro.uni-bonn.de/~mischa/download/test.fits
I forgot to mention that I also tried to switch off the three optimisation flags in the Makefile to see if that remedies the situation, but the problem persists.
mischa
