Skip to content

SIGSEGV in the loader's vkBeginCommandBuffer while another thread's vkEnumeratePhysicalDevices unloads unused ICDs #2113

Open

Description

@BohnBawerick

Versions

  • Loader: libvulkan1 1.4.341.0-1 (Ubuntu 26.04)
  • Driver: mesa-vulkan-drivers 26.0.8-1ubuntu0.3, lavapipe; all Mesa ICDs installed (asahi, gfxstream, intel, intel_hasvk, lvp, nouveau, radeon, virtio), no GPU
  • Application: wgpu / wgpu-hal 30.0.1, Vulkan backend, x86_64

Reproduction

One process, two threads, each creating its own wgpu instance and device on lavapipe and rendering:

  1. docker run ubuntu:26.04, install mesa-vulkan-drivers libvulkan1.
  2. Set WGPU_BACKEND=vulkan; leave VK_DRIVER_FILES and VK_ICD_FILENAMES unset.
  3. Run a Rust test binary whose two tests run in parallel, each creating a wgpu instance (enumerating adapters) and then encoding and submitting render passes in a loop.

Rates

  • Loader unrestricted: SIGSEGV in 9 of 25 runs.
  • VK_DRIVER_FILES=/usr/share/vulkan/icd.d/lvp_icd.json (same container, same binary): 0 of 30 runs.

Mechanism

Thread A is inside the loader's vkEnumeratePhysicalDevices for its new instance, which calls dlclose on an ICD library it found no device for. At the same moment thread B, using a device created earlier on lavapipe, calls vkBeginCommandBuffer and faults inside the loader's dispatch. Limiting the loader to one ICD, so nothing is unloaded, removes the crash.

Loader log of a crashing run (VK_LOADER_DEBUG=all)

One more unrestricted run with the loader's log on crashed on its second try. What the log shows:

  • On every instance creation the loader loads all installed ICDs, finds a physical device only on lavapipe (llvmpipe (LLVM 21.1.8, 256 bits)), and logs seven removals in a row: Removing driver /usr/lib/x86_64-linux-gnu/libvulkan_radeon.so due to not having any physical devices, then gfxstream, intel_hasvk, nouveau, intel, asahi and virtio.
  • The last loader line before the fault is the removal of libvulkan_radeon.so, the first of that batch. The six removals that follow it in every earlier batch do not appear, so the fault came while radeon's removal was under way or just after it.
  • The implicit layer libVkLayer_MESA_device_select.so is loaded.

What the log does not show: its lines carry no thread id, and the loader logs nothing for vkBeginCommandBuffer. The threads come from gdb at the fault: the instance-creating thread is in dlclose under vkEnumeratePhysicalDevices, and the faulting thread is in the loader under vkBeginCommandBuffer on a device created earlier. That the radeon removal is the dlclose in progress is consistent with both, but the log alone does not prove it.

Backtrace excerpt (gdb, all threads; symbols for libvulkan.so.1 not installed)

Thread B, faulting:

Thread 3 "polygon_tool_co" received signal SIGSEGV, Segmentation fault.
#0  0x00007025c693e6fe in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
#1  0x00007025c693734b in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
#2  0x00007025c6936f88 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
#3  <wgpu_hal::vulkan::CommandEncoder as wgpu_hal::CommandEncoder>::begin_encoding ()
#4  <wgpu_core::device::queue::PendingWrites>::activate ()
#5  <wgpu_core::device::queue::Queue>::write_texture ()

Thread A, at the same moment:

Thread 2 "bracket_renders":
#0  0x00007025c71340ec in ?? () from /lib64/ld-linux-x86-64.so.2
#1  0x00007025c713471c in ?? () from /lib64/ld-linux-x86-64.so.2
#2  _dl_catch_exception () from /lib64/ld-linux-x86-64.so.2
#3  0x00007025c7133659 in ?? () from /lib64/ld-linux-x86-64.so.2
#4  0x00007025c6e56993 in ?? () from /usr/lib/x86_64-linux-gnu/libc.so.6
#5  dlclose () from /usr/lib/x86_64-linux-gnu/libc.so.6
#6  vkEnumeratePhysicalDevices () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
#7  ash::prelude::read_into_uninitialized_vector (enumerate_physical_devices)
#8  <wgpu_hal::vulkan::Instance as wgpu_hal::Instance>::enumerate_adapters ()

A second crash had thread B at the same loader frames under begin_encoding from a render pass (wgpu_core::command::render::encode_render_pass) instead of write_texture.

Not done: a run with the loader's debug symbols, to name the faulting loader function. Full logs are kept.

Activity

  1. charles-lunarg commented on Nov 17, 2026

    @charles-lunarg
    Collaborator

    This looks to be an issue fixed with #1866

    Could you use a newer loader (any loader post 1.4.344 should have the fix) to confirm that this is already fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions