From: "Maíra Canal" <mcanal@igalia.com>
To: "Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
"Melissa Wen" <mwen@igalia.com>, "Iago Toral" <itoral@igalia.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: kernel-dev@igalia.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 06/10] drm/v3d: Reject invalid syncobj handles in submit ioctls
Date: Fri, 8 May 2026 12:28:28 -0300 [thread overview]
Message-ID: <cdcecda5-285b-4582-93cd-0170575aa87a@igalia.com> (raw)
In-Reply-To: <b4ac5310-39f8-4a7d-9bce-906e100680ec@igalia.com>
Hi Tvrtko,
On 16/04/26 08:59, Tvrtko Ursulin wrote:
>
> On 13/04/2026 16:03, Maíra Canal wrote:
>> drm_sched_job_add_syncobj_dependency() returns -ENOENT both when the
>> handle is zero and when the handle is non-zero but does not find a
>> corresponding existing syncobj (userspace bug). The driver previously
>> ignored -ENOENT in both cases, silently accepting broken handles.
>>
>> Distinguish the two: skip the call entirely when the handle is zero, as
>> there is no dependency, and let -ENOENT propagate for non-zero handles
>> that don't resolve, turning the error into a proper return to userspace.
>>
>> Signed-off-by: Maíra Canal <mcanal@igalia.com>
>> ---
>> drivers/gpu/drm/v3d/v3d_submit.c | 23 ++++++++++++-----------
>> 1 file changed, 12 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/v3d/v3d_submit.c b/drivers/gpu/drm/v3d/
>> v3d_submit.c
>> index 054367ba533d..fe8b5757c3e8 100644
>> --- a/drivers/gpu/drm/v3d/v3d_submit.c
>> +++ b/drivers/gpu/drm/v3d/v3d_submit.c
>> @@ -171,12 +171,11 @@ v3d_job_add_syncobjs(struct v3d_job *job, struct
>> drm_file *file_priv,
>> int ret = 0;
>> if (!has_multisync) {
>> - ret = drm_sched_job_add_syncobj_dependency(&job->base,
>> file_priv,
>> - in_sync, 0);
>> - // TODO: Investigate why this was filtered out for the IOCTL.
>> - if (ret && ret != -ENOENT)
>> - return ret;
>> - return 0;
>> + /* Ignore syncobj if its handle is NULL */
>
> Nitpick s/NULL/zero/ since it is not a pointer.
>
>> + if (in_sync)
>> + ret = drm_sched_job_add_syncobj_dependency(&job->base,
>> file_priv,
>> + in_sync, 0);
>
> Ah now ret needs to be initialized to zero (comment from previous patch)!
>
>> + return ret;
>> }
>> if (se->in_sync_count && se->wait_stage == queue) {
>> @@ -190,11 +189,13 @@ v3d_job_add_syncobjs(struct v3d_job *job, struct
>> drm_file *file_priv,
>> return -EFAULT;
>> }
>> - ret = drm_sched_job_add_syncobj_dependency(&job->base,
>> - file_priv, in.handle, 0);
>> - // TODO: Investigate why this was filtered out for the
>> IOCTL.
>> - if (ret && ret != -ENOENT)
>> - return ret;
>> + /* Ignore syncobj if its handle is NULL */
>
> As above. Or perhaps even NULL makes sense as in null handle being an
> invalid handle reads more obvious than a zero handle?
>
>> + if (in.handle) {
>> + ret = drm_sched_job_add_syncobj_dependency(&job->base,
>> + file_priv, in.handle, 0);
>> + if (ret)
>> + return ret;
>> + }
>> }
>> }
>>
>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
>
> With a slight danger there is some userspace out there which relies on
> this? Have you look at how Mesa uses it, and the history?
I've checked userspace usage and thankfully, we never relied on this.
IGT tests are also passing (which were the reason I added this -ENOENT
some years ago, as without them, the tests would fail).
Thanks for your review!
Best regards,
- Maíra
>
> Regards,
>
> Tvrtko
>
next prev parent reply other threads:[~2026-05-08 15:28 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 15:03 [PATCH 00/10] drm/v3d: Scheduler and submission fixes and refactoring Maíra Canal
2026-04-13 15:03 ` [PATCH 01/10] drm/v3d: Drop unused drm_encoder.h include from v3d_drv.h Maíra Canal
2026-04-13 15:03 ` [PATCH 02/10] drm/v3d: Clear queue->active_job when v3d_fence_create() fails Maíra Canal
2026-04-16 11:39 ` Tvrtko Ursulin
2026-05-08 14:01 ` Maíra Canal
2026-04-13 15:03 ` [PATCH 03/10] drm/v3d: Use inline lock for dma fence initialization Maíra Canal
2026-04-16 11:44 ` Tvrtko Ursulin
2026-04-13 15:03 ` [PATCH 04/10] drm/v3d: Replace spin_lock_irqsave() with spin_lock_irq() Maíra Canal
2026-04-16 11:46 ` Tvrtko Ursulin
2026-04-13 15:03 ` [PATCH 05/10] drm/v3d: Extract v3d_job_add_syncobjs() helper Maíra Canal
2026-04-16 11:53 ` Tvrtko Ursulin
2026-04-13 15:03 ` [PATCH 06/10] drm/v3d: Reject invalid syncobj handles in submit ioctls Maíra Canal
2026-04-16 11:59 ` Tvrtko Ursulin
2026-05-08 15:28 ` Maíra Canal [this message]
2026-04-17 15:05 ` Tvrtko Ursulin
2026-04-13 15:03 ` [PATCH 07/10] drm/v3d: Migrate BO reservation locking to DRM exec Maíra Canal
2026-04-16 12:24 ` Tvrtko Ursulin
2026-04-13 15:03 ` [PATCH 08/10] drm/v3d: Introduce struct v3d_submit and convert CL/TFU/CSD ioctls Maíra Canal
2026-04-16 14:16 ` Tvrtko Ursulin
2026-04-13 15:03 ` [PATCH 09/10] drm/v3d: Refactor CPU ioctl into unified submission chain Maíra Canal
2026-04-17 14:38 ` Tvrtko Ursulin
2026-05-09 13:33 ` Maíra Canal
2026-04-13 15:03 ` [PATCH 10/10] drm/v3d: Ensure atomic submissions in v3d_submit_jobs() Maíra Canal
2026-04-17 15:02 ` Tvrtko Ursulin
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=cdcecda5-285b-4582-93cd-0170575aa87a@igalia.com \
--to=mcanal@igalia.com \
--cc=airlied@gmail.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=itoral@igalia.com \
--cc=kernel-dev@igalia.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=mwen@igalia.com \
--cc=simona@ffwll.ch \
--cc=tvrtko.ursulin@igalia.com \
--cc=tzimmermann@suse.de \
/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