From: sashiko-bot@kernel.org
To: "Philipp Stanner" <phasta@kernel.org>
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [RFC PATCH 7/8] drm/i915: Remove TIMESTAMP bit
Date: Fri, 27 Nov 2026 10:35:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-237143@kernel.org> (raw)
In-Reply-To: <20261127101812.2706432-9-phasta@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/i915: race in __dma_fence_signal__timestamp() leaks
cb_list as timestamp
--
commit 2eef29a2b337dc954527ca9b1dc02ace1dc68145
Author: Philipp Stanner <phasta@kernel.org>
drm/i915: Remove TIMESTAMP bit
This commit removes the set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags)
call from __dma_fence_signal__timestamp() in the i915 breadcrumb signaler.
> diff --git a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> index c10ac0ab3bfa8..a43d774ba7793 100644
> --- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c
> @@ -138,7 +138,6 @@ static void
> __dma_fence_signal__timestamp(struct dma_fence *fence, ktime_t timestamp)
> {
> fence->timestamp = timestamp;
> - set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
> trace_dma_fence_signaled(fence);
> }
[Severity: Medium]
Can removing DMA_FENCE_FLAG_TIMESTAMP_BIT let dma_fence_timestamp() read
rq->fence.cb_list.next as the timestamp while the fence is being signaled?
In struct dma_fence, cb_list and timestamp share an anonymous union.
Unlike dma_fence_signal_timestamp_locked(), i915 splits signaling across an
unlocked window: __dma_fence_signal() sets DMA_FENCE_FLAG_SIGNALED_BIT
without holding rq->lock, and signal_irq_work() only takes rq->lock later
to detach cb_list and write fence->timestamp:
CPU0 CPU1
irq_signal_request()
__dma_fence_signal(&rq->fence)
test_and_set_bit(SIGNALED_BIT)
irq_work_queue(&b->irq_work)
sync_file_ioctl(SYNC_IOC_FILE_INFO)
...
dma_fence_timestamp(&rq->fence)
spin_lock(&rq->lock)
test_bit(SIGNALED_BIT) -> true
*ts = fence->timestamp
<-- reads cb_list.next
spin_unlock(&rq->lock)
signal_irq_work()
spin_lock(&rq->lock)
list_replace(&rq->fence.cb_list, ...)
__dma_fence_signal__timestamp()
fence->timestamp = timestamp
spin_unlock(&rq->lock)
Waiters polling an i915 out-fence with SYNC_IOC_FILE_INFO or merging fences
during that window will receive a raw kernel pointer from cb_list.next as
the timestamp instead of waiting or getting a valid ktime_t.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127101812.2706432-2-phasta@kernel.org?part=7
next prev parent reply other threads:[~2026-11-27 10:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 10:18 [RFC PATCH 0/8] dma-fence: Remove TIMESTAMP bit Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 1/8] dma-buf: dma-fence: Hot-fix timestamp misordering Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 2/8] drm/sched: " Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 3/8] dma-buf: dma-fence: Ensure ordering with locks for timestamps Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 4/8] dma-buf: dma-fence: Improve dma_fence_timestamp() Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 5/8] drm/amdgpu: Stop using dma_fence internals Philipp Stanner
2026-11-27 10:18 ` [RFC PATCH 6/8] dma-buf: sync_debug: don't use TIMESTAMP bit Philipp Stanner
2026-11-27 10:26 ` sashiko-bot
2026-11-27 10:18 ` [RFC PATCH 7/8] drm/i915: Remove " Philipp Stanner
2026-11-27 10:35 ` sashiko-bot [this message]
2026-11-27 10:18 ` [RFC PATCH 8/8] dma-buf: dma-fence: " Philipp Stanner
2026-11-27 10:36 ` sashiko-bot
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=sashiko-outbox-237143@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=phasta@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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