Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: shiv on June 30, 2009, 11:01:07 am

Title: Linux bug?
Post by: shiv on June 30, 2009, 11:01:07 am
Code: [Select]
*** buffer overflow detected ***: ./fs2_open_r terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7a06da8]
/lib/tls/i686/cmov/libc.so.6[0xb7a04eb0]
/lib/tls/i686/cmov/libc.so.6[0xb7a0413d]
./fs2_open_r[0x8279d2c]
./fs2_open_r[0x827d84a]
./fs2_open_r[0x827da47]
./fs2_open_r[0x827dcc8]
./fs2_open_r[0x8058083]
./fs2_open_r[0x8058230]
./fs2_open_r[0x8058508]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb791f775]
./fs2_open_r[0x804eba1]
======= Memory map: ========
08048000-083e2000 r-xp 00000000 08:03 6070471    /home/michal/FreeSpace2/fs2_open_r
083e2000-083e3000 r--p 0039a000 08:03 6070471    /home/michal/FreeSpace2/fs2_open_r
083e3000-083fe000 rw-p 0039b000 08:03 6070471    /home/michal/FreeSpace2/fs2_open_r
083fe000-091cf000 rw-p 083fe000 00:00 0
09a23000-09e71000 rw-p 09a23000 00:00 0          [heap]
b4beb000-b4eec000 rw-p b4beb000 00:00 0
b512c000-b512d000 rw-p b512c000 00:00 0
b512d000-b532d000 rw-s 060c3000 00:0f 7050       /dev/nvidia0
b532d000-b5331000 rw-s 35d6c000 00:0f 7050       /dev/nvidia0
b5331000-b5431000 rw-s 2695a000 00:0f 7050       /dev/nvidia0
b5431000-b5471000 rw-s 2b7e5000 00:0f 7050       /dev/nvidia0
b5471000-b5491000 rw-s 0687d000 00:0f 7050       /dev/nvidia0
b5491000-b54f6000 rw-p b5491000 00:00 0
b54f6000-b5540000 rw-p 00000000 00:0f 751        /dev/zero
b5540000-b5561000 rw-s 00000000 00:09 7634944    /SYSV00000000 (deleted)
b5561000-b5569000 r-xp 00000000 08:03 927287     /usr/lib/libXcursor.so.1.0.2
b5569000-b556a000 rw-p 00007000 08:03 927287     /usr/lib/libXcursor.so.1.0.2
b557b000-b5666000 r--p 00000000 08:03 1082921    /usr/lib/locale/pl_PL.utf8/LC_COLLATE
b5666000-b5667000 ---p b5666000 00:00 0
b5667000-b5e67000 rwxp b5667000 00:00 0
b5e67000-b5e68000 ---p b5e67000 00:00 0
b5e68000-b6668000 rwxp b5e68000 00:00 0
b6668000-b66f0000 rw-p b6668000 00:00 0
b66fb000-b66ff000 rw-s 35db6000 00:0f 7050       /dev/nvidia0
b66ff000-b6700000 rw-s d09d1000 00:0f 7050       /dev/nvidia0
b6700000-b6701000 rw-s 1eb06000 00:0f 7050       /dev/nvidia0
b6701000-b6702000 rw-s 2c790000 00:0f 7050       /dev/nvidia0
b6702000-b6703000 rw-s fac08000 00:0f 7050       /dev/nvidia0
b6703000-b6704000 rw-s fa641000 00:0f 7050       /dev/nvidia0
b6704000-b6705000 rw-s 27285000 00:0f 7050       /dev/nvidia0
b6705000-b6706000 rw-s fa060000 00:0f 7050       /dev/nvidia0
b6706000-b670a000 r-xp 00000000 08:03 927295     /usr/lib/libXfixes.so.3.1.0
b670a000-b670b000 rw-p 00003000 08:03 927295     /usr/lib/libXfixes.so.3.1.0
b670b000-b6713000 r-xp 00000000 08:03 927315     /usr/lib/libXrender.so.1.3.0
b6713000-b6714000 r--p 00007000 08:03 927315     /usr/lib/libXrender.so.1.3.0
b6714000-b6715000 rw-p 00008000 08:03 927315     /usr/lib/libXrender.so.1.3.0
b6715000-b6754000 r--p 00000000 08:03 959398     /usr/lib/locale/pl_PL.utf8/LC_CTYPE
b6754000-b6755000 r--p 00000000 08:03 959645     /usr/lib/locale/pl_PL.utf8/LC_NUMERIC
b6755000-b6756000 r--p 00000000 08:03 1082920    /usr/lib/locale/pl_PL.utf8/LC_TIME
b6756000-b6758000 rw-p b6756000 00:00 0
b6758000-b675c000 r-xp 00000000 08:03 927291     /usr/lib/libXdmcp.so.6.0.0
b675c000-b675d000 rw-p 00003000 08:03 927291     /usr/lib/libXdmcp.so.6.0.0
b675d000-b6775000 r-xp 00000000 08:03 928248     /usr/lib/libxcb.so.1.1.0
b6775000-b6776000 r--p 00017000 08:03 928248     /usr/lib/libxcb.so.1.1.0
b6776000-b6777000 rw-p 00018000 08:03 928248     /usr/lib/libxcb.so.1.1.0
b6777000-b6778000 rw-p b6777000 00:00 0
b6778000-b677a000 r-xp 00000000 08:03 927280     /usr/lib/libXau.so.6.0.0
b677a000-b677b000 r--p 00001000 08:03 927280     /usr/lib/libXau.so.6.0.0
b677b000-b677c000 rw-p 00002000 08:03 927280     /usr/lib/libXau.so.6.0.0
b677c000-b6783000 r-xp 00000000 08:03 1516792    /lib/tls/i686/cmov/librt-2.9.so
b6783000-b6784000 r--p 00006000 08:03 1516792    /lib/tls/i686/cmov/librt-2.9.so
b6784000-b6785000 rw-p 00007000 08:03 1516792    /lib/tls/i686/cmov/librt-2.9.so
b6785000-b686f000 r-xp 00000000 08:03 927274     /usr/lib/libX11.so.6.2.0
b686f000-b6870000 ---p 000ea000 08:03 927274     /usr/lib/libX11.so.6.2.0
b6870000-b6871000 r--p 000ea000 08:03 927274     /usr/lib/libX11.so.6.2.0
b6871000-b6873000 rw-p 000eb000 08:03 927274     /usr/lib/libX11.so.6.2.0
b6873000-b6874000 rw-p b6873000 00:00 0
b6874000-b6882000 r-xp 00000000 08:03 927293     /usr/lib/libXext.so.6.4.0
b6882000-b6883000 r--p 0000d000 08:03 927293     /usr/lib/libXext.so.6.4.0
b6883000-b6884000 rw-p 0000e000 08:03 927293     /usr/lib/libXext.so.6.4.0
b6884000-b6885000 r-xp 00000000 08:03 1098767    /usr/lib/tls/libnvidia-tls.so.180.44
b6885000-b6886000 rw-p 00000000 08:03 1098767    /usr/lib/tls/libnvidia-tls.so.180.44
b6886000-b6887000 rw-p b6886000 00:00 0
b6887000-b75a1000 r-xp 00000000 08:03 927471     /usr/lib/libGLcore.so.180.44
b75a1000-b7793000 rwxp 00d19000 08:03 927471     /usr/lib/libGLcore.so.180.44
b7793000-b779f000 rwxp b7793000 00:00 0
b779f000-b77b4000 r-xp 00000000 08:03 1516788    /lib/tls/i686/cmov/libpthread-2.9.so
b77b4000-b77b5000 r--p 00014000 08:03 1516788    /lib/tls/i686/cmov/libpthread-2.9.so
b77b5000-b77b6000 rw-p 00015000 08:03 1516788    /lib/tls/i686/cmov/libpthread-2.9.so
b77b6000-b77b8000 rw-p b77b6000 00:00 0
b77b8000-b77cb000 r-xp 00000000 08:03 927477     /usr/lib/libdirect-1.0.so.0.1.0
b77cb000-b77cc000 r--p 00012000 08:03 927477     /usr/lib/libdirect-1.0.so.0.1.0
b77cc000-b77cd000 rw-p 00013000 08:03 927477     /usr/lib/libdirect-1.0.so.0.1.0
b77cd000-b77d4000 r-xp 00000000 08:03 927559     /usr/lib/libfusion-1.0.so.0.1.0
b77d4000-b77d5000 r--p 00006000 08:03 927559     /usr/lib/libfusion-1.0.so.0.1.0
b77d5000-b77d6000 rw-p 00007000 08:03 927559     /usr/lib/libfusion-1.0.so.0.1.0
b77d6000-b783a000 r-xp 00000000 08:03 927479     /usr/lib/libdirectfb-1.0.so.0.1.0
b783a000-b783b000 r--p 00063000 08:03 927479     /usr/lib/libdirectfb-1.0.so.0.1.0
b783b000-b783c000 rw-p 00064000 08:03 927479     /usr/lib/libdirectfb-1.0.so.0.1.0
b783c000-b783d000 rw-p b783c000 00:00 0
b783d000-b7900000 r-xp 00000000 08:03 927354     /usr/lib/libasound.so.2.0.0
b7900000-b7902000 r--p 000c2000 08:03 927354     /usr/lib/libasound.so.2.0.0
b7902000-b7905000 rw-p 000c4000 08:03 927354     /usr/lib/libasound.so.2.0.0
b7905000-b7907000 r-xp 00000000 08:03 1516768    /lib/tls/i686/cmov/libdl-2.9.so
b7907000-b7908000 r--p 00001000 08:03 1516768    /lib/tls/i686/cmov/libdl-2.9.so
b7908000-b7909000 rw-p 00002000 08:03 1516768    /lib/tls/i686/cmov/libdl-2.9.so
b7909000-b7a65000 r-xp 00000000 08:03 1516762    /lib/tls/i686/cmov/libc-2.9.so
b7a65000-b7a66000 ---p 0015c000 08:03 1516762    /lib/tls/i686/cmov/libc-2.9.so
b7a66000-b7a68000 r--p 0015c000 08:03 1516762    /lib/tls/i686/cmov/libc-2.9.so
b7a68000-b7a69000 rw-p 0015e000 08:03 1516762    /lib/tls/i686/cmov/libc-2.9.so
b7a69000-b7a6c000 rw-p b7a69000 00:00 0
b7a6c000-b7a79000 r-xp 00000000 08:03 1499201    /lib/libgcc_s.so.1
b7a79000-b7a7a000 r--p 0000c000 08:03 1499201    /lib/libgcc_s.so.1
b7a7a000-b7a7b000 rw-p 0000d000 08:03 1499201    /lib/libgcc_s.so.1
b7a7b000-b7a9f000 r-xp 00000000 08:03 1516770    /lib/tls/i686/cmov/libm-2.9.so
b7a9f000-b7aa0000 r--p 00023000 08:03 1516770    /lib/tls/i686/cmov/libm-2.9.so
b7aa0000-b7aa1000 rw-p 00024000 08:03 1516770    /lib/tls/i686/cmov/libm-2.9.so
b7aa1000-b7b85000 r-xp 00000000 08:03 928165     /usr/lib/libstdc++.so.6.0.10
b7b85000-b7b89000 r--p 000e3000 08:03 928165     /usr/lib/libstdc++.so.6.0.10
b7b89000-b7b8a000 rw-p 000e7000 08:03 928165     /usr/lib/libstdc++.so.6.0.10
b7b8a000-b7b91000 rw-p b7b8a000 00:00 0
b7b91000-b7bb5000 r-xp 00000000 08:03 1010718    /usr/local/lib/libopenal.so.1.8.466
b7bb5000-b7bb6000 r--p 00023000 08:03 1010718    /usr/local/lib/libopenal.so.1.8.466
b7bb6000-b7bb7000 rw-p 00024000 08:03 1010718    /usr/local/lib/libopenal.so.1.8.466
b7bb7000-b7ca3000 rw-p b7bb7000 00:00 0
b7ca3000-b7d12000 r-xp 00000000 08:03 925867     /usr/lib/libGLU.so.1.3.070300
b7d12000-b7d13000 ---p 0006f000 08:03 925867     /usr/lib/libGLU.so.1.3.070300
b7d13000-b7d14000 r--p 0006f000 08:03 925867     /usr/lib/libGLU.so.1.3.070300
b7d14000-b7d15000 rw-p 00070000 08:03 925867     /usr/lib/libGLU.so.1.3.070300
b7d15000-b7da2000 r-xp 00000000 08:03 927470     /usr/lib/libGL.so.180.44
b7da2000-b7dc0000 rwxp 0008d000 08:03 927470     /usr/lib/libGL.so.180.44
b7dc0000-b7dcf000 rwxp b7dc0000 00:00 0
b7dcf000-b7dd3000 r-xp 00000000 08:03 927981     /usr/lib/libogg.so.0.5.3
b7dd3000-b7dd4000 r--p 00003000 08:03 927981     /usr/lib/libogg.so.0.5.3
b7dd4000-b7dd5000 rw-p 00004000 08:03 927981     /usr/lib/libogg.so.0.5.3
b7dd5000-b7e24000 r-xp 00000000 08:03 928178     /usr/lib/libtheora.so.0.3.4
b7e24000-b7e./startFreeSpace: line 2: 21040 Aborted                 ./fs2_open_r -ambient_factor 60 -spec -glow -env -mipmap -missile_lighting -normal -3dshockwave -dualscanlines -targetinfo -orbradar -rearm_timer -ballistic_gauge -ship_choice_3d -weapon_choice_3d -warp_flash -snd_preload -fps -mod fsport

Here's code.
I'm using Linux 3.6.10 RC3 and FSPort mod without mediavps.
FSPort splash screen flashes quickly for me then everythign disappears with those console bugs.

Can anyone help?
Title: Re: Linux bug?
Post by: The E on June 30, 2009, 11:12:27 am
This has been mentioned before. (http://www.hard-light.net/forums/index.php/topic,64027.0.html)
Title: Re: Linux bug?
Post by: shiv on June 30, 2009, 11:32:17 am
Well, it runs fine with debug build, but with standard one not. What should I do?
Title: Re: Linux bug?
Post by: chief1983 on June 30, 2009, 12:35:59 pm
What's your distro?  Is it 64bit?  If it's not 32bit Ubuntu, you might want to compile your own build.  Unfortunately I don't know if the linux build will ever be able to be supported as usable by everyone.  Compiling your own is really the best way to go at this point.  There's a lot of help for that in the Wiki too.  I have no idea what would cause a buffer overrun crash like that though, and that log doesn't really cover a lot.  We don't even know if the other reporter ever got it fixed or not.
Title: Re: Linux bug?
Post by: shiv on June 30, 2009, 01:09:19 pm
Unfortuneately, I had problems with sound on Slackware and Fedora (not entirely FS related sound problems) and I had to run into Ubuntu. I'm pretty satisfied with it, even if it's commonly recognized as newbie distro (but for my semi-professional usage it serves as good as Slackware).

Anyway it's 32 bit Ubuntu.

I'll try compiling my own build and I'll tell you how it's working.
Title: Re: Linux bug?
Post by: shiv on June 30, 2009, 04:07:46 pm
Compiling anything didn't help :(
Title: Re: Linux bug?
Post by: chief1983 on June 30, 2009, 07:41:00 pm
This might be a bigger problem than I thought then.  Can anyone on Linux run a regular build, or does it seem to be limited to Ubuntu users only?
Title: Re: Linux bug?
Post by: portej05 on July 01, 2009, 01:51:06 am
I'm going to take a random guess here and say 'buffer overflow'.
I'm wondering whether this might be related to the stuff that RedDwarf was putting up. (Buffer overflows)
Title: Re: Linux bug?
Post by: castor on July 01, 2009, 01:19:08 pm
Can anyone on Linux run a regular build, or does it seem to be limited to Ubuntu users only?
Runs ok here (Debian Lenny 32bit).
Title: Re: Linux bug?
Post by: chief1983 on July 01, 2009, 01:51:09 pm
Did you roll your own, or use my reference build, and if you compiled, what versions of the build tools were used to compile it?
Title: Re: Linux bug?
Post by: castor on July 01, 2009, 02:55:15 pm
Yea, its the Linux binary from the RC3 release thread.
Title: Re: Linux bug?
Post by: shiv on July 01, 2009, 03:03:54 pm
Ubuntu's Debian too, but it's using it's own repository I think. I guess it's Ubuntu-related problem.
Title: Re: Linux bug?
Post by: chief1983 on July 01, 2009, 04:29:22 pm
That makes it seem more likely that it's something on the runtime configuration, if a build compiled on Ubuntu won't run on Ubuntu but it will on other distros.
Title: Re: Linux bug?
Post by: RedDwarf on July 01, 2009, 04:57:14 pm
Only happens with FSPort? I remember finding a file that was different downloaded from the installer than downloading it manually from the release thread (one was a lot bigger than the other). Perhaps was in the FSPort MediaVP, I don't really remember sorry.
If helps, these are the SHA1 sums of my files right now:
Quote
$ sha1sum fsport/* fsport-mediavps/*
aa32bef27bd8d60de732c56a38644998c918ac9e  fsport/FS1OGGcutscenepack.vp
6b648997b38495c23215670cc061ea7ab0288bd3  fsport/fsport3_1_1.vp
8cce8c45f8c49813aa3b40f8bc21baef1cfad795  fsport/fsport-missions.vp
19db487455d4073acbeaa7b1e6857dd875f77a01  fsport/fsport.png
d6dc9d81abe90731892fe58f24c000adc40800da  fsport/mod.ini
b2b2dce04dcb545ea0673a7e0bcabed84db7937c  fsport/readme.txt
bb2c4cc6231d177c8e12d9ba74268f77ed400eaa  fsport/sparky_hi_fs1.vp
8356caacc9cb55e3b17cbde50208392149ecd6c3  fsport/stu_fs1.vp
af33a7432f29b38ad7e9933fb461796f44a8f5f6  fsport/tango_fs1.vp
0c4af073456a4367362822310f7121a1e1e4ee45  fsport/warble_fs1.vp
cd4cd02e51c5dffa9acad045bf031758500d69e3  fsport-mediavps/fsport-mediavps.png
b0f59428990af4c02fc4cd890f6516e46af96759  fsport-mediavps/mod.ini
c5e92123c58b9b1348a44404e51daa151cb83693  fsport-mediavps/mv_fsport.vp

But anyway the output doesn't helps because there is no debug information. If a non-stripped (but optimized/non-debug) file is released the backtrace would give more info.
If the build is reproducible these memory directions could even be translated to source code positions. But reproduce the crash with a no stripped binary is the easier thing to do.

...I use a self compiled binary in openSUSE, so I can't say anything about the official build.


Edit: Oh, and portej05 is right. Since the output says "__fortify_fail" I suppose the build was created with _FORTIFY_SOURCE, and I reported a problem that triggers in such a case in Mantis: bug #1939
While a real fix is created I patched the openSUSE package with this:
Code: [Select]
--- code/parse/parselo.cpp
+++ code/parse/parselo.cpp
@@ -442,8 +442,8 @@
 // to know that a modular table is currently being parsed
 bool Parsing_modular_table = false;
 
-char parse_error_text[64];//for my better error mesages-Bobboau
-char parse_error_text_save[64];
+char parse_error_text[128];//for my better error mesages-Bobboau
+char parse_error_text_save[128];
 
 char Current_filename[128];
 char Current_filename_save[128];
--- code/parse/parselo.h
+++ code/parse/parselo.h
@@ -579,7 +579,7 @@
 extern int required_string_either_fred(char *str1, char *str2);
 extern int optional_string_fred(char *pstr, char *end = NULL, char *end2 = NULL);
 
-extern char parse_error_text[64];
+extern char parse_error_text[128];
 
 // Goober5000 - returns position of replacement or -1 for exceeded length
 extern int replace_one(char *str, char *oldstr, char *newstr, unsigned int max_len, int range = 0);
Title: Re: Linux bug?
Post by: shiv on July 02, 2009, 03:23:59 am
Will compiling on another distro help?
Title: Re: Linux bug?
Post by: chief1983 on July 02, 2009, 10:40:08 am
I don't have any others available at the moment, and if compiling your own build doesn't work, then I don't have a clue what would.  You could try using an older version of build-essentials if there's one available, that's about my only guess there.
Title: Re: Linux bug?
Post by: castor on July 02, 2009, 02:10:42 pm
Here's another one to try out fso_5395.zip (http://www.joskus.jossain.com/fso_5395.zip) (-march=i686).
Title: Re: Linux bug?
Post by: shiv on July 03, 2009, 02:21:16 am
Castor, it works very well with your build. Thank you :)
Title: Re: Linux bug?
Post by: Arixo on July 03, 2009, 02:36:28 am
Hi, I tried on my ubuntu 32bit (8.04) and the the Linux binary from the RC3 release thread crashes also.

However when I compile the svn release 5209 (mentioned to be the one corresponding to RC3, right ?), it works, but with a message saying that 853 warnings where detected.

I've just seen the problem is solved !
Anyway this may be of interest...
Title: Re: Linux bug?
Post by: castor on July 03, 2009, 01:18:52 pm
Castor, it works very well with your build. Thank you :)
Np Shiv :)
Here's the config log, incase its of any use for Chief.

[attachment deleted by MSC
Title: Re: Linux bug?
Post by: Joif on July 05, 2009, 12:31:29 pm
Same problem here! Ubuntu 9.04 64 bit
Solved using Castor's build!
But the question is... why?? I also recompiled but using my bin the problem persist, and also my bin is 19,7MB instead Castor's bin is 3,7MB!
my config.log in attachment.

[attachment deleted by MSC
Title: Re: Linux bug?
Post by: portej05 on July 05, 2009, 12:54:07 pm
Hi Folks, please note the following:

1) We're aware of some significant buffer issues that are starting to crop up as people turn on things like _FORTIFY_SOURCE and other secure functions
2) The config.log isn't massively useful to us - Castor: If you've modified the code, we need to know how in order to figure out what's going wrong
3) We've got an internal push to use some safer functions and profiling, however we're stuck on one or two minor cross-platform details, which we're sorting out at present
4) As of this morning, we have available some new internal allocators which will help resolve some of these problems, and hopefully remove some (minor) limits in the system
5) We're trying to avoid just upping arbitrary internal limits in favour of understanding how the problem has occurred, what it's potential ramifications are and how it has escaped detection until the present - if the limit breaks now, it may break in the future.
6) As on any code base, any feedback from users is highly welcomed, highly encouraged and highly valued

If you've got any questions with regards to the source, feel free to PM myself, Goober5000, karajorma, chief1983 or anyone else you see lurking around the SCP boards with an SCP badge.

Thankyou for playing and reporting these problems - we intend to address them in the 3.6.11 branch.
Title: Re: Linux bug?
Post by: castor on July 05, 2009, 02:36:01 pm
Quote from: Joif
I also recompiled but using my bin the problem persist, and also my bin is 19,7MB instead Castor's bin is 3,7MB!
I just removed the debug symbols with the "strip" command to make the download smaller.

Quote from: portej05
2) The config.log isn't massively useful to us - Castor: If you've modified the code, we need to know how in order to figure out what's going wrong
This one was a fresh SVN checkout of r5395. After the checkout I only ran autogen.sh (with the -march variable) and compiled+stripped.
Title: Re: Linux bug?
Post by: Joif on July 26, 2009, 01:16:56 pm
I'm testing FreeSpace with FSport on Debian Squeeze 64 bit. It works with the last release of FSopen (3.6.10 final). I'll try if on Ubuntu is still necessary to use Castor's build,
Title: Re: Linux bug?
Post by: chief1983 on July 26, 2009, 01:30:28 pm
The 3.6.10 final build was not build on Ubuntu, but on Debian, so it should be more compatible.