mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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, stable@vger.kernel.org
Subject: Re: [PATCH v4 1/3] drm/sched: cache the timeline name to fix a use-after-free
Date: Wed, 09 Sep 2026 09:44:38 +0200	[thread overview]
Message-ID: <a9903d42a115bfa5373e02c7ec197ed03ee7c669.camel@mailbox.org> (raw)
In-Reply-To: <20260909003754.1128738-1-malhyuk97@gmail.com>

On Wed, 2026-09-09 at 09:37 +0900, Jonghyuk Kim(MalHyuk) wrote:
> On 08/09/2026 13:07, Philipp Stanner wrote:
> > Is this an issue? A fence can only be exported if the scheduler exists.
> > The hard rule with dma_fence is that all drivers must signal all of
> > them before they tear down the scheduler
> 
> Agreed for the bug at hand - that fence is signaled, so 0001 covers it.
> 
> My point was narrower: nothing enforces the rule. drm_sched_fini() only does
> 
>   if (!list_empty(&sched->pending_list))
>           dev_warn(sched->dev, "Tearing down scheduler while jobs are pending!\n");
> 
> and the one path that would drain the list, drm_sched_cancel_remaining_jobs(),
> needs ops->cancel_job, which no driver in current mainline implements -
> the only user is the mock scheduler in the KUnit tests. So a driver that
> gets it wrong gets a warning, not a stopped teardown. Not an argument
> against the hot-fix.

True. The cancel_job() cb is currently the recommended solution
(although there was disagreement back then) that Tvrtko and I came up
with a while ago. The issue was that drm_sched was designed with no
idiomatic solution for handling remaining jobs in sched->pending_list
on teardown, which is why all drivers presumably have different
solutions. cancel_job() was an attempt at providing an idiomatic
solution.

It's afaik currently being used by Asahi downstream and was used in
Nouveau, but Nouveau doesn't need it / cannot use it for other reasons
that have to do with page table cleanup AFAIR. So Nouveau covers it
with a waitqueue. We could add it to Nouveau again, but then it would
never be called because the waitqueue comes first and needs to stay…

So should you see a driver that could make good use of it, I would
appreciate if you'd try to add it :)

  reply	other threads:[~2026-09-09  7:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  8:06 [PATCH v4 0/3] drm/sched: fix use-after-free of the fence timeline name Jonghyuk Kim(MalHyuk)
2026-09-04  8:06 ` [PATCH v4 1/3] drm/sched: cache the timeline name to fix a use-after-free Jonghyuk Kim(MalHyuk)
2026-09-04  8:20   ` Christian König
2026-09-04  8:31     ` Philipp Stanner
2026-09-04 12:49       ` Christian König
2026-09-04 19:06         ` Philipp Stanner
2026-09-07  9:15           ` Tvrtko Ursulin
2026-09-07  9:42             ` Philipp Stanner
2026-09-07  9:49               ` Philipp Stanner
2026-09-07 10:28               ` Tvrtko Ursulin
2026-09-07 10:34                 ` Tvrtko Ursulin
2026-09-07 10:47                 ` Philipp Stanner
2026-09-07 11:06                   ` Tvrtko Ursulin
2026-09-07 11:15                     ` Philipp Stanner
2026-09-07 12:59                       ` Christian König
2026-09-07 13:38                         ` Philipp Stanner
2026-09-07 15:21                           ` Christian König
2026-09-08 10:49                             ` Jonghyuk Kim(MalHyuk)
2026-09-08 11:07                               ` Philipp Stanner
2026-09-09  0:37                                 ` Jonghyuk Kim(MalHyuk)
2026-09-09  7:44                                   ` Philipp Stanner [this message]
2026-09-07 12:28                     ` Tvrtko Ursulin
2026-09-08 15:20                       ` Tvrtko Ursulin
2026-09-07 12:18               ` Alessio Belle
2026-09-07 11:42           ` Christian König
2026-09-07 11:54             ` Philipp Stanner
2026-09-04  8:31     ` Jonghyuk Kim(MalHyuk)
2026-09-04  8:39       ` Philipp Stanner
2026-09-04  9:11         ` Jonghyuk Kim(MalHyuk)
2026-09-04  9:07       ` Tvrtko Ursulin
2026-09-04  9:57   ` Danilo Krummrich
2026-09-04 10:51     ` Philipp Stanner
2026-09-04  8:06 ` [PATCH v4 2/3] drm/sched: add the fence ops-detach cleanup to the TODO list Jonghyuk Kim(MalHyuk)
2026-09-04  8:06 ` [PATCH v4 3/3] drm/sched/tests: add a UAF regression test for the timeline name Jonghyuk Kim(MalHyuk)

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=a9903d42a115bfa5373e02c7ec197ed03ee7c669.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=stable@vger.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®