public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Yassine Mounir <sosohero200@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: joonas.lahtinen@linux.intel.com, security@kernel.org,
	rodrigo.vivi@intel.com, Yassine Mounir <sosohero200@gmail.com>
Subject: [PATCH] drm/i915: Fix UAF race between relocation and GEM_CLOSE
Date: Tue, 24 Mar 2026 09:47:18 -0400	[thread overview]
Message-ID: <20260324134718.27331-1-sosohero200@gmail.com> (raw)

A use-after-free (UAF) vulnerability was identified in the i915 driver 
within eb_relocate_vma. The issue arises from a race condition where 
a concurrent DRM_IOCTL_GEM_CLOSE can drop the GEM object's reference 
count to zero while the relocation thread is still processing entries.

This results in the kernel attempting to access freed memory in 
eb_relocate_entry, leading to a display pipeline hang and potential 
system instability.

Fix:
Wrap the relocation phase with i915_gem_object_get() and 
i915_gem_object_put() to ensure the object remains valid throughout 
the operation, even if user-space requests to close the handle.

Reported-by: Yassine Mounir (Toji1) <sosohero200@gmail.com>
Signed-off-by: Yassine Mounir <sosohero200@gmail.com>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 4 ++++
 1 file changed, 4 insertions(+)

--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1542,7 +1542,11 @@ eb_relocate_vma(struct i915_execbuffer *eb, struct i915_vma *vma)
 		if (ret)
 			return ret;
 
+		/* Hold a reference to prevent UAF during concurrent GEM_CLOSE */
+		i915_gem_object_get(vma->obj);
 		ret = eb_relocate_entry(eb, vma, rel);
+		i915_gem_object_put(vma->obj);
+
 		if (ret)
 			return ret;
 	}

             reply	other threads:[~2026-03-25 11:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 13:47 Yassine Mounir [this message]
2026-03-24 14:26 ` [PATCH] drm/i915: Fix UAF race between relocation and GEM_CLOSE Greg KH
2026-03-24 14:38   ` Yassine Mounir
2026-03-24 15:14     ` Greg KH
2026-03-24 15:25       ` Yassine Mounir
2026-03-25 16:06 ` ✗ LGCI.VerificationFailed: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260324134718.27331-1-sosohero200@gmail.com \
    --to=sosohero200@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=security@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox