From: Philipp Stanner <phasta@mailbox.org>
To: "Jonghyuk Kim(MalHyuk)" <malhyuk97@gmail.com>,
tursulin@ursulin.net, phasta@kernel.org,
matthew.brost@intel.com, dakr@kernel.org
Cc: christian.koenig@amd.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Michel Daenzer <mdaenzer@redhat.com>
Subject: Re: [PATCH v3 0/2] drm/sched: fix use-after-free of the fence timeline name
Date: Wed, 02 Sep 2026 18:09:04 +0200 [thread overview]
Message-ID: <1b628841e8bb8735f2bcdc79450a49e75433101b.camel@mailbox.org> (raw)
In-Reply-To: <20260902144204.1843670-1-malhyuk97@gmail.com>
Well, that was a quick investigation ;)
On Wed, 2026-09-02 at 23:42 +0900, Jonghyuk Kim(MalHyuk) wrote:
>
[…]
> Philipp suggested dropping the finished fence's ->release callback instead.
> That is what this series does. dma_fence detaches a fence's ops on signalling
> when it has neither .release nor .wait (dma_fence_signal_timestamp_locked()),
> and dma_fence_timeline_name() returns a static string once the ops are gone.
> So with the callback removed, get_timeline_name() is simply never reached on
> a signalled finished fence - no ->sched dereference at all, for static and
btw, you only ever mention get_timeline_name(), but get_driver_name()
is running into the same issue, isn't it?
> Link to v2 (name caching):
> https://lore.kernel.org/dri-devel/20260902105808.1541063-1-malhyuk97@gmail.com/
That link is dead (weirdly enough. Why isn't it in dri-devel?). Correct
one seems to be:
https://lore.kernel.org/lkml/20260902105808.1541063-1-malhyuk97@gmail.com/
Your help and industriousness is highly appreciated :)
Just be so kind and wait >24h with sending new revisions so that more
folks, especially from different time zones, can jump into the
discussion.
>
> Note: detaching the finished fence's ops on signalling also makes
> to_drm_sched_fence() return NULL for a signalled finished fence. Callers
> already handle NULL (the normal foreign-fence result), a signalled fence is
> an already-satisfied dependency so the scheduler's dependency collapsing is
> unaffected, and it avoids the container_of() on a possibly-freed foreign
> scheduler that amdgpu_sync_same_dev() and pvr_queue_fence_is_native() would
> otherwise do. Flagging it explicitly since it touches an exported helper.
That unfortunately does look a bit dangerous.
Isn't pvr here already a race condition?
if (pvr_queue_fence_is_native(uf)) {
struct drm_sched_fence *s_fence = to_drm_sched_fence(uf);
> I did not add Fixes:/Cc: stable tags: the ->sched->name deref dates back to
> 1b1f42d8fde4 ("drm: move amd_gpu_scheduler into common location") but only
> became reachable once drivers began allocating per-context schedulers, so
> the right attribution is unclear to me. This is stable material as the
> driver instances are live - happy to add whatever tags you prefer.
I think for such cases merely adding Cc: stable and let the stable
folks figure out how far they want to backport is fine. You can hint at
us not knowing since when userspace can access this in a commit
Cc: stable … # we don't know since when
What I'm a bit more nervous about is that we probably really want to
backport this, but it's also a bit regression-endangered. So I suppose
we want to give it careful testing. I hope the others can help with
that, too.
>
> Tested with KUnit under KASAN (kunit.py --arch=x86_64), matched pair:
Did you test with kmemleak? That's always a tool of choice when it
comes to refcounting.
>
> Jonghyuk Kim(MalHyuk) (2):
> drm/sched: fix use-after-free of the fence timeline name
> drm/sched/tests: add a UAF regression test for the timeline name
I answer on those soonish.
Thanks
Philipp
next prev parent reply other threads:[~2026-09-02 16:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 14:42 [PATCH v3 0/2] drm/sched: fix use-after-free of the fence timeline name Jonghyuk Kim(MalHyuk)
2026-09-02 14:42 ` [PATCH v3 1/2] " Jonghyuk Kim(MalHyuk)
2026-09-02 14:58 ` sashiko-bot
2026-09-03 8:46 ` Philipp Stanner
2026-09-03 10:02 ` Christian König
2026-09-03 10:22 ` Christian König
2026-09-03 18:01 ` Jonghyuk Kim(MalHyuk)
2026-09-04 7:42 ` Philipp Stanner
2026-09-02 14:42 ` [PATCH v3 2/2] drm/sched/tests: add a UAF regression test for the " Jonghyuk Kim(MalHyuk)
2026-09-02 15:04 ` sashiko-bot
2026-09-02 16:09 ` Philipp Stanner [this message]
2026-09-02 17:25 ` [PATCH v3 0/2] drm/sched: fix use-after-free of the fence " Philipp Stanner
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=1b628841e8bb8735f2bcdc79450a49e75433101b.camel@mailbox.org \
--to=phasta@mailbox.org \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=malhyuk97@gmail.com \
--cc=matthew.brost@intel.com \
--cc=mdaenzer@redhat.com \
--cc=phasta@kernel.org \
--cc=tursulin@ursulin.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.