[3] GPU-process `RemoteMesh` vertex-fetch OOB from unvalidated mesh layout
One narrow stride sends the GPU's vertex fetcher past its own buffer
Rated High on the stated impact: a renderer-chosen stride and capacity drive the GPU's vertex fetcher past the mesh's own buffer inside the GPU process. Whether this becomes a leak hinges on fetched values reaching the shared render output. The deformation path additionally hints at a write.
GPU-side vertex fetching trusts its buffer description completely: the hardware computes each vertex's address from an offset, a stride and an index, then reads whatever is there. In WebKit's <model> backend, the web-content process describes each mesh with a MeshDescriptor (vertex layouts with offset and stride, attributes with format and per-vertex offset, vertex and index capacities, and index-range parts). That descriptor is sent over IPC to RemoteMesh, the GPU-process receiver that forwards it to the Metal-backed renderer. The pipeline is expected to program the hardware only with layouts whose arithmetic fits the buffers it actually allocated.
The angle: a compromised web-content process can hand RemoteMesh a MeshDescriptor whose stride is narrower than its attributes and make the GPU process fetch vertex data past the end of its own buffers, and possibly write past them during deformation.
Unvalidated MeshDescriptor bufferStride in RemoteMesh::Update drives out-of-bounds AGX vertex-fetch read in the GPUP. Ensure incoming IPC values are validated.
Source/WebKit/GPUProcess/graphics/Model/RemoteMesh.cpp
LayoutTests/compositing/filters/model-element-update-mesh-invalid-geometry.html
Patch Details
The change adds a stateless validator for descriptor self-consistency, adds per-resource descriptor memory so incremental updates and removals are checked against previously accepted geometry, and retargets MESSAGE_CHECK at the stream connection that delivered the message.
The validator is a set of static helpers. vertexFormatByteSize maps each vertex format to its width. deformedAttributeByteSize gives the minimum width a deformation writes: 12 bytes for Position, Normal, Tangent and Bitangent, and 8 bytes for UV0 through UV7. indexByteSize gives the index width. isValidDescriptor requires a positive buffer count and non-negative capacities, in-range bufferIndex/layoutIndex, and non-negative offsets, strides and step rates. It also requires each attribute's width (widened to the deformation width when deformation data is present) to fit within bufferStride whenever vertexCapacity is non-zero, and bufferOffset + offset + vertexCapacity * bufferStride to not overflow. isValidGeometry adds the following: vertex data count within the declared buffers, no non-zero indexCount when vertexCapacity == 0, no overflow in the index-buffer size, and every part's indexOffset + indexCount * indexByteSize inside it.
For state, RemoteMesh gains m_meshDescriptors, keyed by TypedResourceId::hashValue, and updateModel rejects the INT64_MIN/INT64_MAX hash sentinels as identifiers. An unknown identifier must declare a valid descriptor, which is staged so later entries in the same batch can see it. A known identifier must be a delta update, or an initial update identical to the stored descriptor (isSameDescriptor), and its parts and data are validated against the stored descriptor. Staged descriptors are committed only after the whole batch passes. processRemovals erases removed identifiers when the backing reports success. A 'long' -> 'int64_t' alias in coreipc.js lets the test serialize the descriptor fields.
A privileged process forwards a client-supplied buffer layout to a hardware consumer without checking it is self-consistent or consistent with the buffers already allocated.
Background
Where this lives. The GPU process is the WebKit process that owns GPU access. WebContent processes talk to it over IPC, and because a WebContent process may be compromised, every incoming value is untrusted.
Stream IPC and MESSAGE_CHECK.
High-frequency rendering messages use IPC::StreamServerConnection. MESSAGE_CHECK-family macros validate a condition on an incoming message and, on failure, mark it invalid and stop servicing the sending connection.
Vertex layout.
A mesh descriptor declares vertex buffers, layouts and attributes. A layout gives a bufferIndex, bufferOffset and bufferStride (bytes between consecutive vertices). An attribute gives a semantic (Position, Normal, UV0…), a format (Float32x3 is 12 bytes), the layout it reads through, and a byte offset within each vertex. The vertex fetcher reads sizeof(format) bytes at bufferOffset + i * bufferStride + attribute.offset for vertex i.
Indexed drawing.
An index buffer holds vertex indices (UInt16 or UInt32). A part, or submesh, draws indexCount indices starting at indexOffset, and the GPU fetches whatever vertices those indices name.
Deformation. Skinning, blend shapes and renormalization rewrite per-vertex attributes on update: positions, normals and tangents as float3, and UVs as float2.
Initial vs. delta updates.
UpdateMeshDescriptor::updateType separates an initial update, which declares geometry and creates buffers, from a delta update, which refreshes data for an existing mesh resource named by TypedResourceId. processRemovals deletes resources. AGX is Apple's GPU architecture and driver family, and the commit title attributes the OOB access to its vertex-fetch stage.
Analysis
This is an out-of-bounds GPU read caused by missing IPC validation, with a possible write through deformation and overflow sub-cases in the size arithmetic.
WebContent (compromised) GPU process
┌────────────────────┐ ┌──────────────────────────────────┐
│ UpdateModel( │ stream │ RemoteMesh::updateModel │
│ stride = 4, │ ─────────► │ before: forward as-is ───┐ │
│ Float32x3 attrs, │ IPC │ after: isValidGeometry │ │
│ index = 999, │ │ m_meshDescriptors│ │
│ 4000-byte vbuf) │ │ MESSAGE_CHECK -> kill │
└────────────────────┘ │ MeshImpl / WebMesh ◄──────┘ │
│ fetch 12 bytes at 999*4 │
│ -> runs past 4000-byte buffer │
└──────────────────────────────────┘
The message crosses the process boundary on the left, and before the fix it reached MeshImpl::updateModel and WebMesh::updateMesh with none of its geometry checked. RemoteMesh also kept no record of the geometry it had accepted. The concrete shapes are:
- Stride narrower than the attribute. A 4-byte stride with 12-byte Float32x3 attributes and 1000 vertices backed by exactly 4000 bytes means the fetch for index 999 reads 12 bytes starting at byte 3996. This is the commit title's exact shape and the test's first reject case.
- Negative strides and offsets, accepted because the fields are signed.
- Overflowing capacities.
vertexCapacity = 0x4000000000000000makesvertexCapacity * bufferStridewrap any downstream size. - Part ranges past the index buffer, which put index fetch beyond
indexCapacity. - Deformation wider than the attribute. A float3 write per vertex through a narrower declared format and stride would land past each vertex slot, and past the buffer for the last vertex.
- Stateless incremental updates. A delta could target an unknown or removed identifier, or a second initial update could narrow an existing mesh's geometry, pairing new data with buffers sized for a different descriptor.
The read in case 1 assumes per-vertex storage is sized as vertexCapacity * bufferStride, which the validator's arithmetic and the test's 4000-byte vertexData imply; the WebKitMesh.mm allocation site is the place to confirm the exact formula.
The test drives RemoteMesh_UpdateModel through the IPC testing API with 10 reject and 12 accept cases, covering the narrow-stride shape above, a deformed position narrower than the float3 the deformation writes, and a delta update for a removed mesh. Reachability therefore requires an already-compromised WebContent process.
The read primitive is a GPU-side OOB read. In the narrow-stride case it is bounded per vertex by attribute width minus stride. In the index case it is bounded by the part range past indexCapacity. It could reach much further once the capacity product overflowed or negative strides were accepted. Fetched values feed vertex shading. Render buffers are shared back to WebContent as IOSurface send rights in MeshImpl::ioSurfaceHandles, so if the over-read reaches memory beyond the mesh's own Metal allocations and the result is visible in rendered output, it could form a coarse information-leak channel. Otherwise the effect is a GPU fault or GPU-process crash. Two unknowns decide which applies: how WebMesh sizes its buffers, and whether Metal robust buffer access clamps fetches. The deformation case would be a bounded OOB write only if the deformation writes through the client-declared stride. The delta-update path yields the same read and write classes against buffers sized for a stale or removed descriptor. On its own this does not escape the GPU process's sandbox, but it is a renderer-to-GPU-process escalation step.
This vulnerability weakens cross-process isolation between WebContent and the GPU process. The GPU process's security model assumes every IPC field driving a memory access is validated server-side, so a compromised renderer cannot make the more privileged process touch memory outside allocations it controls. Before the fix, a mesh layout disagreeing with its backing buffers drove an OOB vertex-fetch read on the GPU. If that read reached beyond the mesh's own buffers, it would be an information-disclosure step in a renderer-to-GPU-process chain, and the deformation sub-case could add a constrained write.
Insight. The validator has to reproduce the consumer's addressing model: the format width table, the deformation write widths, and the index arithmetic. That duplication is a risk in its own right, because vertexFormatByteSize and deformedAttributeByteSize are hand-maintained mirrors of the toMetal mappings and the deformation output types. Two residual questions stand out. First, the patch bounds part index ranges against indexCapacity but adds no check that the index values in indexData are below vertexCapacity, so whether an in-range part can still name an out-of-range vertex depends on the backing. Second, the accept cases allow an attribute offset past the stride and a bufferOffset larger than the stride, which is sound only if the backing allocates bufferOffset + offset + vertexCapacity * stride bytes. The INT64_MIN/INT64_MAX check also illustrates a secondary hazard: once a server-side map is keyed by client-chosen integers, the hash table's sentinel values become reachable from IPC.
Audit directions
- Client-built buffer layout handed to a hardware consumer without proving
offset + (count-1)*stride + elementSize <= allocatedSize. Narrow: audit the otherRemoteMeshentry points (updateTexture,updateMaterial,setEnvironmentMap,updateRenderBuffers) and theWebMeshcode inWebKitMesh.mmforUpdateTextureDescriptorwidth/height/mip/arrayLength values used to size or copy fromdataHandleshared memory. Match tell: a descriptor integer that reaches anMTLBuffer/MTLTexturecreation orreplaceRegioncall without aMESSAGE_CHECKagainst the shared-memory size. Wider: WebGPURemote*vertex and index buffer binding paths and the WebGL-in-GPUP command paths; match tell: a vertex descriptor or draw-range parameter forwarded to Metal where validation exists only in the WebContent-side wrapper. Widest: Chromium's GPU command buffer (whose vertex-attribute range checks guard exactly this), Android gralloc/SurfaceFlinger buffer descriptors, and virtio-gpu host-side command parsing. Match tell: the trusted side relies on the GPU's own bounds behavior instead of checking the layout arithmetic. - Incremental update protocols where the server validates the initial message but keeps no record of the accepted geometry. Narrow: check whether material and texture updates in the same
RemoteMeshinterface have delta forms, and whetherm_meshDescriptorscan diverge from the backing's real state, for example on aprocessRemovalsfailure or whenremoveModel(nodeIdentifier)drops nodes without touching the descriptor map. Wider: any GPU-process object keyed by a client-chosen identifier whose later messages assume prior state, such as remote image-buffer reuse, cached display-list resources, and stream-connection object heaps. Match tell: a handler that branches on update type or map membership and validates only on the creation branch. Widest: stateful wire protocols in general (HPACK/QPACK dynamic tables, incremental font updates, streamed glTF/USD scene deltas). Match tell: a delta checked only against its own fields, not against the retained state it will be applied to. - Validators that re-implement the consumer's size semantics as a separate table. Narrow: verify that
vertexFormatByteSizeanddeformedAttributeByteSizematch thetoMetal(::WebGPU::VertexFormat)mapping and the deformation kernels' write types inWebKitMesh.mm, and check whether index values inindexDataare ever bounded byvertexCapacity. Match tell: a semantic whose deformation write width exceeds the validator's entry, or a path that indexes vertex storage directly with client index values. Wider: WebGPU.framework validation versus Metal's actual fetch behavior; match tell: a switch-based size table with no compile-time link to the consuming API. Widest: parser-differential bugs in any validate-then-forward design, such as image decoders vetted by one library and decoded by another. Match tell: two independent pieces of code computing the same extent from the same untrusted fields.