From: sashiko-bot@kernel.org
To: "Aldo Ariel Panzardo" <qwe.aldo@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/4] drm/qxl: validate relocation dst_offset against destination BO
Date: Sun, 13 Sep 2026 22:44:35 +0000 [thread overview]
Message-ID: <20260913224435.750671F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260913223000.695299-2-qwe.aldo@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] The patch fails to prevent out-of-bounds writes for system RAM BOs (dumb buffers) due to a preexisting flaw in qxl_bo_kmap_atomic_page's fallback branch.
--
commit 816a48396f060545d332f11cc2d661437076fb2f
Author: Aldo Ariel Panzardo <qwe.aldo@gmail.com>
drm/qxl: validate relocation dst_offset against destination BO
This patch attempts to prevent out-of-bounds writes during relocation
processing by validating that the user-provided dst_offset falls within
the destination buffer object. It adds bounds checks for both the
command/release BO and general relocation destination BOs.
> diff --git a/drivers/gpu/drm/qxl/qxl_ioctl.c b/drivers/gpu/drm/qxl/qxl_ioctl.c
> index 591b026ceff9c..e727a35c94136 100644
> --- a/drivers/gpu/drm/qxl/qxl_ioctl.c
> +++ b/drivers/gpu/drm/qxl/qxl_ioctl.c
[ ... ]
> @@ -227,10 +231,22 @@ static int qxl_process_single_command(struct qxl_device *qdev,
> goto out_free_bos;
> reloc_info[i].dst_offset = reloc.dst_offset;
> } else {
[ ... ]
> reloc_info[i].dst_bo = cmd_bo;
> reloc_info[i].dst_offset = reloc.dst_offset + release->release_offset;
> }
>
> + if ((u64)reloc_info[i].dst_offset + write_size >
> + reloc_info[i].dst_bo->tbo.base.size) {
[Severity: Critical]
This is a pre-existing issue, but does this newly added bounds check fully
prevent out-of-bounds writes for system RAM BOs (dumb buffers)?
The new bounds check in qxl_process_single_command verifies that dst_offset
is within the BO size. However, it relies on the un-multiplied byte offset.
Later, apply_reloc calls qxl_bo_kmap_atomic_page, passing
dst_offset & PAGE_MASK as the page_offset argument.
If a user creates a dumb buffer (placed in TTM_PL_SYSTEM) and passes its
handle with a large dst_offset, qxl_bo_kmap_atomic_page in
drivers/gpu/drm/qxl/qxl_object.c takes a fallback branch. That fallback
branch contains the following pointer calculation:
rptr += page_offset * PAGE_SIZE;
Because page_offset is derived from a byte offset, multiplying it by
PAGE_SIZE creates a massive out-of-bounds pointer calculation (for example,
a 100MB offset becomes 400GB). Since the QXL_EXECBUFFER ioctl is accessible
to any authenticated DRM client, an unprivileged user could use this path to
write a 64-bit physical address or 32-bit surface ID into kernel memory,
which can lead to system compromise or a kernel panic.
Should the underlying multiplier bug in qxl_bo_kmap_atomic_page be addressed
alongside this patch to ensure the vulnerability is fully closed?
> + ret = -EINVAL;
> + goto out_free_bos;
> + }
> +
> /* reserve and validate the reloc dst bo */
> if (reloc.reloc_type == QXL_RELOC_TYPE_BO || reloc.src_handle) {
> ret = qxlhw_handle_to_bo(file_priv, reloc.src_handle, release,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260913223000.695299-1-qwe.aldo@gmail.com?part=1
next prev parent reply other threads:[~2026-09-13 22:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 22:29 [PATCH v2 0/4] drm/qxl: fix multiple missing bounds checks in execbuffer relocations Aldo Ariel Panzardo
2026-09-13 22:29 ` [PATCH v2 1/4] drm/qxl: validate relocation dst_offset against destination BO Aldo Ariel Panzardo
2026-09-13 22:44 ` sashiko-bot [this message]
2026-09-13 22:29 ` [PATCH v2 2/4] drm/qxl: reject command sizes that exceed the release slot Aldo Ariel Panzardo
2026-09-13 22:45 ` sashiko-bot
2026-09-13 22:29 ` [PATCH v2 3/4] drm/qxl: reject relocations whose writes cross a page boundary Aldo Ariel Panzardo
2026-09-13 22:45 ` sashiko-bot
2026-09-13 22:30 ` [PATCH v2 4/4] drm/qxl: validate relocation src_offset and fix type truncation Aldo Ariel Panzardo
2026-09-13 22:46 ` 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=20260913224435.750671F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=qwe.aldo@gmail.com \
--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