Out of bounds read in Swiftshader (CVE-2024-2626)
A crafted HTML page causes an out-of-bounds read in the SwiftShader GPU process, leading to a crash. An attacker could use this to crash the GPU process, but the report does not claim further impact.
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
Steps to reproduce the problem:
tested os:
Ubuntu 22.04
tested chromium version:
Chromium 121.0.6142.0
Chromium 113.0.5624.0(I believe it should be possible to reproduce earlier than this version.)
Stable & Beta & Dev & Canary
reproduce steps:
1 ./chrome --user-data-dir=/tmp/xx22 --incognito http://localhost:8000/crash.html --no-sandbox --disable-gpu
The console will immediately output information related to GPU process crashes.
Received signal 11 SEGV_ACCERR 52e00050cdd0
[1122/223124.339346:ERROR:gpu_process_host.cc(992)] GPU process exited unexpectedly: exit_code=139
[1122/223124.339401:WARNING:gpu_process_host.cc(1362)] The GPU process has crashed 1 time(s)
[1122/223127.773434:WARNING:sandbox_linux.cc(400)] InitializeSandbox() called with multiple threads in process gpu-process.
Problem Description:
2.For more detailed information, it is necessary to use GDB to attach the GPU process. The following is the information I get from GDB.
Thread 3 "Thread<01>" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f28dc7ff640 (LWP 2763744)]
0x00007f28edc3f37a in ?? ()
(gdb) bt
#0 0x00007f28edc3f37a in ()
#1 0x00007fff00007fff in ()
#2 0x00007fff00007fff in ()
#3 0x00003a3407c45380 in ()
#4 0x00003a3400039c30 in ()
#5 0x00007f28dc7fb190 in ()
#6 0x00007f28e9cd0cc6 in sw::SpirvEmitter::getImageSampler(vk::Device const*, unsigned int, unsigned int, unsigned int) (device=<optimized out>, signature=<optimized out>, samplerId=<optimized out>, imageViewId=<optimized out>) at ../../third_party/swiftshader/src/Pipeline/SpirvShaderSampling.cpp:125
#7 0x00007f28e9b9a8c6 in std::__Cr::__function::__policy_func<void ()>::operator()() const (this=0x7f28dc7fb730) at ../../third_party/libc++/src/include/__functional/function.h:856
#8 std::__Cr::function<void ()>::operator()() const (this=0x7f28dc7fb730) at ../../third_party/libc++/src/include/__functional/function.h:1170
#9 marl::Task::operator()() const (this=0x7f28dc7fb730) at ../../third_party/swiftshader/third_party/marl/include/marl/task.h:97
#10 marl::Scheduler::Worker::runUntilIdle()
(this=0x7f28e9bd971c <std::__Cr::__function::__policy_invoker<void ()>::__call_impl<std::__Cr::__function::__default_alloc_func<sw::DrawCall::processPixels(vk::Device*, marl::Poolsw::DrawCall::Loan const&, marl::Poolsw::DrawCall::BatchData::Loan const&, std::__Cr::shared_ptrmarl::Finally const&)::$_0, void ()> >(std::__Cr::__function::__policy_storage const*)+60>, this@entry=0x3a3400123800) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:703
#11 0x00007f28e9b9a2c0 in marl::Scheduler::Worker::runUntilShutdown() (this=<optimized out>) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:588
#12 marl::Scheduler::Worker::run() (this=this@entry=0x3a3400123800) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:581
#13 0x00007f28e9b9d0e7 in marl::Scheduler::Worker::start()::$_0::operator()() const (this=<optimized out>) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:385
#14 std::__Cr::__invokemarl::Scheduler::Worker::start()::$_0&(marl::Scheduler::Worker::start()::$_0&) (__f=<optimized out>) at ../../third_party/libc++/src/include/__type_traits/invoke.h:344
#15 std::__Cr::__invoke_void_return_wrapper<void, true>::__callmarl::Scheduler::Worker::start()::$_0&(marl::Scheduler::Worker::start()::$_0&) (__args=<optimized out>) at ../../third_party/libc++/src/include/__type_traits/invoke.h:419
#16 std::__Cr::__function::__default_alloc_func<marl::Scheduler::Worker::start()::$_0, void ()>::operator()() (this=<optimized out>) at ../../third_party/libc++/src/include/__functional/function.h:242
#17 std::__Cr::__function::__policy_invoker<void ()>::__call_impl<std::__Cr::__function::__default_alloc_func<marl::Scheduler::Worker::start()::$_0, void ()> >(std::__Cr::__function::__policy_storage const*) (__buf=<optimized out>) at ../../third_party/libc++/src/include/__functional/function.h:725
#18 0x00007f28e9ba02d0 in std::__Cr::__function::__policy_func<void ()>::operator()() const (this=0x3a3400aeca70) at ../../third_party/libc++/src/include/__functional/function.h:856
#19 std::__Cr::function<void ()>::operator()() const (this=0x3a3400aeca70) at ../../third_party/libc++/src/include/__functional/function.h:1170
#20 marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}::operator()() const (this=0x3a3400127f38) at ../../third_party/swiftshader/third_party/marl/src/thread.cpp:387
#21 std::__Cr::__invoke<marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}>(marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}&&) (__f=...) at ../../third_party/libc++/src/include/__type_traits/invoke.h:344
#22 _ZNSt4__Cr16__thread_executeINS_10unique_ptrINS_15__thread_structENS_14default_deleteIS2_EEEEZN4marl6Thread4ImplC1EONS7_8AffinityEONS_8functionIFvvEEEEUlvE_JETpTnmJEEEvRNS_5tupleIJT_T0_DpT1_EEENS_15__tuple_indicesIJXspT2_EEEE (__t=...) at ../../third_party/libc++/src/include/__thread/thread.h:220
#23 std::__Cr::__thread_proxy<std::__Cr::tuple<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_deletestd::__Cr::__thread_struct >, marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}> >(void*) (__vp=0x3a3400127f30)
at ../../third_party/libc++/src/include/__thread/thread.h:231
#24 0x00007f28f0494ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#25 0x00007f28f0526a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb)
Additional Comments:
**Chrome version: ** 119.0.0.0 **Channel: ** Stable
OS: Linux
Context
SwiftShader is the software rasteriser that Chrome falls back to when GPU acceleration is unavailable or disabled. It implements a Vulkan-style pipeline in software, and the component that turns SPIR-V shaders into executable code lives in third_party/swiftshader/src/Pipeline/. The report concerns sw::SpirvEmitter::getImageSampler in SpirvShaderSampling.cpp, the routine that resolves the sampler and image view used by a sampling instruction.
The bug is an out-of-bounds read (CVE-2024-2626) in that path. It was reported through the Chrome VRP by Cassidy Kim (@cassidy6564), rated medium severity, and a bounty of 10,000 USD was awarded. The report was disclosed on 19 March 2024.
Setup
The researcher tested on Ubuntu 22.04 with two Chromium builds:
- Chromium 121.0.6142.0
- Chromium 113.0.5624.0
The report notes the belief that earlier versions are probably also affected. The issue was reproduced across Stable, Beta, Dev and Canary channels. The Chrome version field in the report form lists [redacted] on the Stable channel, Linux.
Two tools are needed beyond the browser: a local HTTP server serving the test page, and GDB for attaching to the GPU process. The browser is launched with --no-sandbox and --disable-gpu, which forces the software path through SwiftShader.
Finding it
The trigger is a page loaded in incognito mode. When the page is opened, the GPU process crashes immediately, and the browser console prints the crash information. The signal is SIGSEGV with SEGV_ACCERR, and the GPU process exits with code 139. The report lists Stable, Beta, Dev and Canary among the tested builds.
Because the GPU process dies on its own, the interesting detail is only visible under a debugger. Attaching GDB to the GPU process shows the faulting thread stopped inside SwiftShader's sampling code, with the backtrace passing through sw::SpirvEmitter::getImageSampler. That is what identifies the bug as an out-of-bounds read in shader sampling rather than a generic GPU crash.
Exploitation
Step 1: serve the test page and launch Chromium
The researcher runs a local server on port 8000 and starts Chromium against crash.html:
./chrome --user-data-dir=/tmp/xx22 --incognito http://localhost:8000/crash.html --no-sandbox --disable-gpu
The command uses a separate profile directory, incognito mode, --no-sandbox and --disable-gpu; the report does not explain the flags. The page itself is not included in the report; only its effect is described.
Step 2: observe the GPU process crash
The console immediately reports the crash:
Received signal 11 SEGV_ACCERR 52e00050cdd0
[1122/223124.339346:ERROR:gpu_process_host.cc(992)] GPU process exited unexpectedly: exit_code=139
[1122/223124.339401:WARNING:gpu_process_host.cc(1362)] The GPU process has crashed 1 time(s)
[1122/223127.773434:WARNING:sandbox_linux.cc(400)] InitializeSandbox() called with multiple threads in process gpu-process.
SEGV_ACCERR means the access hit a page whose permissions do not allow it, and exit code 139 is the shell's encoding of a segmentation fault. The sandbox warning is incidental to the crash.
Step 3: attach GDB to the GPU process
To get a useful stack, the researcher attaches GDB to the GPU process. The faulting thread reports:
Thread 3 "Thread<01>" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f28dc7ff640 (LWP 2763744)]
0x00007f28edc3f37a in ?? ()
The backtrace then shows the call chain:
(gdb) bt
#0 0x00007f28edc3f37a in ()
#1 0x00007fff00007fff in ()
#2 0x00007fff00007fff in ()
#3 0x00003a3407c45380 in ()
#4 0x00003a3400039c30 in ()
#5 0x00007f28dc7fb190 in ()
#6 0x00007f28e9cd0cc6 in sw::SpirvEmitter::getImageSampler(vk::Device const*, unsigned int, unsigned int, unsigned int) (device=<optimized out>, [redacted] out>, samplerId=<optimized out>, imageViewId=<optimized out>) at ../../third_party/swiftshader/src/Pipeline/SpirvShaderSampling.cpp:125
#7 0x00007f28e9b9a8c6 in std::__Cr::__function::__policy_func<void ()>::operator()() const (this=0x7f28dc7fb730) at ../../third_party/libc++/src/include/__functional/function.h:856
#8 std::__Cr::function<void ()>::operator()() const (this=0x7f28dc7fb730) at ../../third_party/libc++/src/include/__functional/function.h:1170
#9 marl::Task::operator()() const (this=0x7f28dc7fb730) at ../../third_party/swiftshader/third_party/marl/include/marl/task.h:97
#10 marl::Scheduler::Worker::runUntilIdle()
(this=0x7f28e9bd971c <std::__Cr::__function::__policy_invoker<void ()>::__call_impl<std::__Cr::__function::__default_alloc_func<sw::DrawCall::processPixels(vk::Device*, marl::Pool<sw::DrawCall>::Loan const&, marl::Pool<sw::DrawCall::BatchData>::Loan const&, std::__Cr::shared_ptr<marl::Finally> const&)::$_0, void ()> >(std::__Cr::__function::__policy_storage const*)+60>, this@entry=0x3a3400123800) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:703
#11 0x07f28e9b9a2c0 in marl::Scheduler::Worker::runUntilShutdown() (this=<optimized out>) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:588
#12 marl::Scheduler::Worker::run() (this=this@entry=0x3a3400123800) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:581
#13 0x00007f28e9b9d0e7 in marl::Scheduler::Worker::start()::$_0::operator()() const (this=<optimized out>) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:385
#14 std::__Cr::__invoke<marl::Scheduler::Worker::start()::$_0&>(marl::Scheduler::Worker::start()::$_0&) (__f=<optimized out>) at ../../third_party/libc++/src/include/__type_traits/invoke.h:344
#15 std::__Cr::__invoke_void_return_wrapper<void, true>::__call<marl::Scheduler::Worker::start()::$_0&>(marl::Scheduler::Worker::start()::$_0&) (__args=<optimized out>) at ../../third_party/libc++/src/include/__type_traits/invoke.h:419
#16 std::__Cr::__function::__default_alloc_func<marl::Scheduler::Worker::start()::$_0, void ()>::operator()() (this=<optimized out>) at ../../third_party/libc++/src/include/__functional/function.h:242
#17 std::__Cr::__function::__policy_invoker<void ()>::__call_impl<std::__Cr::__function::__default_alloc_func<marl::Scheduler::Worker::start()::$_0, void ()> >(std::__Cr::__function::__policy_storage const*) (__buf=<optimized out>) at ../../third_party/libc++/src/include/__functional/function.h:725
#18 0x00007f28e9ba02d0 in std::__Cr::__function::__policy_func<void ()>::operator()() const (this=0x3a3400aeca70) at ../../third_party/libc++/src/include/__functional/function.h:856
#19 std::__Cr::function<void ()>::operator()() const (this=0x3a3400aeca70) at ../../third_party/libc++/src/include/__functional/function.h:1170
#20 marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}::operator()() const (this=0x3a3400127f38) at ../../third_party/swiftshader/third_party/marl/src/thread.cpp:387
#21 std::__Cr::__invoke<marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}>(marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}&&) (__f=...) at ../../third_party/libc++/src/include/__type_traits/invoke.h:344
#22 [redacted] (__t=...) at ../../third_party/libc++/src/include/__thread/thread.h:220
#23 std::__Cr::__thread_proxy<std::__Cr::tuple<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_delete<std::__Cr::__thread_struct> >, marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}> >(void*) (__vp=0x3a3400127f30)
at ../../third_party/libc++/src/include/__thread/thread.h:231
#24 0x00007f28f0494ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#25 0x00007f28f0526a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb)
The key frame is #6: getImageSampler at SpirvShaderSampling.cpp:125. It is reached from sw::DrawCall::processPixels running on a marl scheduler worker thread, which is how SwiftShader parallelises pixel work. The frames above #6 are unresolved addresses, consistent with the fault occurring inside the sampling routine itself. The arguments signature, samplerId and imageViewId are all shown as <optimized out>, so the report does not record their values.
Root cause
The crash is an out-of-bounds read inside sw::SpirvEmitter::getImageSampler, the function that maps a shader's sampler and image view identifiers to the underlying SwiftShader objects. The report does not include the source of the function or the exact expression that reads out of bounds, so the precise indexing mistake is not documented here. What the backtrace establishes is that the fault happens at line 125 of SpirvShaderSampling.cpp while resolving a sampler for a draw call, and that the access is rejected by the page permissions (SEGV_ACCERR), which is the signature of a read past a valid mapping.
Why existing defences did not stop it is not discussed in the report. The log shows InitializeSandbox() being called in the GPU process; the report does not discuss the sandbox further.
Impact
The report classifies the issue as an out-of-bounds read in SwiftShader. In the observed case the consequence is a GPU process crash triggered by loading a page. The report does not demonstrate any information disclosure or sandbox escape, and it does not describe what data, if any, the out-of-bounds read exposes. The conditions are those of the reproduction: software rendering via SwiftShader, which the researcher forced with --disable-gpu, on Linux, across all release channels tested.
Fix
The issue is tracked as CVE-2024-2626 and was handled through the Chrome VRP; the change that addressed it is not part of the text.
Variants to test
- Other sampling instructions. The crash is in the sampler resolution path. Shaders that combine sampling with unusual sampler or image view identifiers, including identifiers at the edges of the binding range, are worth trying; a positive result is a GPU process crash with
getImageSamplerin the backtrace. - Different SwiftShader entry points. Other SwiftShader entry points that resolve resources by index could be worth testing. Fuzzing shader modules that reference resources outside the declared set, and watching for
SEGV_ACCERRin the GPU process, is a reasonable next step. - Older and newer builds. The researcher reproduced on 113 and 121 and believed earlier versions were affected. Running the same page against a range of builds would show which versions are affected.
- Channels and platforms. The issue reproduced on Stable, Beta, Dev and Canary on Linux. Testing other operating systems with GPU acceleration disabled checks whether the software path is reachable there in the same way.
What happened, in plain words
A security researcher found a way to make a part of Google Chrome called SwiftShader crash just by opening a web page. SwiftShader is a piece of software inside Chrome that draws graphics using the computer's main processor (the CPU) instead of the graphics card (the GPU). Chrome uses it when there is no usable graphics card, or when graphics acceleration has been switched off.
The crash happens in a specific routine that works out which image and which sampling settings a drawing instruction should use. The issue is classed as an out-of-bounds read. The result in the observed case is that the part of Chrome responsible for graphics, the GPU process, dies. The researcher reported it through Google's Chrome Vulnerability Reward Program (VRP), the scheme that pays people for finding and reporting security bugs. It was rated medium severity, given the identifier CVE-2024-2626, and a bounty of 10,000 USD was awarded. The report was disclosed on 19 March 2024.
This article walks through the report step by step, explaining each idea from scratch as it appears.
Some background first
What a browser process and a GPU process are
Modern browsers do not do everything in one program. They split the work into several processes, which are separate running programs that the operating system keeps apart from each other. One process handles the page you see, another handles graphics, another may handle network traffic. The benefit is isolation: if one process misbehaves, the others can keep going. The graphics process is called the GPU process, even when it is not using a real GPU.
What SwiftShader is
A GPU is the chip that specialises in drawing images quickly. When Chrome cannot use one, or when a person starts Chrome with graphics acceleration turned off, Chrome needs another way to draw. SwiftShader is that other way: it performs the same drawing work in ordinary software on the CPU. It is a software rasteriser, meaning it turns shapes and colours into the pixels you see, without special hardware.
SwiftShader implements a graphics interface modelled on Vulkan, a standard way for programs to talk to graphics hardware. Part of that work is taking small programs called shaders and turning them into something the machine can run. Shaders are written in an intermediate form called SPIR-V. The code that translates SPIR-V lives in a folder inside the Chrome source tree, third_party/swiftshader/src/Pipeline/.
The function at the centre of the report
The report concerns one function, sw::SpirvEmitter::getImageSampler, in the file SpirvShaderSampling.cpp. Its job is to resolve, for a sampling instruction, which sampler and which image view are meant. A sampler holds settings such as how to blend neighbouring pixels; an image view is a way of referring to an image. The function takes identifiers for these and looks up the matching objects.
What an out-of-bounds read is
Computer memory is laid out in numbered locations, and a program is only allowed to use the locations that belong to it. An out-of-bounds read happens when a program asks for a location outside the area it was given. Think of a row of numbered lockers: reading out of bounds is like reaching for locker number 500 when the row only goes up to 100. Sometimes you grab something that belongs to someone else, sometimes the building's alarm goes off. In this report the result was a crash.
Setting up
The researcher tested on Ubuntu 22.04, a version of the Linux operating system, using two builds of Chromium, the open-source browser that Chrome is built from:
- Chromium 121.0.6142.0
- Chromium 113.0.5624.0
The report notes the belief that earlier versions are probably also affected. The issue was reproduced on the Stable, Beta, Dev and Canary channels. Those channels are the different release tracks Chrome offers: Stable is the ordinary release, Beta is the next one being tested, Dev is earlier still, and Canary is the most experimental. The Chrome version field in the report form lists [redacted] on the Stable channel, on Linux.
Beyond the browser, two tools are needed. The first is a local HTTP server, a small program that serves files over the network to your own machine, so the test page can be loaded as if it were on a website. The second is GDB, the GNU Debugger, a tool that lets you pause a running program and inspect what it is doing. The browser is started with two flags, --no-sandbox and --disable-gpu. The second forces the software path through SwiftShader, which is where the bug lives.
Finding it
The trigger is a page loaded in incognito mode, the mode that avoids keeping history and cached data. When the page is opened, the GPU process crashes immediately and the browser console prints the crash information. The signal is SIGSEGV with SEGV_ACCERR, and the GPU process exits with code 139. A signal is a message the operating system sends to a program to tell it something has gone wrong; SIGSEGV means the program touched memory it was not allowed to. The report lists Stable, Beta, Dev and Canary among the tested builds.
Because the GPU process dies on its own, the useful detail is only visible under a debugger. Attaching GDB to the GPU process shows the faulting thread stopped inside SwiftShader's sampling code, with the backtrace passing through sw::SpirvEmitter::getImageSampler. A backtrace is the list of function calls that led to the current point, like a stack of letters each saying who sent it. That is what identifies the bug as an out-of-bounds read in shader sampling rather than a generic graphics crash.
Reproducing it
Step 1: serve the test page and launch Chromium
The researcher runs a local server on port 8000 and starts Chromium against crash.html:
./chrome --user-data-dir=/tmp/xx22 --incognito http://localhost:8000/crash.html --no-sandbox --disable-gpu
Line by line:
./chromeruns the Chromium program from the current folder.--user-data-dir=/tmp/xx22tells the browser to keep its profile data in the folder/tmp/xx22.--incognitoopens a private window.http://localhost:8000/crash.htmlis the address of the test page on the local server.localhostmeans this same computer, and8000is the port, a numbered doorway on the machine that the server listens on.--no-sandboxturns off the browser's sandbox for this run. The sandbox is a set of restrictions that limits what a process can do.--disable-gpuswitches off graphics acceleration, which forces the software rendering path where SwiftShader handles the shader.
The page itself is not included in the report; only its effect is described.
Step 2: observe the GPU process crash
The console immediately reports the crash:
Received signal 11 SEGV_ACCERR 52e00050cdd0
[1122/223124.339346:ERROR:gpu_process_host.cc(992)] GPU process exited unexpectedly: exit_code=139
[1122/223124.339401:WARNING:gpu_process_host.cc(1362)] The GPU process has crashed 1 time(s)
[1122/223127.773434:WARNING:sandbox_linux.cc(400)] InitializeSandbox() called with multiple threads in process gpu-process.
Line by line:
Received signal 11 SEGV_ACCERR 52e00050cdd0says the process received signal number 11, which isSIGSEGV, with the sub-reasonSEGV_ACCERR.SEGV_ACCERRmeans the access hit a page of memory whose permissions do not allow it. The long hexadecimal value is an address associated with the fault.- The second line is an error from the component that manages the GPU process: the process exited unexpectedly with code 139. Exit code 139 is how a shell reports a program killed by a segmentation fault.
- The third line is a warning that the GPU process has crashed once.
- The fourth line is a warning from the Linux sandbox code saying
InitializeSandbox()was called with multiple threads in the GPU process. This is incidental to the crash.
Step 3: attach GDB to the GPU process
To get a useful stack, the researcher attaches GDB to the GPU process. The faulting thread reports:
Thread 3 "Thread<01>" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f28dc7ff640 (LWP 2763744)]
0x00007f28edc3f37a in ?? ()
Line by line:
- The first line says thread number 3, named
Thread<01>, receivedSIGSEGV, a segmentation fault. A thread is one line of execution inside a process; a process can have several running at once. - The second line says the debugger switched its attention to that thread, identified by an address and a lightweight process identifier (LWP).
- The third line shows the instruction address where execution stopped. The
??means the debugger could not match that address to a named function.
The backtrace then shows the call chain:
(gdb) bt
#0 0x00007f28edc3f37a in ()
#1 0x00007fff00007fff in ()
#2 0x00007fff00007fff in ()
#3 0x00003a3407c45380 in ()
#4 0x00003a3400039c30 in ()
#5 0x00007f28dc7fb190 in ()
#6 0x00007f28e9cd0cc6 in sw::SpirvEmitter::getImageSampler(vk::Device const*, unsigned int, unsigned int, unsigned int) (device=<optimized out>, [redacted] out>, samplerId=<optimized out>, imageViewId=<optimized out>) at ../../third_party/swiftshader/src/Pipeline/SpirvShaderSampling.cpp:125
#7 0x00007f28e9b9a8c6 in std::__Cr::__function::__policy_func<void ()>::operator()() const (this=0x7f28dc7fb730) at ../../third_party/libc++/src/include/__functional/function.h:856
#8 std::__Cr::function<void ()>::operator()() const (this=0x7f28dc7fb730) at ../../third_party/libc++/src/include/__functional/function.h:1170
#9 marl::Task::operator()() const (this=0x7f28dc7fb730) at ../../third_party/swiftshader/third_party/marl/include/marl/task.h:97
#10 marl::Scheduler::Worker::runUntilIdle()
(this=0x7f28e9bd971c <std::__Cr::__function::__policy_invoker<void ()>::__call_impl<std::__Cr::__function::__default_alloc_func<sw::DrawCall::processPixels(vk::Device*, marl::Pool<sw::DrawCall>::Loan const&, marl::Pool<sw::DrawCall::BatchData>::Loan const&, std::__Cr::shared_ptr<marl::Finally> const&)::$_0, void ()> >(std::__Cr::__function::__policy_storage const*)+60>, this@entry=0x3a3400123800) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:703
#11 0x00007f28e9b9a2c0 in marl::Scheduler::Worker::runUntilShutdown() (this=<optimized out>) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:588
#12 marl::Scheduler::Worker::run() (this=this@entry=0x3a3400123800) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:581
#13 0x00007f28e9b9d0e7 in marl::Scheduler::Worker::start()::$_0::operator()() const (this=<optimized out>) at ../../third_party/swiftshader/third_party/marl/src/scheduler.cpp:385
#14 std::__Cr::__invoke<marl::Scheduler::Worker::start()::$_0&>(marl::Scheduler::Worker::start()::$_0&) (__f=<optimized out>) at ../../third_party/libc++/src/include/__type_traits/invoke.h:344
#15 std::__Cr::__invoke_void_return_wrapper<void, true>::__call<marl::Scheduler::Worker::start()::$_0&>(marl::Scheduler::Worker::start()::$_0&) (__args=<optimized out>) at ../../third_party/libc++/src/include/__type_traits/invoke.h:419
#16 std::__Cr::__function::__default_alloc_func<marl::Scheduler::Worker::start()::$_0, void ()>::operator()() (this=<optimized out>) at ../../third_party/libc++/src/include/__functional/function.h:242
#17 std::__Cr::__function::__policy_invoker<void ()>::__call_impl<std::__Cr::__function::__default_alloc_func<marl::Scheduler::Worker::start()::$_0, void ()> >(std::__Cr::__function::__policy_storage const*) (__buf=<optimized out>) at ../../third_party/libc++/src/include/__functional/function.h:725
#18 0x00007f28e9ba02d0 in std::__Cr::__function::__policy_func<void ()>::operator()() const (this=0x3a3400aeca70) at ../../third_party/libc++/src/include/__functional/function.h:856
#19 std::__Cr::function<void ()>::operator()() const (this=0x3a3400aeca70) at ../../third_party/libc++/src/include/__functional/function.h:1170
#20 marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}::operator()() const (this=0x3a3400127f38) at ../../third_party/swiftshader/third_party/marl/src/thread.cpp:387
#21 std::__Cr::__invoke<marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}>(marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}&&) (__f=...) at ../../third_party/libc++/src/include/__type_traits/invoke.h:344
#22 [redacted] (__t=...) at ../../third_party/libc++/src/include/__thread/thread.h:220
#23 std::__Cr::__thread_proxy<std::__Cr::tuple<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_delete<std::__Cr::__thread_struct> >, marl::Thread::Impl::Impl(marl::Thread::Affinity&&, std::__Cr::function<void ()>&&)::{lambda()#1}> >(void*) (__vp=0x3a3400127f30)
at ../../third_party/libc++/src/include/__thread/thread.h:231
#24 0x00007f28f0494ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#25 0x00007f28f0526a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
(gdb)
How to read this:
(gdb) btis the command typed into the debugger.btstands for backtrace, and it asks GDB to print the chain of calls.- Each numbered line is one frame, one step in the chain. Frame
#0is where the crash happened, and the numbers increase as you go back up towards the code that started the thread. - Frames
#0to#5show addresses with no function name, marked??or empty parentheses. These are unresolved addresses, consistent with the fault occurring inside the sampling routine itself. - Frame
#6is the key one:sw::SpirvEmitter::getImageSampleratSpirvShaderSampling.cpp:125. The text after the function name lists its parameters: a device pointer, and three unsigned integers namedsignature,samplerIdandimageViewId. Each is shown as<optimized out>, which means the compiler removed the stored values to make the program faster, so the debugger cannot show them. The report therefore does not record their values. - Frames
#7and#8are standard library wrappers for calling a function stored in a variable, a common pattern in C++. - Frame
#9is a task being run by marl, a small library SwiftShader uses to spread work across several threads. - Frame
#10shows the task came fromsw::DrawCall::processPixels, the routine that processes the pixels of a draw call. A draw call is one instruction to draw something. This is how SwiftShader parallelises pixel work. - Frames
#11to#13are the marl scheduler's worker loop, the machinery that keeps a worker thread busy until it is told to stop. - Frames
#14to#23are the standard library plumbing that starts a thread and runs the worker function on it. - Frames
#24and#25are the operating system functions that create a thread and clone the process, the lowest level of the chain.
Root cause
The crash is an out-of-bounds read inside sw::SpirvEmitter::getImageSampler, the function that maps a shader's sampler and image view identifiers to the underlying SwiftShader objects. The report does not include the source of the function or the exact expression that reads out of bounds, so the precise indexing mistake is not documented here. What the backtrace establishes is that the fault happens at line 125 of SpirvShaderSampling.cpp while resolving a sampler for a draw call, and that the access is rejected by the page permissions (SEGV_ACCERR), which is the signature of a read past a valid mapping.
Why existing defences did not stop it is not discussed in the report. The log shows InitializeSandbox() being called in the GPU process; the report does not discuss the sandbox further.
Impact
The report classifies the issue as an out-of-bounds read in SwiftShader. In the observed case the consequence is a GPU process crash triggered by loading a page. The report does not demonstrate any information disclosure or sandbox escape, and it does not describe what data, if any, the out-of-bounds read exposes. The conditions are those of the reproduction: software rendering via SwiftShader, which the researcher forced with --disable-gpu, on Linux, across all release channels tested.
Fix
The report does not describe the fix. The issue is tracked as CVE-2024-2626 and was handled through the Chrome VRP; the change that addressed it is not part of the text.
Variants to test
- Other sampling instructions. The crash is in the sampler resolution path. Shaders that combine sampling with unusual sampler or image view identifiers, including identifiers at the edges of the binding range, are worth trying; a positive result is a GPU process crash with
getImageSamplerin the backtrace. - Different SwiftShader entry points. Other SwiftShader entry points that resolve resources by index could be worth testing. Fuzzing shader modules that reference resources outside the declared set, and watching for
SEGV_ACCERRin the GPU process, is a reasonable next step. Fuzzing means feeding a program many varied inputs automatically and watching for failures. - Older and newer builds. The researcher reproduced on 113 and 121 and believed earlier versions were affected. Running the same page against a range of builds would show which versions are affected.
- Channels and platforms. The issue reproduced on Stable, Beta, Dev and Canary on Linux. Testing other operating systems with GPU acceleration disabled checks whether the software path is reachable there in the same way.
Glossary
- Backtrace: the list of function calls that led to the current point in a program, printed by a debugger.
- Bounty: a payment made by a company to someone who reports a security bug to it.
- Canary: the most experimental release channel of Chrome, updated most often.
- Chrome VRP: the Chrome Vulnerability Reward Program, Google's scheme for paying people who report security bugs in Chrome.
- Chromium: the open-source browser project that Google Chrome is built from.
- CVE: a public identifier for a known security vulnerability, such as CVE-2024-2626.
- Denial of service: a failure that stops a service or component from working, without necessarily stealing anything.
- Draw call: one instruction to a graphics system to draw something.
- Exit code: a number a program returns when it ends, used to say whether it finished normally or crashed.
- Flag: an option given on a program's command line to change its behaviour.
- Frame: one entry in a backtrace, representing one function call.
- Fuzzing: feeding a program many varied inputs automatically and watching for failures.
- GDB: the GNU Debugger, a tool for pausing a running program and inspecting its state.
- GPU: graphics processing unit, the chip that specialises in drawing images.
- GPU process: the separate process in a browser that handles graphics work.
- HTTP server: a program that serves files over the network, here used locally to serve a test page.
- Incognito mode: a browser mode that avoids keeping history and cached data.
- LWP: lightweight process identifier, a number the operating system uses to identify a thread.
- marl: a small library SwiftShader uses to spread work across several threads.
- Out-of-bounds read: reading from a memory location outside the area a program is allowed to use.
- Port: a numbered doorway on a machine that a network service listens on, such as 8000.
- Process: a running program that the operating system keeps separate from other programs.
- Rasteriser: software or hardware that turns shapes and colours into the pixels you see.
- Sampler: in graphics, the settings that control how an image is read, such as how neighbouring pixels are blended.
- Sandbox: a set of restrictions that limits what a process is allowed to do.
- Segmentation fault: a crash caused by a program touching memory it is not allowed to touch, reported as
SIGSEGV. - Shader: a small program that runs as part of drawing graphics.
- Signal: a message the operating system sends to a program to tell it something has gone wrong.
- SPIR-V: an intermediate form in which shaders are written before being translated for execution.
- SwiftShader: Chrome's software renderer, which draws graphics on the CPU when a GPU cannot be used.
- Thread: one line of execution inside a process; a process can have several running at once.
- Vulkan: a standard interface for programs to talk to graphics hardware.
SEGV_ACCERR: the sub-reason for a segmentation fault meaning the access hit a memory page whose permissions do not allow it.