libGLX_nvidia calls the faker's eglDestroyContext after global destruction has started and crashes when trying to acquire the globalMutex.
Environment
- VirtualGL 3.1.2 (VirtualGL-3.1.2-1.el9.x86_64)
- NVIDIA 580.95.05, RHEL 9.6
- GLX back end (VGL_DISPLAY set to an X display)
Description
__cxa_throw
libvglfaker.so(+0x25e48)
libvglfaker.so(+0xa7005)
libvglfaker.so(+0x87fb5)
libvglfaker.so(eglDestroyContext+0x23e)
libGLX_nvidia.so.0(+0x9f9da)
libGLX_nvidia.so.0(+0x9e564)
libGLX_nvidia.so.0(+0x51eaf) <- from __run_exit_handlers
Catching util::Error at the callsite shows: method=[CriticalSection::lock()] what=[Invalid argument]
Throw is from util/Mutex.cpp:
if((ret = pthread_mutex_lock(&mutex)) != 0 && errorCheck)
throw(Error("CriticalSection::lock()", strerror(ret)));
strerror(EINVAL) is "Invalid argument"
The throw ends up in C which just calls abort.
It looks like _eglDestroyContext is set by FUNCDEF2 which calls CHECKSYM, and it tries to resolve a null symbol by acquiring the globalMutex.
I think just adding the TRY() / CATCH_EGL() here will avoid the exception making it to C to avoid a crash (and large coredump). I'm not sure exactly what the faker needs to be doing here during context destruction though to know if this good enough.
I tried to reproduce this with a smaller application but couldn't get it to crash. The large app that is causing this is proprietary, sadly. Perhaps this has to do with global destruction ordering. Anyways, try/catch is probably an easy win.
libGLX_nvidia calls the faker's
eglDestroyContextafter global destruction has started and crashes when trying to acquire theglobalMutex.Environment
Description
__cxa_throw libvglfaker.so(+0x25e48) libvglfaker.so(+0xa7005) libvglfaker.so(+0x87fb5) libvglfaker.so(eglDestroyContext+0x23e) libGLX_nvidia.so.0(+0x9f9da) libGLX_nvidia.so.0(+0x9e564) libGLX_nvidia.so.0(+0x51eaf) <- from __run_exit_handlersCatching util::Error at the callsite shows:
method=[CriticalSection::lock()] what=[Invalid argument]Throw is from util/Mutex.cpp:
strerror(EINVAL) is "Invalid argument"
The throw ends up in C which just calls abort.
It looks like _eglDestroyContext is set by FUNCDEF2 which calls CHECKSYM, and it tries to resolve a null symbol by acquiring the
globalMutex.I think just adding the TRY() / CATCH_EGL() here will avoid the exception making it to C to avoid a crash (and large coredump). I'm not sure exactly what the faker needs to be doing here during context destruction though to know if this good enough.
I tried to reproduce this with a smaller application but couldn't get it to crash. The large app that is causing this is proprietary, sadly. Perhaps this has to do with global destruction ordering. Anyways, try/catch is probably an easy win.