From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Christian König <christian.koenig@amd.com>,
Julian Orth <ju.orth@gmail.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>,
Rob Clark <robin.clark@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/syncobj: Fix handle <-> fd ioctls with dirty stack
Date: Mon, 2 Mar 2026 14:54:02 +0300 [thread overview]
Message-ID: <75cdb128-2928-43e1-9a7f-e3c4dc40ee1b@collabora.com> (raw)
In-Reply-To: <93f2c5b5-4f5e-46f1-a7f3-c388ab762592@amd.com>
On 3/2/26 14:27, Christian König wrote:
> On 3/1/26 13:34, Julian Orth wrote:
>> Consider the following application:
>>
>> #include <fcntl.h>
>> #include <string.h>
>> #include <drm/drm.h>
>> #include <sys/ioctl.h>
>>
>> int main(void) {
>> int fd = open("/dev/dri/renderD128", O_RDWR);
>> struct drm_syncobj_create arg1;
>> ioctl(fd, DRM_IOCTL_SYNCOBJ_CREATE, &arg1);
>> struct drm_syncobj_handle arg2;
>> memset(&arg2, 1, sizeof(arg2)); // simulate dirty stack
>> arg2.handle = arg1.handle;
>> arg2.flags = 0;
>> arg2.fd = 0;
>> arg2.pad = 0;
>> // arg2.point = 0; // userspace is required to set point to 0
>> ioctl(fd, DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD, &arg2);
>> }
>>
>> The last ioctl returns EINVAL because args->point is not 0. However,
>> userspace developed against older kernel versions is not aware of the
>> new point field and might therefore not initialize it.
>>
>> The correct check would be
>>
>> if (args->flags & DRM_SYNCOBJ_FD_TO_HANDLE_FLAGS_TIMELINE)
>> return -EINVAL;
>>
>> However, there might already be userspace that relies on this not
>> returning an error as long as point == 0. Therefore use the more lenient
>> check.
>>
>> Fixes: c2d3a7300695 ("drm/syncobj: Extend EXPORT_SYNC_FILE for timeline syncobjs")
>> Signed-off-by: Julian Orth <ju.orth@gmail.com>
>
> Good catch, Reviewed-by: Christian König <christian.koenig@amd.com>
>
> As long as nobody objects I'm going to push this to drm-misc-fixes later today.
No objections, thanks
--
Best regards,
Dmitry
next prev parent reply other threads:[~2026-03-02 11:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 12:34 [PATCH] drm/syncobj: Fix handle <-> fd ioctls with dirty stack Julian Orth
2026-03-02 11:27 ` Christian König
2026-03-02 11:54 ` Dmitry Osipenko [this message]
2026-03-03 3:58 ` Claude review: " Claude Code Review Bot
2026-03-03 3:58 ` Claude Code Review 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=75cdb128-2928-43e1-9a7f-e3c4dc40ee1b@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ju.orth@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=simona@ffwll.ch \
--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