Segfault in libGL when OpenGL and Vulkan calls are interleaved

It appears with certain combination of GL/Vulkan calls it is possible to make libGL segfault. Initially found when investigating issue in recent Hitman update:

Attached minimal reproducer (assumes presence of SDL2 and Vulkan) and nvidia-bug-report output.

output in dmesg upon segfault:

[10191.383917] NVRM: Xid (PCI:0000:01:00): 31, Ch 00000018, engmask 00000111, intr 10000000

gdb stacktrace:

Program received signal SIGSEGV, Segmentation fault.
0x00007fffe9beb460 in ?? ()
(gdb) bt
#0  0x00007fffe9beb460 in ?? ()
#1  0x00007fffec490619 in ?? () from /usr/lib64/nvidia/
#2  0x00007fffec48aab9 in ?? () from /usr/lib64/nvidia/
#3  0x00007fffec483ca6 in glXGetProcAddress () from /usr/lib64/nvidia/
#4  0x00007ffff7b7f3e6 in X11_GL_LoadLibrary (_this=0x60d420, path=<optimized out>) at /usr/src/debug/SDL2-2.0.5/src/video/x11/SDL_x11opengl.c:193
#5  0x00007ffff7b6f836 in SDL_GL_LoadLibrary_REAL (path=path@entry=0x0) at /usr/src/debug/SDL2-2.0.5/src/video/SDL_video.c:2729
#6  0x00007ffff7b71779 in SDL_CreateWindow_REAL (title=0x4008b4 "", x=<optimized out>, y=0, w=1, h=1, flags=26) at /usr/src/debug/SDL2-2.0.5/src/video/SDL_video.c:1371
#7  0x0000000000400827 in main (argc=1, argv=0x7fffffffd268) at reproducer.c:11

reproducer.c (328 Bytes)
Makefile.txt (180 Bytes)

As pointed out by Feral Interactive support it was caused by incorrect library path in vulkan icd file (distribution without glvnd enabled libGL).

Please test with 384.47 driver .