[WSLg / D3D12] `ID3D12PipelineState::GetCachedBlob()` and `ID3D12PipelineLibrary::StorePipeline()` crash with "double free or corruption"
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp, linux
- Domain
- computer-graphics
Research direction
The repro is pso_cache_probe.cpp, which calls GetCachedBlob() on a compute pipeline state and then StorePipeline() on a pipeline library created with CreatePipelineLibrary(nullptr, 0, ...). Build it with the g++ line in the issue and run it under gdb or with AddressSanitizer to get a backtrace at the abort. Done means both calls return instead of aborting, or CheckFeatureSupport stops reporting SINGLE_PSO and LIBRARY. The crash is likely in the WSL D3D12 translation layer (libd3d12.so), which may not be in this repository, so confirm where the backtrace lands before changing anything.
Written by the indexing model from the issue text.
Description
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
-
Direct3D (WSL) 1.611.1-81528511 (libd3d12.so/libd3d12core.so dated 2023-10-20), DXCore 10.0.26100.1
-
NVIDIA RTX PRO 500 Blackwell Generation Laptop GPU, driver 32.0.15.9595
-
Ubuntu 24.04, DirectX-Headers from the distribution
Repro Steps
pso_cache_probe.cpp (compute shader: any DXIL compute shader with an
embedded root signature; ours is compiled with
dxc -T cs_6_0 -E cs_main -Fh depthcopy_cs_main.h -Vn g_cs_main):
#include <wsl/winadapter.h>
#include <directx/d3d12.h>
#include <directx/dxcore.h>
#include <dxguids/dxguids.h>
#include <cstdio>
#include <cstring>
#include "depthcopy_cs_main.h" // const unsigned char g_cs_main[]
int main() {
IDXCoreAdapterFactory *f; IDXCoreAdapterList *l; IDXCoreAdapter *ad = nullptr;
const GUID attr[] = {DXCORE_ADAPTER_ATTRIBUTE_D3D12_GRAPHICS};
DXCoreCreateAdapterFactory(IID_PPV_ARGS(&f));
f->CreateAdapterList(1, attr, IID_PPV_ARGS(&l));
for (uint32_t i = 0; i < l->GetAdapterCount() && !ad; ++i) {
char desc[256] = {}; IDXCoreAdapter *a;
l->GetAdapter(i, IID_PPV_ARGS(&a));
a->GetProperty(DXCoreAdapterProperty::DriverDescription, sizeof(desc), desc);
if (strstr(desc, "NVIDIA")) ad = a;
}
ID3D12Device1 *dev; D3D12CreateDevice(ad, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&dev));
ID3D12RootSignature *rs; dev->CreateRootSignature(0, g_cs_main, sizeof(g_cs_main), IID_PPV_ARGS(&rs));
D3D12_COMPUTE_PIPELINE_STATE_DESC d = {}; d.pRootSignature = rs; d.CS = {g_cs_main, sizeof(g_cs_main)};
ID3D12PipelineState *p; dev->CreateComputePipelineState(&d, IID_PPV_ARGS(&p)); // S_OK
ID3DBlob *blob;
printf("GetCachedBlob...\n"); fflush(stdout);
p->GetCachedBlob(&blob); // aborts: double free or corruption (!prev)
ID3D12PipelineLibrary *lib; dev->CreatePipelineLibrary(nullptr, 0, IID_PPV_ARGS(&lib));
lib->StorePipeline(L"test", p); // also aborts (seen separately)
return 0;
}
g++ -O1 -g $(pkg-config --cflags DirectX-Headers) -o pso_cache_probe pso_cache_probe.cpp \
$(pkg-config --libs DirectX-Headers) -L/usr/lib/wsl/lib -Wl,-rpath,/usr/lib/wsl/lib -ld3d12 -ldxcore
./pso_cache_probe
Expected Behavior
As on Windows with the same GPU and driver: GetCachedBlob() returns a blob that
can be passed back in D3D12_*_PIPELINE_STATE_DESC::CachedPSO, and
StorePipeline() returns S_OK. Alternatively, CheckFeatureSupport should not
report SINGLE_PSO/LIBRARY when they are unsupported.
Actual Behavior
adapter: NVIDIA RTX PRO 500 Blackwell Generation Laptop GPU
CreateDevice: 0x00000000
CreateRootSignature: 0x00000000
CreateComputePipelineState: 0x00000000
GetCachedBlob: ...
double free or corruption (!prev)
Aborted (core dumped)
StorePipeline() on an empty library created with CreatePipelineLibrary(NULL, 0, ...)
aborts the same way (a LoadGraphicsPipeline() miss before it returns
E_INVALIDARG as expected).
Diagnostic Logs
No response
- Dominant language
- C++
- Stars
- 34.4k
- Forks
- 1.9k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 166
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/WSL
-
feature wsl2
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
microsoft/WSL#42306 · 3 comments ·
Maintainers usually reply within 1 day
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/WSL#42114 · 3 comments ·
Maintainers usually reply within 1 day
-
feature kernel wsl2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/WSL#41107 · 3 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
feature kernel
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/WSL#41054 · 9 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
feature GPU
Difficulty 1/5 1-3 hours Newbie friendliness 70/100
microsoft/WSL#13592 · 4 comments ·
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
nextcloud/passman-android#214 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
2026.11.0 fails to install on Intel macOS: requirements.txt pins cryptography==50.0.2 for Darwin x86_64May be free again A pull request for this issue was closed without being merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 87/100
esphome/esphome#22892 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
distante/esphome-components#50 · 1 comment ·
Maintainers usually reply within 1 day
-
arch-based hyprland
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
noctalia-dev/noctalia#5423 ·
Maintainers usually reply within 1 day