Skip to content

CVE-2025-38389 drm/i915/gt: Fix timeline left held on VMA alloc error

HighCVSS 7.8 EPSS 0.22%
Published
Updated
Exploit status
No public exploit known
Technology
Linux KernelUbuntuDebian

Description

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

drm/i915/gt: Fix timeline left held on VMA alloc error

The following error has been reported sporadically by CI when a test
unbinds the i915 driver on a ring submission platform:

<4> [239.330153] ------------[ cut here ]------------
<4> [239.330166] i915 0000:00:02.0: [drm] drm_WARN_ON(dev_priv->mm.shrink_count)
<4> [239.330196] WARNING: CPU: 1 PID: 18570 at drivers/gpu/drm/i915/i915_gem.c:1309 i915_gem_cleanup_early+0x13e/0x150 [i915]
...
<4> [239.330640] RIP: 0010:i915_gem_cleanup_early+0x13e/0x150 [i915]
...
<4> [239.330942] Call Trace:
<4> [239.330944] <TASK>
<4> [239.330949] i915_driver_late_release+0x2b/0xa0 [i915]
<4> [239.331202] i915_driver_release+0x86/0xa0 [i915]
<4> [239.331482] devm_drm_dev_init_release+0x61/0x90
<4> [239.331494] devm_action_release+0x15/0x30
<4> [239.331504] release_nodes+0x3d/0x120
<4> [239.331517] devres_release_all+0x96/0xd0
<4> [239.331533] device_unbind_cleanup+0x12/0x80
<4> [239.331543] device_release_driver_internal+0x23a/0x280
<4> [239.331550] ? bus_find_device+0xa5/0xe0
<4> [239.331563] device_driver_detach+0x14/0x20
...
<4> [357.719679] ---[ end trace 0000000000000000 ]---

If the test also unloads the i915 module then that's followed with:

<3> [357.787478] =============================================================================
<3> [357.788006] BUG i915_vma (Tainted: G U W N ): Objects remaining on __kmem_cache_shutdown()
<3> [357.788031] -----------------------------------------------------------------------------
<3> [357.788204] Object 0xffff888109e7f480 @offset=29824
<3> [357.788670] Allocated in i915_vma_instance+0xee/0xc10 [i915] age=292729 cpu=4 pid=2244
<4> [357.788994] i915_vma_instance+0xee/0xc10 [i915]
<4> [357.789290] init_status_page+0x7b/0x420 [i915]
<4> [357.789532] intel_engines_init+0x1d8/0x980 [i915]
<4> [357.789772] intel_gt_init+0x175/0x450 [i915]
<4> [357.790014] i915_gem_init+0x113/0x340 [i915]
<4> [357.790281] i915_driver_probe+0x847/0xed0 [i915]
<4> [357.790504] i915_pci_probe+0xe6/0x220 [i915]
...

Closer analysis of CI results history has revealed a dependency of the
error on a few IGT tests, namely:

  • igt@api_intel_allocator@fork-simple-stress-signal,
  • igt@api_intel_allocator@two-level-inception-interruptible,
  • igt@gem_linear_blits@interruptible,
  • igt@prime_mmap_coherency@ioctl-errors,
    which invisibly trigger the issue, then exhibited with first driver unbind
    attempt.

All of the above tests perform actions which are actively interrupted with
signals. Further debugging has allowed to narrow that scope down to
DRM_IOCTL_I915_GEM_EXECBUFFER2, and ring_context_alloc(), specific to ring
submission, in particular.

If successful then that function, or its execlists or GuC submission
equivalent, is supposed to be called only once per GEM context engine,
followed by raise of a flag that prevents the function from being called
again. The function is expected to unwind its internal errors itself, so
it may be safely called once more after it returns an error.

In case of ring submission, the function first gets a reference to the
engine's legacy timeline and then allocates a VMA. If the VMA allocation
fails, e.g. when i915_vma_instance() called from inside is interrupted
with a signal, then ring_context_alloc() fails, leaving the timeline held
referenced. On next I915_GEM_EXECBUFFER2 IOCTL, another reference to the
timeline is got, and only that last one is put on successful completion.
As a consequence, the legacy timeline, with its underlying engine status
page's VMA object, is still held and not released on driver unbind.

Get the legacy timeline only after successful allocation of the context
engine's VMA.

v2: Add a note on other submission methods (Krzysztof Karas):
Both execlists and GuC submission use lrc_alloc() which seems free
from a similar issue.

(cherry picked from commit cc43422b3cc79eacff4c5a8ba0d224688ca9dd4f)

Upgrade path

12 packages: 10 fixed, 1 partially fixed.

PackageAffectedFixed inStatus
azure linux kernel(Azure Linux 3.0) < 6.6.104.2-1; All versions 6.6.104.2-1 Partially fixed
cbl-mariner kernel(CBL-Mariner 2.0) < 5.15.200.1-1 5.15.200.1-1 Fixed
debian/linux(Debian 12) < 6.1.147-1; = 6.1.27-1; = 6.1.37-1; = 6.1.38-1 +38 more 6.1.147-1 Fixed
debian/linux(Debian 13) < 6.12.37-1 6.12.37-1 Fixed
debian/linux(Debian 14) < 6.12.37-1 6.12.37-1 Fixed
Linux kernel < 5.4.296; < 5.10.240; < 5.15.187; < 6.1.144 +24 more 4c778c96e469fb719b11683e0a3be8ea68052fa2, 5.4.296, 5.10.240, 5.15.187, 5a7ae7bebdc4c2ecd48a2c061319956f65c09473, 6.1.144, 6.6.97, 6.12.37, 6.15.6, 6.16, 40e09506aea1fde1f3e0e04eca531bbb23404baf, 60b757730884e4a223152a68d9b5f625dac94119, a5aa7bc1fca78c7fa127d9e33aa94a0c9066c1d6, c542d62883f62ececafcb630a1c5010133826bea, e47d7d6edc40a6ace7cc04e5893759fee68569f5, f10af34261448610d4048ac6e6af87f80e3881a4 Fixed
ubuntu/linux(Ubuntu 22.04) < 5.15.0-156.166 5.15.0-156.166 Fixed
ubuntu/linux(Ubuntu 24.04) < 6.8.0-100.100 6.8.0-100.100 Fixed
ubuntu/linux-kvm(Ubuntu 22.04) < 5.15.0-1088.93 5.15.0-1088.93 Fixed
ubuntu/linux-raspi(Ubuntu 22.04) < 5.15.0-1086.89 5.15.0-1086.89 Fixed
ubuntu/linux-raspi(Ubuntu 24.04) < 6.8.0-1047.51 6.8.0-1047.51 Fixed
debian linux = 11.0 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
azure linux kernel(Azure Linux:3.0) < 6.6.104.2-1 6.6.104.2-1
azure linux kernel(Azure Linux:3.0) All versions No fix listed
cbl-mariner kernel(CBL-Mariner:2.0) < 5.15.200.1-1 5.15.200.1-1
debian/linux(Debian:12) < 6.1.147-1 6.1.147-1
debian/linux(Debian:12) = 6.1.106-1 No fix listed
debian/linux(Debian:12) = 6.1.106-2 No fix listed
debian/linux(Debian:12) = 6.1.106-3 No fix listed
debian/linux(Debian:12) = 6.1.112-1 No fix listed
debian/linux(Debian:12) = 6.1.115-1 No fix listed
debian/linux(Debian:12) = 6.1.119-1 No fix listed
debian/linux(Debian:12) = 6.1.123-1 No fix listed
debian/linux(Debian:12) = 6.1.124-1 No fix listed
debian/linux(Debian:12) = 6.1.128-1 No fix listed
debian/linux(Debian:12) = 6.1.129-1 No fix listed
debian/linux(Debian:12) = 6.1.133-1 No fix listed
debian/linux(Debian:12) = 6.1.135-1 No fix listed
debian/linux(Debian:12) = 6.1.137-1 No fix listed
debian/linux(Debian:12) = 6.1.139-1 No fix listed
debian/linux(Debian:12) = 6.1.140-1 No fix listed
debian/linux(Debian:12) = 6.1.27-1 No fix listed
debian/linux(Debian:12) = 6.1.37-1 No fix listed
debian/linux(Debian:12) = 6.1.38-1 No fix listed
debian/linux(Debian:12) = 6.1.38-2 No fix listed
debian/linux(Debian:12) = 6.1.38-2~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.38-3 No fix listed
Show 56 more
ProductAffected versionsFixed in
debian/linux(Debian:12) = 6.1.38-4 No fix listed
debian/linux(Debian:12) = 6.1.38-4~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.52-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1 No fix listed
debian/linux(Debian:12) = 6.1.55-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.64-1 No fix listed
debian/linux(Debian:12) = 6.1.66-1 No fix listed
debian/linux(Debian:12) = 6.1.67-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1 No fix listed
debian/linux(Debian:12) = 6.1.69-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.76-1 No fix listed
debian/linux(Debian:12) = 6.1.76-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.82-1 No fix listed
debian/linux(Debian:12) = 6.1.85-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1 No fix listed
debian/linux(Debian:12) = 6.1.90-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.94-1 No fix listed
debian/linux(Debian:12) = 6.1.94-1~bpo11+1 No fix listed
debian/linux(Debian:12) = 6.1.98-1 No fix listed
debian/linux(Debian:12) = 6.1.99-1 No fix listed
debian/linux(Debian:13) < 6.12.37-1 6.12.37-1
debian/linux(Debian:14) < 6.12.37-1 6.12.37-1
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < 60b757730884e4a223152a68d9b5f625dac94119 60b757730884e4a223152a68d9b5f625dac94119
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < e47d7d6edc40a6ace7cc04e5893759fee68569f5 e47d7d6edc40a6ace7cc04e5893759fee68569f5
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < f10af34261448610d4048ac6e6af87f80e3881a4 f10af34261448610d4048ac6e6af87f80e3881a4
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < 4c778c96e469fb719b11683e0a3be8ea68052fa2 4c778c96e469fb719b11683e0a3be8ea68052fa2
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < 40e09506aea1fde1f3e0e04eca531bbb23404baf 40e09506aea1fde1f3e0e04eca531bbb23404baf
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < 5a7ae7bebdc4c2ecd48a2c061319956f65c09473 5a7ae7bebdc4c2ecd48a2c061319956f65c09473
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < c542d62883f62ececafcb630a1c5010133826bea c542d62883f62ececafcb630a1c5010133826bea
Linux kernel >= 75d0a7f31eec8ec4a53b4485905800e09dc5091f, < a5aa7bc1fca78c7fa127d9e33aa94a0c9066c1d6 a5aa7bc1fca78c7fa127d9e33aa94a0c9066c1d6
Linux kernel = 5.4 No fix listed
Linux kernel < 5.4.296 5.4.296
Linux kernel < 5.10.240 5.10.240
Linux kernel < 5.15.187 5.15.187
Linux kernel < 6.1.144 6.1.144
Linux kernel < 6.6.97 6.6.97
Linux kernel < 6.12.37 6.12.37
Linux kernel < 6.15.6 6.15.6
Linux kernel < 6.16 6.16
ubuntu/linux(Ubuntu:22.04) < 5.15.0-156.166 5.15.0-156.166
ubuntu/linux-kvm(Ubuntu:22.04) < 5.15.0-1088.93 5.15.0-1088.93
ubuntu/linux-raspi(Ubuntu:22.04) < 5.15.0-1086.89 5.15.0-1086.89
ubuntu/linux(Ubuntu:24.04) < 6.8.0-100.100 6.8.0-100.100
ubuntu/linux-raspi(Ubuntu:24.04) < 6.8.0-1047.51 6.8.0-1047.51
Linux kernel >= 5.4, < 5.4.296 5.4.296
Linux kernel >= 5.5, < 5.10.240 5.10.240
Linux kernel >= 5.11, < 5.15.187 5.15.187
Linux kernel >= 5.16, < 6.1.144 6.1.144
Linux kernel >= 6.2, < 6.6.97 6.6.97
Linux kernel >= 6.7, < 6.12.37 6.12.37
Linux kernel >= 6.13, < 6.15.6 6.15.6
Linux kernel = 6.16-rc1 No fix listed
Linux kernel = 6.16-rc2 No fix listed
Linux kernel = 6.16-rc3 No fix listed
Linux kernel = 6.16-rc4 No fix listed
debian linux = 11.0 No fix listed

References