Skip to content
Memory corruption Advisory Advanced CVE-2026-11051

Out of bounds read in ANGLE (CVE-2026-11051)

A heap buffer over-read in Mesa's RadeonSI driver occurs when a fragment shader declares a scalar output and a specific blend state is used, causing the driver to read four constant components from an array allocated for only one. An attacker could potentially disclose GPU process memory via WebGL2 in Chrome on Linux with AMD GPUs.

c6eed09fc8b174b0f3eebedcceb1e792 Follow

Originally disclosed on Chrome VRP

  • Fix shipped in 2 months

Heap buffer over-read in Mesa RadeonSI noop-blend analysis for scalar fragment outputs leads to GPU process memory disclosure

Summary

A heap buffer over-read exists in Mesa's RadeonSI driver during the noop-blend shader analysis, reachable from Chrome's GPU process via WebGL2 on Linux. When a fragment shader declares a scalar output (e.g. out float) and the blend state is DST_COLOR * src + ZERO * dst, the driver's get_output_as_const_value function unconditionally reads four nir_const_value elements from a nir_load_const_instr whose flexible array was allocated with only one element. This results in a 24-byte over-read on every first draw call with that shader and blend combination. The bug affects Linux systems running Mesa OpenGL drivers with RadeonSI (AMD GPUs).

Platform: Linux (Mesa OpenGL drivers, tested with radeonsi / AMD Radeon RX 6600 XT).

Root Cause

RadeonSI implements a draw-time optimization for the blend mode DST_COLOR * src + ZERO * dst. When this blend state is active, the driver analyzes the fragment shader to determine whether it always outputs vec4(1.0) when fed an all-ones texture, which would make the blend a no-op. The analysis function si_check_blend_dst_sampler_noop clones the shader, replaces the sole texture fetch with a constant vec4(1.0), runs constant folding, and then reads the resulting output value through get_output_as_const_value.

The problem is in get_output_as_const_value, which reads the constant output by hardcoding a 4-component access:

C
// src/gallium/drivers/radeonsi/si_nir_optim.c
nir_const_value *c = nir_src_as_const_value(intrin->src[0]);
if (!c)
   return false;

if (intrin->src[0].ssa->bit_size == 16) {
   uint16_t half_values[4];
   nir_const_value_to_array(half_values, c, 4, u16);
   for (unsigned i = 0; i < 4; i++)
      values[i] = _mesa_half_to_float(half_values[i]);
} else {
   nir_const_value_to_array(values, c, 4, f32);
}

The macro nir_const_value_to_array expands to a simple loop that accesses c[0] through c[3]:

C
// src/compiler/nir/nir.h
#define nir_const_value_to_array(arr, c, components, m) \
   do { for (unsigned i = 0; i < components; ++i) arr[i] = c[i].m; } while (false)

The pointer c comes from nir_src_as_const_value, which returns a pointer to the value[] flexible array member of nir_load_const_instr. This array is allocated with exactly num_components entries:

C
// src/compiler/nir/nir.c
nir_load_const_instr *
nir_load_const_instr_create(nir_shader *shader, unsigned num_components,
                            unsigned bit_size)
{
   nir_load_const_instr *instr =
      nir_instr_create(shader, nir_instr_type_load_const,
                       sizeof(nir_load_const_instr) + sizeof(nir_const_value) * num_components);

WebGL2 permits fragment shaders with scalar, vec2, or vec3 outputs such as layout(location=0) out float o. ANGLE's desktop GL backend preserves the declared type verbatim in the translated GLSL; it does not pad outputs to vec4. When such a shader's texture fetch is replaced with vec4(1.0) and constant-folded, the swizzle operation .r collapses the result to a single-component nir_load_const_instr with num_components = 1, meaning value[] has space for exactly one 8-byte nir_const_value. The subsequent call to nir_const_value_to_array(values, c, 4, f32) then reads three elements past the end of the allocation, a 24-byte over-read.

No ANGLE workaround covers this path; the existing Mesa-related workarounds (recreateMipmapLevelsBeforeGenerate, disableRenderSnorm, etc.) are unrelated.

Reproduce

Tested at Chromium commit ab3f3f8b586d6 on Linux x86_64 with an AMD Radeon RX 6600 XT (radeonsi driver).

The bug is confirmed present in Mesa 26.0.4 (latest stable as of 2026-04-02). The over-read object is a nir_load_const_instr allocated through Mesa's NIR GC slab allocator (gc_alloc). This allocator obtains 32 KB slabs from malloc and carves individual objects from within; ASAN only sees the outer slab boundary, not the boundaries between slab-internal objects, so the 24-byte over-read into adjacent slab data is invisible. To make it visible to ASAN, the slab is disabled by setting the compile-time constant MAX_FREELIST_SIZE to 0 in src/util/ralloc.c, which forces every gc_alloc to fall through to ralloc_size and thus to an individual malloc with its own ASAN redzone. This change affects only the allocation strategy; no application logic is modified, and the over-read occurs identically with or without the slab.

0. Prerequisites

Bash
sudo apt-get build-dep mesa
pip install mako

1. Build libdrm (>= 2.4.121 required by Mesa 26.x)

Bash
git clone https://gitlab.freedesktop.org/mesa/drm.git /home/user/libdrm-new
cd /home/user/libdrm-new
git checkout libdrm-2.4.131

CC=~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang \
CXX=~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++ \
meson setup build \
    --prefix=$PWD/install \
    -Dbuildtype=debug \
    -Db_sanitize=address \
    -Db_lundef=false

ninja -C build -j$(nproc) && ninja -C build install

2. Build Mesa with ASAN (slab allocator disabled)

Both Mesa and libdrm must be compiled with Chromium's Clang so the ASAN instrumentation resolves against the runtime statically linked into Chrome's ASAN binary. Using GCC's libasan.so will conflict at load time. The -Db_lundef=false flag is required because the shared libraries leave __asan_* symbols unresolved; they are provided by Chrome at runtime.

Mesa must be built as a release build (-Dbuildtype=release -Db_ndebug=true). Debug builds contain asserts in NIR that may abort before the overflow occurs.

Before building, apply the slab-disable patch to make the over-read visible to ASAN:

Bash
git clone https://gitlab.freedesktop.org/mesa/mesa.git /home/user/mesa-asan
cd /home/user/mesa-asan
git checkout mesa-26.0.4

# Disable the NIR GC slab allocator so each gc_alloc goes through malloc
sed -i 's/#define MAX_FREELIST_SIZE 512/#define MAX_FREELIST_SIZE 0/' src/util/ralloc.c

Then build:

Bash
PKG_CONFIG_PATH=/home/user/libdrm-new/install/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH \
CMAKE_PREFIX_PATH=/usr/lib/llvm-18 \
CC=~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang \
CXX=~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++ \
meson setup build \
    --prefix=$PWD/install \
    -Dbuildtype=release \
    -Db_sanitize=address \
    -Db_lundef=false \
    -Db_ndebug=true \
    -Dglx=dri \
    -Degl=enabled \
    -Dplatforms=x11 \
    -Dllvm=enabled \
    -Dcpp_std=c++17 \
    -Dgallium-rusticl=false \
    -Dgallium-va=disabled \
    -Dcmake_prefix_path=/usr/lib/llvm-18

ninja -C build -j$(nproc) && ninja -C build install

3. Build Chrome with ASAN

Bash
cd ~/chromium/src
cat > out/asan-release/args.gn << 'EOF'
is_asan = true
is_debug = false
is_component_build = true
dcheck_always_on = false
EOF
gn gen out/asan-release
autoninja -C out/asan-release chrome

4. Run

Bash
MESA_SHADER_CACHE_DISABLE=true \
LD_LIBRARY_PATH=/home/user/mesa-asan/install/lib/x86_64-linux-gnu:/home/user/libdrm-new/install/lib/x86_64-linux-gnu:out/asan-release \
LIBGL_DRIVERS_PATH=/home/user/mesa-asan/install/lib/x86_64-linux-gnu/dri \
ASAN_OPTIONS="detect_leaks=0:halt_on_error=1:detect_odr_violation=0:redzone=128" \
out/asan-release/chrome \
    --no-sandbox \
    --disable-gpu-sandbox \
    --user-data-dir=/tmp/poc-$(date +%s) \
    "file:///path/to/poc.html"

The GPU process crashes within seconds of the page loading. ASAN reports:

==PID==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7c4d3925a400
READ of size 4 at 0x7c4d3925a400 thread T44
SCARINESS: 24 (4-byte-read-heap-buffer-overflow)
    #0 in get_output_as_const_value si_nir_optim.c
    #1 in si_nir_is_output_const_if_tex_is_const si_nir_optim.c
    #2 in si_check_blend_dst_sampler_noop si_state.c
    #3 in si_draw_blend_dst_sampler_noop si_state.c
    #4 in tc_call_draw_single u_threaded_context.c
    ...

0x7c4d3925a400 is located 0 bytes after 128-byte region [0x7c4d3925a380,0x7c4d3925a400)
allocated by thread T44 here:
    #0 in malloc
    #1 in ralloc_size ralloc.c
    #2 in gc_alloc_size ralloc.c
    #3 in nir_load_const_instr_create nir.c
    #4 in nir_opt_constant_folding nir_opt_constant_folding.c
    #5 in si_nir_is_output_const_if_tex_is_const si_nir_optim.c
    #6 in si_check_blend_dst_sampler_noop si_state.c
    #7 in si_draw_blend_dst_sampler_noop si_state.c

The complete ASAN log is in asan.log.

Standalone Mesa reproducer

The bug can also be reproduced without Chrome using the standalone C program repro.c. It uses GBM and EGL to create a headless OpenGL 3.2 core context on the hardware driver, compiles the same scalar-output fragment shader, sets the noop blend state, and issues a draw call. It requires the same ASAN-instrumented Mesa build with the slab allocator disabled (step 2 above).

Bash
cd /home/user/mesa-asan

# Compile the reproducer with the same Clang used for Mesa
~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang \
    -fsanitize=address -O1 -g \
    -o repro repro.c \
    -I install/include \
    -L install/lib/x86_64-linux-gnu \
    -L /home/user/libdrm-new/install/lib/x86_64-linux-gnu \
    -lEGL -lGL -lgbm \
    -Wl,-rpath,install/lib/x86_64-linux-gnu \
    -Wl,-rpath,/home/user/libdrm-new/install/lib/x86_64-linux-gnu

# Run
LD_LIBRARY_PATH=install/lib/x86_64-linux-gnu:/home/user/libdrm-new/install/lib/x86_64-linux-gnu \
LIBGL_DRIVERS_PATH=install/lib/x86_64-linux-gnu/dri \
MESA_SHADER_CACHE_DISABLE=true \
ASAN_OPTIONS="detect_leaks=0:detect_odr_violation=0" \
./repro /dev/dri/renderD128

ASAN reports the same heap-buffer-overflow in get_output_as_const_value.

Suggested Fix

The fix is to read only num_components values from the flexible array instead of the hardcoded 4, and zero-initialize the remaining slots. The patch applies cleanly to Mesa 26.0.4:

Diff
--- a/src/gallium/drivers/radeonsi/si_nir_optim.c
+++ b/src/gallium/drivers/radeonsi/si_nir_optim.c
@@ -91,13 +91,15 @@ get_output_as_const_value(nir_shader *shader, float values[4])
                          !(nir_intrinsic_src_type(intrin) & nir_type_float))
                         return false;
 
+                     unsigned nc = intrin->src[0].ssa->num_components;
+                     memset(values, 0, 4 * sizeof(float));
                      if (intrin->src[0].ssa->bit_size == 16) {
-                        uint16_t half_values[4];
-                        nir_const_value_to_array(half_values, c, 4, u16);
-                        for (unsigned i = 0; i < 4; i++)
+                        uint16_t half_values[4] = {0};
+                        nir_const_value_to_array(half_values, c, nc, u16);
+                        for (unsigned i = 0; i < nc; i++)
                            values[i] = _mesa_half_to_float(half_values[i]);
                      } else {
-                        nir_const_value_to_array(values, c, 4, f32);
+                        nir_const_value_to_array(values, c, nc, f32);
                      }
                      return true;
                   }

With this patch applied, the reproducer completes without any ASAN report.

Credit

Please use c6eed09fc8b174b0f3eebedcceb1e792 as the credit for this vulnerability. Thank you.

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The function get_output_as_const_value hardcodes reading four components from a constant array that may have been allocated with fewer components, leading to an out-of-bounds read.

What the attacker needed

Linux with AMD GPU; Mesa RadeonSI driver; Chrome with WebGL2; Victim visits malicious page

The fix

The fix is to read only num_components values from the flexible array instead of the hardcoded 4, and zero-initialize the remaining slots.

How it was found

  1. Build libdrm with ASAN and Chromium's Clang.
  2. Build Mesa with ASAN and the slab allocator disabled.
  3. Build Chrome with ASAN.
  4. Run Chrome with the ASAN-instrumented Mesa and a proof-of-concept HTML file.
  5. Observe the GPU process crash with an ASAN heap-buffer-overflow report.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A graphics driver reads more data than it should from a small memory buffer, which can leak nearby memory contents. This happens when a web page uses a special shader and blend setting, potentially exposing sensitive data from the GPU process.

What is Memory corruption?

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

More by c6eed09fc8b174b0f3eebedcceb1e792

View all

52 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.