Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
missfits coredumps when compiled with gcc 4.3.3
05-12-2009, 19:53 (This post was last modified: 05-12-2009 19:57 by Mischa Schirmer.)
Post: #1
missfits coredumps when compiled with gcc 4.3.3
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
Find all posts by this user
Quote this message in a reply
05-28-2009, 11:32
Post: #2
RE: missfits coredumps when compiled with gcc 4.3.3
Hello Misha,
thanks for your detailed report.
I fixed an allocation problem in the code, but I have no way (right now) to produce 32bit rpm.
May you test the behaviour of the last svn version with gcc 4.3.3?

Thank you very much,
Chiara.
Find all posts by this user
Quote this message in a reply
06-01-2009, 10:04
Post: #3
RE: missfits coredumps when compiled with gcc 4.3.3
Hello Mischa,
I finally produced a 32-bit rpm for the svn missfits version.
The compressed package is attached to this post.
I tested it on 32-bit Fedora10 system and I have no core dump... but the previous version also did not crash on Fedora10...

If you want to test this rpm on 32-bit Ubuntu systems....
Thanks a lot,
Chiara.


.gz  missfits-2.2.11b-1.i386.rpm.gz (Size: 252.57 KB / Downloads: 763)
Find all posts by this user
Quote this message in a reply
06-02-2009, 18:03
Post: #4
RE: missfits coredumps when compiled with gcc 4.3.3
Dear Chiara,

I compiled the latest version from svn (trunk.59) and I still run into the same problem (see below). This is with gcc 4.3.3 under 64bit Ubuntu 9.04. At the moment I don't have a 32bit machine available. In any case I could not extract the binary from the rpm you linked. I get everything else, but not the executable. Probably I am doing something wrong here.

(http://with http://www.astro.uni-bonn.de/~mischa/dow...cube.fits)


The error with scn trunk.59 gcc 4.3.3, 64bit:

/home/mischa/down/trunk.r59/bin/missfits cube.fits -OUTFILE_TYPE SLICE

> WARNING: default.missfits not found, using internal defaults

----- MissFITS 2.2.11 started on 2009-06-02 at 18:47:58 with 1 thread

>
*** buffer overflow detected ***: /home/mischa/down/trunk.r59/bin/missfits terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7f0e98c9e2c7]
/lib/libc.so.6[0x7f0e98c9c170]
/lib/libc.so.6[0x7f0e98c9b519]
/lib/libc.so.6(_IO_default_xsputn+0x96)[0x7f0e98c15426]
/lib/libc.so.6(_IO_vfprintf+0x152b)[0x7f0e98be5ecb]
/lib/libc.so.6(__vsprintf_chk+0x99)[0x7f0e98c9b5b9]
/lib/libc.so.6(__sprintf_chk+0x80)[0x7f0e98c9b500]
/home/mischa/down/trunk.r59/bin/missfits[0x41799a]
/home/mischa/down/trunk.r59/bin/missfits[0x41816a]
/home/mischa/down/trunk.r59/bin/missfits[0x417255]
/lib/libc.so.6(__libc_start_main+0xe6)[0x7f0e98bbd5a6]
/home/mischa/down/trunk.r59/bin/missfits[0x401d79]
======= Memory map: ========
00400000-00466000 r-xp 00000000 08:12 9439500 /home/mischa/down/trunk.r59/bin/missfits
00665000-00666000 r--p 00065000 08:12 9439500 /home/mischa/down/trunk.r59/bin/missfits
00666000-00698000 rw-p 00066000 08:12 9439500 /home/mischa/down/trunk.r59/bin/missfits
00698000-012eb000 rw-p 00698000 00:00 0
0244a000-0246b000 rw-p 0244a000 00:00 0 [heap]
7f0e98987000-7f0e9899d000 r-xp 00000000 08:12 1982525 /lib/libgcc_s.so.1
7f0e9899d000-7f0e98b9d000 ---p 00016000 08:12 1982525 /lib/libgcc_s.so.1
7f0e98b9d000-7f0e98b9e000 r--p 00016000 08:12 1982525 /lib/libgcc_s.so.1
7f0e98b9e000-7f0e98b9f000 rw-p 00017000 08:12 1982525 /lib/libgcc_s.so.1
7f0e98b9f000-7f0e98d07000 r-xp 00000000 08:12 1982503 /lib/libc-2.9.so
7f0e98d07000-7f0e98f07000 ---p 00168000 08:12 1982503 /lib/libc-2.9.so
7f0e98f07000-7f0e98f0b000 r--p 00168000 08:12 1982503 /lib/libc-2.9.so
7f0e98f0b000-7f0e98f0c000 rw-p 0016c000 08:12 1982503 /lib/libc-2.9.so
7f0e98f0c000-7f0e98f11000 rw-p 7f0e98f0c000 00:00 0
7f0e98f11000-7f0e98f95000 r-xp 00000000 08:12 1982536 /lib/libm-2.9.so
7f0e98f95000-7f0e99194000 ---p 00084000 08:12 1982536 /lib/libm-2.9.so
7f0e99194000-7f0e99195000 r--p 00083000 08:12 1982536 /lib/libm-2.9.so
7f0e99195000-7f0e99196000 rw-p 00084000 08:12 1982536 /lib/libm-2.9.so
7f0e99196000-7f0e991b6000 r-xp 00000000 08:12 1982483 /lib/ld-2.9.so
7f0e9938e000-7f0e99390000 rw-p 7f0e9938e000 00:00 0
7f0e993b0000-7f0e993b5000 rw-p 7f0e993b0000 00:00 0
7f0e993b5000-7f0e993b6000 r--p 0001f000 08:12 1982483 /lib/ld-2.9.so
7f0e993b6000-7f0e993b7000 rw-p 00020000 08:12 1982483 /lib/ld-2.9.so
7fffa13a2000-7fffa13b7000 rw-p 7ffffffea000 00:00 0 [stack]
7fffa13ff000-7fffa1400000 r-xp 7fffa13ff000 00:00 0 [vdso]
cube.fits Abortedffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Find all posts by this user
Quote this message in a reply
06-02-2009, 21:37
Post: #5
RE: missfits coredumps when compiled with gcc 4.3.3
Sad
I have no ideas...
But it seems like gcc4.3.3 and/or recent Ubuntu have more strict FORTIFY_SOURCE compilation flag (see e.g. http://www.nabble.com/Should-we-disable-...62493.html or https://bugs.launchpad.net/ubuntu/+sourc...bug/263014).

If you have time to compile missfits with gcc 4.3.3 disabling the FORTIFY_SOURCE option, it will be very helpful.

Chiara... still looking for the bug...
Find all posts by this user
Quote this message in a reply
06-03-2009, 11:48
Post: #6
RE: missfits coredumps when compiled with gcc 4.3.3
Hi Chiara,

i added the U_FORTIFY_SOURCE compiler flag, and in addition i switched off any optimisation. I still get the same buffer overflow.
Will keep trying...

mischa
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)