lib32-mesa Gallium3D drivers SIGSEGV with old Linux native games
I have tried to run 2 old Linux native games on modern and fully updated ArchLinux x86_64 using the multilib support.
- Heavy Gear II - Loki Entertainment
- SHOGO Mobile Armor Division - Hyperion Entertainment
They are targets for 32-bit Linux x86, gtk1.2, glib1.2 and early SDL and OpenAL. They don't have source ports. After installed and symlink'ed (old->new) libs, here's the results:
- i915, i965 DRI drivers OK
- nvidia-390xx dirvers OK
- Gallium3D drivers SIGSEGV (r600, nouveau, radeonsi, virgl, swrst)
Stack trace of thread 1956:
#0 0x00000000f450a8e3 _ZN12_GLOBAL__N_17ctype_cE (libstdc++.so.6)
#1 0x00000000f44354fe _ZSt9has_facetISt5ctypeIcEEbRKSt6locale (libstdc++.so.6)
#2 0x00000000f44249c4 _ZNSt9basic_iosIcSt11char_traitsIcEE15_M_cache_localeERKSt6locale (libstdc++.so.6)
#3 0x00000000f4424e91 _ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_streambufIcS1_E (libstdc++.so.6)
#4 0x00000000f43c57de _ZNSoC4EPSt15basic_streambufIcSt11char_traitsIcEE (libstdc++.so.6)
#5 0x00000000f45600ed n/a (nouveau_dri.so)
#6 0x00000000f7fd03dc call_init.part.0 (ld-linux.so.2)
#7 0x00000000f7fd04ea _dl_init (ld-linux.so.2)
#8 0x00000000f7fd4198 dl_open_worker (ld-linux.so.2)
#9 0x00000000f7b102f4 _dl_catch_exception (libc.so.6)
#10 0x00000000f7fd39da _dl_open (ld-linux.so.2)
#11 0x00000000f7e613cc n/a (libdl.so.2)
#12 0x00000000f7b102f4 _dl_catch_exception (libc.so.6)
#13 0x00000000f7b10394 _dl_catch_error (libc.so.6)
#14 0x00000000f7e61be5 n/a (libdl.so.2)
#15 0x00000000f7e6146a dlopen (libdl.so.2)
#16 0x00000000f72c9eb4 n/a (libGLX_mesa.so.0)
#17 0x00000000f72bdc7d n/a (libGLX_mesa.so.0)
#18 0x00000000f72c7001 n/a (libGLX_mesa.so.0)
#19 0x00000000f72b2920 n/a (libGLX_mesa.so.0)
#20 0x00000000f72addb6 n/a (libGLX_mesa.so.0)
#21 0x00000000f72ae857 n/a (libGLX_mesa.so.0)
#22 0x00000000f7f38c8f n/a (/usr/lib32/libSDL-1.2.so.0.11.4)
#23 0x00000000f7f3de4a n/a (/usr/lib32/libSDL-1.2.so.0.11.4)
#24 0x00000000f7f3e382 n/a (/usr/lib32/libSDL-1.2.so.0.11.4)
#25 0x00000000f7f2c669 SDL_SetVideoMode (/usr/lib32/libSDL-1.2.so.0.11.4)
It is 100% reproducible with the exact same core dump and stack trace with all the Gallium3D drivers from both games. The SIGSEGV trapped during C++ static initialization. I had triage the issue and found the following simple one-liner patch fixes the issue for builds with b_ndebug=true
.
diff -rwu orig/mesa-19.2.0/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp ./mesa-19.2.0/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp
--- orig/mesa-19.2.0/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp 2019-09-25 09:59:32.000000000 -0700
+++ ./mesa-19.2.0/src/mesa/state_tracker/st_glsl_to_tgsi_array_merge.cpp 2019-10-09 01:03:55.480745305 -0700
@@ -130,8 +130,6 @@
#include <cassert>
#include <algorithm>
-#include <iostream>
-
#include "st_glsl_to_tgsi_array_merge.h"
#if __cplusplus >= 201402L
There is still work to be done to completely fix the issue since the default meson build options have buildtype=debugoptimized
and b_ndebug=if-release
.
Unfortunately, I am not able to provide a simple test case without requiring the whole game. Running glxgears, glmark2, quake2 and avp source ports are all fine.