codenamecpp / carnage3d

Reimplementation of Grand Theft Auto 1 [GTA1]
MIT License
470 stars 38 forks source link

Big hary crashdump #35

Closed Baggypants closed 4 years ago

Baggypants commented 4 years ago

I don't think it likes my embedded intel gfx card.

[baggypants@swordfish2 carnage3d]$ ./bin/carnage3d-debug
System initialize
Working directory: '/home/baggypants/Develop/carnage3d/bin'
gta_gamedata_location: '/home/baggypants/Games/gta/drive_c/GTA/gtadata'
Init MemoryManager
Frame heap memory size: 12582912
../src/stb_sprintf.h:1214:13: runtime error: store to misaligned address 0x000001c3d272 for type 'unsigned int', which requires 4 byte alignment
0x000001c3d272: note: pointer points here
 6f 6e  3a 20 73 69 7a 65 3a 20  31 32 35 38 32 39 31 32  00 67 79 70 61 6e 74 73  2f 47 61 6d 65 73
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:1214:13 in
GLFW Information: 3.3.0 X11 GLX EGL OSMesa clock_gettime evdev
Initialize OpenGL 3.2 (Core profile)
../src/stb_sprintf.h:357:17: runtime error: store to misaligned address 0x000001c3d27b for type 'unsigned int', which requires 4 byte alignment
0x000001c3d27b: note: pointer points here
 78  37 36 38 20 70 72 6f 66  69 6c 65 29 00 53 4d 65  73 61 20 63 6c 6f 63 6b  5f 67 65 74 74 69 6d
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:357:17 in
Screen resolution: 1024x768, Vsync: disabled, Fullscreen: no
=================================================================
==69484==ERROR: AddressSanitizer: requested allocation size 0xffffffffffffffed (0x7f0 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
    #0 0x5c23b7  (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
    #1 0x7f086f722348  (/usr/lib64/dri/i965_dri.so+0x634348)
    #2 0xffffffec  (<unknown module>)

==69484==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: allocation-size-too-big (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
==69484==ABORTING
codenamecpp commented 4 years ago

I have Intel HD Graphics 4000 and it works just fine.

Some info is missing in this log. Let's try to track down the source of problem: 1) do make clean 2) temporary disable sanitizers - in premake5.lua find lines buildoptions { "-Wno-switch", "-fsanitize=address", "-fsanitize=undefined" } linkoptions { "-fsanitize=address", "-fsanitize=undefined" } and replace with buildoptions { "-Wno-switch" } 3) do make 4) run app

Put here full log after app crash.

Baggypants commented 4 years ago

Once I mode those changes it launched fine!

neuromancer commented 4 years ago

I cannot reproduce this crash (but I'm using an nvidia card, btw)

requested allocation size 0xffffffffffffffed

That indicates an integer overflow in some malloc size. The sanitizers can be annoying, but they uncover some interesting bugs. If you can, re-enable the sanitizer and obtain a backtrace:

$ gdb --args ./bin/carnage3d-debug

Then type run (and press enter). When it crashes, execute type bt (and press enter). Copy and paste all the result here (it should be only a few lines).

Baggypants commented 4 years ago

A bit dissapointing

Reading symbols from bin/carnage3d-debug...
(gdb) run
Starting program: /home/baggypants/Develop/carnage3d/bin/carnage3d-debug
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.30-5.fc31.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
System initialize
Working directory: '/home/baggypants/Develop/carnage3d/bin'
gta_gamedata_location: '/home/baggypants/Games/gta/drive_c/GTA/gtadata'
Init MemoryManager
Frame heap memory size: 12582912
../src/stb_sprintf.h:1214:13: runtime error: store to misaligned address 0x000001c3d272 for type 'unsigned int', which requires 4 byte alignment
0x000001c3d272: note: pointer points here
 6f 6e  3a 20 73 69 7a 65 3a 20  31 32 35 38 32 39 31 32  00 67 79 70 61 6e 74 73  2f 47 61 6d 65 73
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:1214:13 in
GLFW Information: 3.3.0 X11 GLX EGL OSMesa clock_gettime evdev
Initialize OpenGL 3.2 (Core profile)
../src/stb_sprintf.h:357:17: runtime error: store to misaligned address 0x000001c3d27b for type 'unsigned int', which requires 4 byte alignment
0x000001c3d27b: note: pointer points here
 78  37 36 38 20 70 72 6f 66  69 6c 65 29 00 53 4d 65  73 61 20 63 6c 6f 63 6b  5f 67 65 74 74 69 6d
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:357:17 in
Screen resolution: 1024x768, Vsync: disabled, Fullscreen: no
=================================================================
==5866==ERROR: AddressSanitizer: requested allocation size 0xffffffffffffffed (0x7f0 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
    #0 0x5c23b7  (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
    #1 0x7ffff2c22348  (/usr/lib64/dri/i965_dri.so+0x634348)
    #2 0xffffffec  (<unknown module>)

==5866==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: allocation-size-too-big (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
==5866==ABORTING
[Inferior 1 (process 5866) exited with code 01]
Missing separate debuginfos, use: dnf debuginfo-install expat-2.2.8-1.fc31.x86_64 libGLEW-2.1.0-5.fc31.x86_64 libX11-1.6.8-3.fc31.x86_64 libX11-xcb-1.6.8-3.fc31.x86_64 libXau-1.0.9-2.fc31.x86_64 libXcursor-1.1.15-6.fc31.x86_64 libXdamage-1.1.4-17.fc31.x86_64 libXext-1.3.4-2.fc31.x86_64 libXfixes-5.0.3-10.fc31.x86_64 libXi-1.7.10-2.fc31.x86_64 libXinerama-1.1.4-4.fc31.x86_64 libXrandr-1.5.2-2.fc31.x86_64 libXxf86vm-1.1.4-12.fc31.x86_64 libdrm-2.4.99-2.fc31.x86_64 libgcc-9.2.1-1.fc31.x86_64 libglvnd-1.1.1-5.fc31.x86_64 libglvnd-glx-1.1.1-5.fc31.x86_64 libpciaccess-0.15-2.fc31.x86_64 libselinux-2.9-5.fc31.x86_64 libstdc++-9.2.1-1.fc31.x86_64 libxcb-1.13.1-3.fc31.x86_64 libxshmfence-1.3-5.fc31.x86_64 mesa-dri-drivers-19.2.0-1.fc31.x86_64 mesa-libGL-19.2.0-1.fc31.x86_64 pcre2-10.33-14.fc31.x86_64
(gdb)
(gdb)
(gdb) bt
No stack.
(gdb)
neuromancer commented 4 years ago

Oh, sorry. Please try again, but using:

$ ASAN_OPTIONS=abort_on_error=1 gdb --args ./bin/carnage3d-debug
codenamecpp commented 4 years ago

I not sure why exactly it is happening, but I have decided to deactivate sanitizers for standard build configurations. It used primarily by developers but not end-users anyway.

To activate sanitizers in debug configuration enter in console make build_sanitize

Baggypants commented 4 years ago

That mostly crashed gdb

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:1214:13 in
GLFW Information: 3.3.0 X11 GLX EGL OSMesa clock_gettime evdev
Initialize OpenGL 3.2 (Core profile)
../src/stb_sprintf.h:357:17: runtime error: store to misaligned address 0x000001c2727b for type 'unsigned int', which requires 4 byte alignment
0x000001c2727b: note: pointer points here
 78  37 36 38 20 70 72 6f 66  69 6c 65 29 00 53 4d 65  73 61 20 63 6c 6f 63 6b  5f 67 65 74 74 69 6d
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:357:17 in
Screen resolution: 1024x768, Vsync: disabled, Fullscreen: no
=================================================================
==12351==ERROR: AddressSanitizer: requested allocation size 0xffffffffffffffed (0x7f0 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
    #0 0x5c23b7  (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
    #1 0x7ffff2c22348  (/usr/lib64/dri/i965_dri.so+0x634348)
    #2 0xffffffec  (<unknown module>)

==12351==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: allocation-size-too-big (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
==12351==ABORTING

Program received signal SIGABRT, Aborted.
Missing separate debuginfos, use: dnf debuginfo-install expat-2.2.8-1.fc31.x86_64 libGLEW-2.1.0-5.fc31.x86_64 libX11-1.6.8-3.fc31.x86_64 libX11-xcb-1.6.8-3.fc31.x86_64 libXau-1.0.9-2.fc31.x86_64 libXcursor-1.1.15-6.fc31.x86_64 libXdamage-1.1.4-17.fc31.x86_64 libXext-1.3.4-2.fc31.x86_64 libXfixes-5.0.3-10.fc31.x86_64 libXi-1.7.10-2.fc31.x86_64 libXinerama-1.1.4-4.fc31.x86_64 libXrandr-1.5.2-2.fc31.x86_64 libXxf86vm-1.1.4-12.fc31.x86_64 libdrm-2.4.99-2.fc31.x86_64 libgcc-9.2.1-1.fc31.x86_64 libglvnd-1.1.1-5.fc31.x86_64 libglvnd-glx-1.1.1-5.fc31.x86_64 libpciaccess-0.15-2.fc31.x86_64 libselinux-2.9-5.fc31.x86_64 libstdc++-9.2.1-1.fc31.x86_64 libxcb-1.13.1-3.fc31.x86_64 libxshmfence-1.3-5.fc31.x86_64 mesa-dri-drivers-19.2.0-1.fc31.x86_64 mesa-libGL-19.2.0-1.fc31.x86_64 pcre2-10.33-14.fc31.x86_64
../../gdb/dwarf2-frame.c:2046: internal-error: const gdb_byte* decode_frame_entry_1(comp_unit*, const gdb_byte*, int, dwarf2_cie_table*, dwarf2_fde_table*, eh_frame_type): Assertion `fde->cie != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

../../gdb/dwarf2-frame.c:2046: internal-error: const gdb_byte* decode_frame_entry_1(comp_unit*, const gdb_byte*, int, dwarf2_cie_table*, dwarf2_fde_table*, eh_frame_type): Assertion `fde->cie != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
Command aborted.
(gdb) bt
../../gdb/dwarf2-frame.c:2046: internal-error: const gdb_byte* decode_frame_entry_1(comp_unit*, const gdb_byte*, int, dwarf2_cie_table*, dwarf2_fde_table*, eh_frame_type): Assertion `fde->cie != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n

This is a bug, please report it.  For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.

../../gdb/dwarf2-frame.c:2046: internal-error: const gdb_byte* decode_frame_entry_1(comp_unit*, const gdb_byte*, int, dwarf2_cie_table*, dwarf2_fde_table*, eh_frame_type): Assertion `fde->cie != NULL' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
Quit
(gdb)
neuromancer commented 4 years ago

Interesting, this seems to be related with an old bug. Which distro Linux distro, C++ compiler and gdb version are you using?

codenamecpp commented 4 years ago

Well, It seems that better stop using stbsp_vsnprintf :)

It's done - stbsp_vsnprintf not used anymore, so sanitizer may be happy.