Crash during process exit when using libGLX_nvidia

未关闭
#290 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
cpp
领域
backend

调研方向

Start with util/Mutex.cpp and trace the eglDestroyContext path through FUNCDEF2, CHECKSYM, and the EGL wrapper mentioned in the issue. Check how TRY() and CATCH_EGL() are used around similar calls, then assess the proposed exception handling against context destruction during global teardown. Done means the Nvidia GLX exit path no longer lets a C++ exception escape into C and abort.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C++
星标
830
派生
116
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

VirtualGL/virtualgl 的其他 Issue

查看 VirtualGL/virtualgl 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。