From: Philipp Stanner <phasta@mailbox.org>
To: "Jonghyuk Kim(MalHyuk)" <malhyuk97@gmail.com>,
phasta@kernel.org, christian.koenig@amd.com,
tursulin@ursulin.net, matthew.brost@intel.com, dakr@kernel.org
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
mdaenzer@redhat.com, alessio.belle@imgtec.com,
luigi.santivetti@imgtec.com
Subject: Re: [PATCH v3 1/2] drm/sched: fix use-after-free of the fence timeline name
Date: Fri, 04 Sep 2026 09:42:32 +0200 [thread overview]
Message-ID: <9ca6f37d47271653e02b4383dd1fc372fd042e7a.camel@mailbox.org> (raw)
In-Reply-To: <20260903180134.950043-1-malhyuk97@gmail.com>
On Fri, 2026-09-04 at 03:01 +0900, Jonghyuk Kim(MalHyuk) wrote:
> Thanks a lot for the thorough review, and for pulling in the pvr folks.
>
[…]
> every to_drm_sched_fence() caller. I don't think that is the right trade for a
> fix we want to backport.
Would seem so. But then adding an appropriate TODO seems right. Also an
entry in the scheduler's section in Documentation/gpu/todo.rst
>
> Christian's point that the finished/scheduled .release callbacks are
> "unproblematic for the problem at hand" matches this: the release callbacks do
> not need to be removed to fix the timeline-name UAF, so keeping them (and thus
> the ops attached, and to_drm_sched_fence() working) is fine.
I think that's only the case because the scheduled-fence is not exposed
to userspace by anyone yet.
But since the entire drm_sched_fence is a public API object, sharing it
with userspace would be legal, although doing so likely makes not much
sense.
>
> Given that, I'd like to fall back to the minimal caching fix and drop the
> ops/refcount rework entirely:
I guess that's the best thing we can do right now.
>
>
[…]
>
> On the specific points:
>
> - get_driver_name(): it returns the literal "drm_sched" and never touches
> ->sched, so unlike get_timeline_name() it isn't exposed. Only the timeline
> name needs the fix.
I'm not so sure about that.
The primary reason why the rcu-decoupling was implemented is so that
drivers can unload while there are still consumer fences around.
The problem at hand fundamentally stems from the fact that we have two
fences, hardware_fence (often called "parent") and sched_fence. The
driver only cares about the hardware fence, and then there's a delay
between signalling of the hw_fence and the sched_fence, which then
decouples.
So get_driver_name() could still run into a code-UAF, depending on
where the string literal is stored.
>
[…]
>
> Unless someone would prefer to keep ops-detach and fix the two callers instead,
I mean, that *is* the gold-standard solution for the problem at hand,
because it complies with the new ideal for dma_fence usage.
But it's a bit of work probably, since you'd need to figure out
solutions for the problems we discussed. Christian can probably help a
lot with amdgpu, maybe the other folks with pvr.
Up to you whether you have time to try to fix the problem in this
manner. If not, as mentioned above, we should leave an entry in the
TODO list.
> I'll respin as the caching v4 once Tvrtko and the pvr folks have had a chance to
> look as well.
Cool, thx!
btw, replying inline at the corresponding mails with the others' quotes
above is preferable since that helps people catch up context, and
people more easily can spot whether you're addressing them. Not always
possible, but preferable.
P.
next prev parent reply other threads:[~2026-09-04 7:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 14:42 [PATCH v3 0/2] " Jonghyuk Kim(MalHyuk)
2026-09-02 14:42 ` [PATCH v3 1/2] " Jonghyuk Kim(MalHyuk)
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 [this message]
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 16:09 ` [PATCH v3 0/2] drm/sched: fix use-after-free of the fence " Philipp Stanner
2026-09-02 17:25 ` 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=9ca6f37d47271653e02b4383dd1fc372fd042e7a.camel@mailbox.org \
--to=phasta@mailbox.org \
--cc=alessio.belle@imgtec.com \
--cc=christian.koenig@amd.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luigi.santivetti@imgtec.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®