Skip to contentSkip to conversation

CVE-2025-71130: drm/i915/gem: Zero-initialize the eb.vma array in i915_gem_do_execbuffer

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jan 14

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

drm/i915/gem: Zero-initialize the eb.vma array in i915_gem_do_execbuffer

Initialize the eb.vma array with values of 0 when the eb structure is first set up. In particular, this sets the eb->vma[i].vma pointers to NULL, simplifying cleanup and getting rid of the bug described below.

During the execution of eb_lookup_vmas(), the eb->vma array is successively filled up with struct eb_vma objects. This process includes calling eb_add_vma(), which might fail; however, even in the event of failure, eb->vma[i].vma is set for the currently processed buffer.

If eb_add_vma() fails, eb_lookup_vmas() returns with an error, which prompts a call to eb_release_vmas() to clean up the mess. Since eb_lookup_vmas() might fail during processing any (possibly not first) buffer, eb_release_vmas() checks whether a buffer's vma is NULL to know at what point did the lookup function fail.

In eb_lookup_vmas(), eb->vma[i].vma is set to NULL if either the helper function eb_lookup_vma() or eb_validate_vma() fails. eb->vma[i+1].vma is set to NULL in case i915_gem_object_userptr_submit_init() fails; the current one needs to be cleaned up by eb_release_vmas() at this point, so the next one is set. If eb_add_vma() fails, neither the current nor the next vma is set to NULL, which is a source of a NULL deref bug described in the issue linked in the Closes tag.

When entering eb_lookup_vmas(), the vma pointers are set to the slab poison value, instead of NULL. This doesn't matter for the actual lookup, since it gets overwritten anyway, however the eb_release_vmas() function only recognizes NULL as the stopping value, hence the pointers are being set to NULL as they go in case of intermediate failure. This patch changes the approach to filling them all with NULL at the start instead, rather than handling that manually during failure.

(cherry picked from commit 08889b706d4f0b8d2352b7ca29c2d8df4d0787cd)

The Linux kernel CVE team has assigned CVE-2025-71130 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.16 with commit 544460c33821b44c2f0c643121303c3dc3f66ef1 and fixed in 6.1.160 with commit 25d69e07770745992387c016613fd7ac8eaf9893
	Issue introduced in 5.16 with commit 544460c33821b44c2f0c643121303c3dc3f66ef1 and fixed in 6.6.120 with commit 0336188cc85d0eab8463bd1bbd4ded4e9602de8b
	Issue introduced in 5.16 with commit 544460c33821b44c2f0c643121303c3dc3f66ef1 and fixed in 6.12.64 with commit 24d55ac8e31d2f8197bfad71ffcb3bae21ed7117
	Issue introduced in 5.16 with commit 544460c33821b44c2f0c643121303c3dc3f66ef1 and fixed in 6.18.4 with commit 63f23aa2fbb823c8b15a29269fde220d227ce5b3
	Issue introduced in 5.16 with commit 544460c33821b44c2f0c643121303c3dc3f66ef1 and fixed in 6.19-rc4 with commit 4fe2bd195435e71c117983d87f278112c5ab364c

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2025-71130

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:

	drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/25d69e07770745992387c016613fd7ac8eaf9893
	https://git.kernel.org/stable/c/0336188cc85d0eab8463bd1bbd4ded4e9602de8b
	https://git.kernel.org/stable/c/24d55ac8e31d2f8197bfad71ffcb3bae21ed7117
	https://git.kernel.org/stable/c/63f23aa2fbb823c8b15a29269fde220d227ce5b3
	https://git.kernel.org/stable/c/4fe2bd195435e71c117983d87f278112c5ab364c