Skip to content

drm/qxl: fix multiple missing bounds checks in execbuffer relocations

Aldo Ariel Panzardo dri-devel stable 2 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 0 repliesNew
  2. v11 patch 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4drm/qxl: validate relocation dst_offset against destination BOdrivers/gpu/drm/qxl/qxl_ioctl.c+16 -00 replies
2/4drm/qxl: reject command sizes that exceed the release slotdrivers/gpu/drm/qxl/qxl_release.c+3 -00 replies
3/4drm/qxl: reject relocations whose writes cross a page boundarydrivers/gpu/drm/qxl/qxl_ioctl.c+6 -00 replies
4/4drm/qxl: validate relocation src_offset and fix type truncationdrivers/gpu/drm/qxl/qxl_ioctl.c+5 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] drm/qxl: fix multiple missing bounds checks in execbuffer relocations

The qxl execbuffer ioctl processes user-supplied relocation entries without adequate validation, enabling several memory-safety violations reachable from any DRM_AUTH render client.

Patch 1 is a v2 of a previously submitted single patch. The v1 had two gaps identified by sashiko-bot review: the upper bound for dst_handle==0 relocations did not account for the write width, and the general BO bounds check could overflow on ILP32. Both are fixed in this revision.

Patches 2-4 fix pre-existing issues in the same code path that were surfaced during the v1 review:

- Patch 2: The release sub-allocator ignores the requested size and always uses 256-byte slots, but the ioctl allows commands up to ~4088 bytes, overflowing into adjacent slots.

- Patch 3: Relocations with page-unaligned offsets can write past a single-page kmap mapping.

- Patch 4: src_offset is silently truncated from __u64 to int and never validated, generating out-of-bounds physical addresses.

Aldo Ariel Panzardo (4):
drm/qxl: validate relocation dst_offset against destination BO drm/qxl: reject command sizes that exceed the release slot drm/qxl: reject relocations whose writes cross a page boundary drm/qxl: validate relocation src_offset and fix type truncation

 drivers/gpu/drm/qxl/qxl_ioctl.c   | 28 +++++++++++++++++++++++++++-
 drivers/gpu/drm/qxl/qxl_release.c |  3 +++
 2 files changed, 30 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0