public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Yassine Mounir <sosohero200@gmail.com>
Cc: intel-gfx@lists.freedesktop.org, joonas.lahtinen@linux.intel.com,
	security@kernel.org, rodrigo.vivi@intel.com
Subject: Re: [PATCH] drm/i915: Fix UAF race between relocation and GEM_CLOSE
Date: Tue, 24 Mar 2026 15:26:47 +0100	[thread overview]
Message-ID: <2026032453-depletion-various-b39f@gregkh> (raw)
In-Reply-To: <20260324134718.27331-1-sosohero200@gmail.com>

On Tue, Mar 24, 2026 at 09:47:18AM -0400, Yassine Mounir wrote:
> 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>

No need for a reported-by when you create and sign off on a change.

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

There is no such file name in the current kernel tree, what version did
you make this against?


> @@ -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);
> +

What prevents the object from going away right after the put call here?

thanks,

greg k-h

  reply	other threads:[~2026-03-24 14:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24 13:47 [PATCH] drm/i915: Fix UAF race between relocation and GEM_CLOSE Yassine Mounir
2026-03-24 14:26 ` Greg KH [this message]
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=2026032453-depletion-various-b39f@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=security@kernel.org \
    --cc=sosohero200@gmail.com \
    /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