Javanaise/mrboom-libretro

Boot crash

Closed this issue · 18 comments

Trying to run mrboom from command line:

** buffer overflow detected ***: mrboom terminated

I am running manjaro linux and downloaded mr boom from the AUR.

More info from gdb:

(gdb) r
Starting program: /usr/bin/mrboom
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff45f5700 (LWP 22110)]
[New Thread 0x7fffde5f7700 (LWP 22114)]
*** buffer overflow detected ***: /usr/bin/mrboom terminated

Thread 1 "mrboom" received signal SIGABRT, Aborted.
0x00007ffff6d808a0 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff6d808a0 in raise () from /usr/lib/libc.so.6
#1 0x00007ffff6d81f09 in abort () from /usr/lib/libc.so.6
#2 0x00007ffff6dc3517 in __libc_message () from /usr/lib/libc.so.6
#3 0x00007ffff6e5374f in __fortify_fail_abort () from /usr/lib/libc.so.6
#4 0x00007ffff6e53781 in __fortify_fail () from /usr/lib/libc.so.6
#5 0x00007ffff6e51610 in __chk_fail () from /usr/lib/libc.so.6
#6 0x0000555555558018 in ?? ()
#7 0x000055555555753e in ?? ()
#8 0x00007ffff6d6cf6a in __libc_start_main () from /usr/lib/libc.so.6
#9 0x0000555555557a3a in ?? ()
(gdb)

Hi, could you try to compile it from the sources and show me the logs ?
It could be some "source fortification", we run into this problem on debian and there's an "hardening=+all,-fortify" option added somewhere.

I checked out the code from git and ran make:

s@server mrboom-libretro]$ make
g++ -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -std=c++98 -Wall -pedantic -fPIC -c -o common.o common.cpp
In function ‘bool mrboom_init()’:
cc1plus: warning: iteration 8 invokes undefined behavior [-Waggressive-loop-optimizations]
common.cpp:362:17: note: within this loop
for (int i=0; i<keyboardDataSize*nb_dyna; i++) {
g++ -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -std=c++98 -Wall -pedantic -fPIC -c -o ai/BotTree.o ai/BotTree.cpp
g++ -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -std=c++98 -Wall -pedantic -fPIC -c -o ai/Bot.o ai/Bot.cpp
g++ -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -std=c++98 -Wall -pedantic -fPIC -c -o ai/GridFunctions.o ai/GridFunctions.cpp
g++ -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -std=c++98 -Wall -pedantic -fPIC -c -o ai/MrboomHelper.o ai/MrboomHelper.cpp
g++ -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -std=c++98 -Wall -pedantic -fPIC -c -o retro.o retro.cpp
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o mrboom.o mrboom.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/file/retro_stat.o libretro-common/file/retro_stat.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/file/file_path.o libretro-common/file/file_path.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/compat/compat_strcasestr.o libretro-common/compat/compat_strcasestr.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/compat/compat_posix_string.o libretro-common/compat/compat_posix_string.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/string/stdstring.o libretro-common/string/stdstring.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/compat/compat_strl.o libretro-common/compat/compat_strl.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/streams/file_stream.o libretro-common/streams/file_stream.c
In file included from libretro-common/streams/file_stream.c:64:0:
./libretro-common/include/streams/file_stream.h:50:32: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
#pragma GCC diagnostic ignored "-Wc++11-long-long"
^~~~~~~~~~~~~~~~~~~
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/streams/memory_stream.o libretro-common/streams/memory_stream.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/lists/string_list.o libretro-common/lists/string_list.c
cc -O3 -DMRBOOM -DGIT_VERSION="" 44daf18"" -D__LIBRETRO__ -I./libretro-common/include -I./ai -I. -Wall -pedantic -fPIC -std=gnu99 -fPIC -c -o libretro-common/memmap/memalign.o libretro-common/memmap/memalign.c
g++ -fPIC -shared -Wl,--version-script=./link.T -Wl,--no-undefined -o mrboom_libretro.so ./common.o ./ai/BotTree.o ./ai/Bot.o ./ai/GridFunctions.o ./ai/MrboomHelper.o ./retro.o ./mrboom.o ./libretro-common/file/retro_stat.o ./libretro-common/file/file_path.o ./libretro-common/compat/compat_strcasestr.o ./libretro-common/compat/compat_posix_string.o ./libretro-common/string/stdstring.o ./libretro-common/compat/compat_strl.o ./libretro-common/streams/file_stream.o ./libretro-common/streams/memory_stream.o ./libretro-common/lists/string_list.o ./libretro-common/memmap/memalign.o -lm
[s@server mrboom-libretro]$

No executable seems to exist

You compiled the libretro library, for the SDL2 version:

apt-get install libsdl2-dev libmodplug-dev libsdl2-mixer-dev libminizip-dev
make clean
make mrboom LIBSDL2=1

don't forget the "make clean"

oh I don't have a linux distro that uses apt-get, I'm using manjaro that uses pacman, but those packages don't seem to exist: libsdl2-dev libmodplug-dev libsdl2-mixer-dev libminizip-dev

Please try to compile, if it doesn't work get the dependencies listed there: https://aur.archlinux.org/packages/mrboom-git

Any update?

I gave up trying to get it compiling.

I maintain the AUR package. I will take a look at this today on my Arch Linux machine and let you know how I make out

I will have to get to this tomorrow. I was on a role with a development Python tool for work.

I got the same thing on linux mint when running the last commit (fca110d on master):

 /bin/mrboom 
*** buffer overflow detected ***: /bin/mrboom terminated
[1]    3424 abort      /bin/mrboom

Steps attached here:

linux_mint.txt

Versions

$ uname -a
Linux computername 4.13.0-16-generic #19-Ubuntu SMP Wed Oct 11 18:35:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/os-release
NAME="Linux Mint"
VERSION="18.2 (Sonya)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.2"
VERSION_ID="18.2"
HOME_URL="http://www.linuxmint.com/"
SUPPORT_URL="http://forums.linuxmint.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/linuxmint/"
VERSION_CODENAME=sonya
UBUNTU_CODENAME=xenial

$ cat /etc/upstream-release/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

yeah I think that's fortification that gets it to crash:

_/usr/include/x86_64-linux-gnu/bits/string_fortified.h:90:63: warning: ‘void* _builtin___memcpy_chk(void*, const void*, long unsigned int, long unsigned int)’ writing 495 bytes into a region of size 56 overflows the destination [-Wstringop-overflow=]

@kenden could you please try again with the last commit ?

@mdeguzis I pushed a 3.9 version, could you please update the package to see if it's fixing the problem ?

AUR package updated. Please retest

@supagu @kenden Could you guys please test again with the 4.1 package update ?

I can confirm the game now works from the AUR on Manjaro using 4.1 package. Closing.