From: sashiko-bot@kernel.org
To: MoGGuU <Naixumogu@whut.edu.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 2/3] accel/rocket: Collect job dependencies before arming
Date: Fri, 28 Aug 2026 05:22:32 +0000 [thread overview]
Message-ID: <20260828052233.6CF961F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828050805.38548-3-Naixumogu@whut.edu.cn>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing read fence attachment for input BOs can lead to data races (Write-after-Read hazards).
- [High] Duplicate GEM objects in job submission arrays cause the IOCTL to fail with -EALREADY.
--
commit bd2a88e8890e01dc0085ebd07568e63dc8dda773
Author: MoGGuU <Naixumogu@whut.edu.cn>
accel/rocket: Collect job dependencies before arming
This commit moves the job dependency collection to occur before the scheduler
job is armed and the scheduler lock is taken. This ensures that memory
allocation failures during dependency collection do not leave the armed job in
an invalid state that cannot be safely aborted.
Cc: stable@vger.kernel.org
Tested-by: Sidong Yang <sidong.yang@furiosa.ai>
Signed-off-by: MoGGuU <Naixumogu@whut.edu.cn>
> diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
> index e6052d1973afa..b55e12aecfe64 100644
> --- a/drivers/accel/rocket/rocket_job.c
> +++ b/drivers/accel/rocket/rocket_job.c
> @@ -206,19 +206,21 @@ static int rocket_job_push(struct rocket_job *job)
> if (ret)
> goto err;
[Severity: High]
This is a pre-existing issue, but does the array construction preceding this
error check allow userspace to trigger an -EALREADY error?
Looking at the setup before this point in rocket_job_push():
memcpy(bos, job->in_bos, job->in_bo_count * sizeof(void *));
memcpy(&bos[job->in_bo_count], job->out_bos,
job->out_bo_count * sizeof(void *));
ret = drm_gem_lock_reservations(bos, bo_count, &acquire_ctx);
If a userspace client submits an in-place inference job where the same BO is
used as both an input and an output (or passed multiple times as input), the
bos array will contain duplicates. When drm_gem_lock_reservations() attempts
to lock the same reservation object twice with the same context, it fails
with -EALREADY, breaking the API and denying valid requests.
> + ret = rocket_acquire_object_fences(job->in_bos, job->in_bo_count,
> + &job->base, false);
> + if (ret)
> + goto err_unlock;
> +
> + ret = rocket_acquire_object_fences(job->out_bos, job->out_bo_count,
> + &job->base, true);
> + if (ret)
> + goto err_unlock;
> +
> scoped_guard(mutex, &rdev->sched_lock) {
> drm_sched_job_arm(&job->base);
>
> job->inference_done_fence = dma_fence_get(&job->base.s_fence->finished);
>
[ ... ]
>
> drm_sched_entity_push_job(&job->base);
> }
[Severity: High]
This isn't a bug introduced by this patch, but are the input BOs left
unsynchronized here?
Looking further down in rocket_job_push(), the completion fence is attached
only to the output BOs:
rocket_attach_object_fences(job->out_bos, job->out_bo_count,
job->inference_done_fence);
Because the input BOs are entirely omitted, if an unprivileged userspace
client submits an inference job with input buffers, then immediately submits a
job to another engine (like a GPU) to write to those same buffers, can a
Write-after-Read hazard occur? It seems the inference_done_fence isn't
attached to the in_bos reservation objects to protect the read, leading to
potential data corruption.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828050805.38548-1-Naixumogu@whut.edu.cn?part=2
next prev parent reply other threads:[~2026-08-28 5:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 5:08 [PATCH v3 0/3] accel/rocket: Fix job submit error handling MoGGuU
2026-08-28 5:08 ` [PATCH v3 1/3] accel/rocket: Validate BO handle counts on job submission MoGGuU
2026-08-28 5:25 ` sashiko-bot
2026-08-28 5:44 ` Sidong Yang
2026-08-28 5:08 ` [PATCH v3 2/3] accel/rocket: Collect job dependencies before arming MoGGuU
2026-08-28 5:22 ` sashiko-bot [this message]
2026-08-28 5:46 ` Sidong Yang
2026-08-28 5:50 ` Sidong Yang
2026-08-28 5:08 ` [PATCH v3 3/3] accel/rocket: Propagate job submission errors MoGGuU
2026-08-28 5:19 ` sashiko-bot
2026-08-28 5:47 ` Sidong Yang
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=20260828052233.6CF961F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Naixumogu@whut.edu.cn \
--cc=dri-devel@lists.freedesktop.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