Skip to content

[WSLg / D3D12] D3D12GetInterface() in /usr/lib/wsl/lib/libd3d12.so recurses into itself until the stack overflows (SIGSEGV) #42286

Open

Description

@chaoyen1980

Windows Version

Windows 11 25H2, build 26200.9711

WSL Version

WSL 3.0.5.0, kernel 6.18.58.1-1, WSLg 1.0.79

Are you using WSL 1, WSL 2, or WSLC?

  • WSL 2
  • WSL 1
  • WSLC

Kernel Version

6.18.58.1-1

Distro Version

Ubuntu 24.04

Other Software

  • Windows 11 25H2 (10.0.26200.9711)
  • WSL 3.0.5.0, kernel 6.18.58.1-1, WSLg 1.0.79
  • Direct3D (WSL) 1.611.1-81528511: libd3d12.so 801,840 bytes and
    libd3d12core.so 6,880,344 bytes, both dated 2023-10-20; DXCore 10.0.26100.1
  • NVIDIA RTX PRO 500 Blackwell Generation Laptop GPU, driver 32.0.15.9595
    (the crash happens before any adapter is used)
  • Ubuntu 24.04, DirectX-Headers from the distribution

Repro Steps

getif_probe.cpp:

#include <wsl/winadapter.h>
#include <directx/d3d12.h>
#include <dxguids/dxguids.h>
#include <cstdio>
int main()
{
    ID3D12DeviceFactory *factory = nullptr;
    printf("calling D3D12GetInterface\n"); fflush(stdout);
    HRESULT hr = D3D12GetInterface(CLSID_D3D12DeviceFactory, IID_PPV_ARGS(&factory));
    printf("DeviceFactory: %#x %p\n", (unsigned)hr, (void *)factory);
    return 0;
}
g++ -O1 -g $(pkg-config --cflags DirectX-Headers) -o getif_probe getif_probe.cpp \
    $(pkg-config --libs DirectX-Headers) -L/usr/lib/wsl/lib -Wl,-rpath,/usr/lib/wsl/lib -ld3d12
./getif_probe

Expected Behavior

D3D12GetInterface() returns the interface or an error code, as on Windows and
as libd3d12core.so's own export does on the same machine.

Actual Behavior

calling D3D12GetInterface
Segmentation fault (core dumped)
$ gdb -batch -ex run -ex 'bt 8' ./getif_probe
Program received signal SIGSEGV, Segmentation fault.
#0  pthread_mutex_lock () from /lib/x86_64-linux-gnu/libc.so.6
#1  ?? () from /usr/lib/wsl/lib/libd3d12.so
#2  ?? () from /usr/lib/wsl/lib/libd3d12.so
#3  D3D12GetInterface () from /usr/lib/wsl/lib/libd3d12.so
#4  D3D12GetInterface () from /usr/lib/wsl/lib/libd3d12.so
#5  D3D12GetInterface () from /usr/lib/wsl/lib/libd3d12.so
...

The full backtrace has 130,912 D3D12GetInterface frames; the faulting frame's
stack pointer is at the bottom of the 8 MB main-thread stack. In the disassembly
the recursive call is the indirect call *0x58(%rax) at
libd3d12.so+0xbbadc, returning to +0xbbadf.

Diagnostic Logs

04-attachments.zip

Repro sources attached; full write-up in the first comment. Related: #42280.

Activity

  1. github-actions commented on Nov 15, 2026

    @github-actions
    Contributor

    No logs.etl found in the archive. Make sure that you ran collect-wsl-logs.ps1 as administrator and that the logs.etl file is in the archive.

    Diagnostic information
    appxpackage.txt not found
    optional-components.txt not found
    No logs.etl found in archive.
    Error while parsing the logs. See action page for details
    
  2. chaoyen1980 commented on Nov 15, 2026

    @chaoyen1980
    Author

    On WSL2, D3D12GetInterface() from /usr/lib/wsl/lib/libd3d12.so crashes the
    process for most CLSIDs: the function calls itself about 130,000 times and the
    process dies with SIGSEGV when the stack runs out, with or without a device
    created first. A plain Linux program reproduces it; no Wine/Proton involved.

    libd3d12core.so exports a D3D12GetInterface of its own, and calling that one
    directly (dlsym on a dlopen handle for libd3d12core.so) does not crash. So
    libd3d12.so seems to forward to a pointer that resolves to its own export
    instead of the core's (both are D3D12GetInterface@@VER_1).

    CLSID libd3d12.so export libd3d12core.so export
    CLSID_D3D12Tools SIGSEGV S_OK
    CLSID_D3D12DeviceRemovedExtendedData SIGSEGV S_OK
    CLSID_D3D12DeviceFactory SIGSEGV S_OK after a device was created, E_NOINTERFACE before
    CLSID_D3D12Debug SIGSEGV DXGI_ERROR_SDK_COMPONENT_MISSING (no debug layer installed)
    CLSID_D3D12SDKConfiguration E_NOINTERFACE E_NOINTERFACE

    Consequence: on WSL, applications cannot use ID3D12DeviceFactory,
    ID3D12Tools, or the DRED settings reached through D3D12GetInterface()
    without crashing.

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