Skip to contentSkip to conversation

drm/i915: Reject relocation writes to RO userptr

PATCH In review Joonas Lahtinen 3 participants 5 messages Nov 26

Subsystems (3)
lore
Share & tools
lore

Joonas Lahtinen

author maintainer
#0 lore raw

PATCH 1/1 drm/i915: Reject relocation writes to RO userptr

Read-only userptr BOs shouldn't be allowed to have relocation addresses written back to them. Enforce that.

The relocation slow path where this could have happened has been in place, reverted and then re-introduced. GPU relocations path protected against this via ppGTT flags was also reverted at point.

There's no legimate use-case for this, so instead of trying to track which kernel versions were impacted and which not, just outright reject with EFAULT on all kernels with RO userptr support.

Fixes 0b100760e3e8 ("drm/i915/userptr: Enable read-only support on gen8+")
Cc <[email protected]> # v4.19+
Cc Matthew Auld <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +4 -0
index c41e1b9a40bc..7ed23dc392b8 100644
@@ -511,6 +511,10 @@ eb_validate_vma(struct i915_execbuffer *eb,
 	if (unlikely(entry->flags & eb->invalid_flags))
 		return -EINVAL;
 
+	if (unlikely(i915_gem_object_is_readonly(vma->obj) &&
+		     entry->relocation_count))
+		return -EFAULT;
+
 	if (unlikely(entry->alignment &&
 		     !is_power_of_2_u64(entry->alignment)))
 		return -EINVAL;
Signature · 1 line
2.56.1
#1 lore raw

✗ i915.CI.BAT: failure for drm/i915: Reject relocation writes to RO userptr

== Series Details ==

== Series Details ==

Series: drm/i915: Reject relocation writes to RO userptr
URL : https://patchwork.freedesktop.org/series/179732/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_19615 -> Patchwork_179732v1
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_179732v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes
introduced in Patchwork_179732v1, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v1/index.html

Participating hosts (40 -> 39)
------------------------------

Missing (1): bat-dg2-13

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_179732v1:

### IGT changes ###

#### Possible regressions ####

* igt@i915_module_load@load:
- fi-kbl-8809g: [PASS][1] -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19615/fi-kbl-8809g/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v1/fi-kbl-8809g/igt@[email protected]

Build changes
-------------

* Linux: CI_DRM_19615 -> Patchwork_179732v1

CI-20190529: 20190529
CI_DRM_19615: 3895433515d2f602b53c660afbcd2179f0326e1e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9204: 52e9317c945f97f29fbec75be29280fc7b00cf32 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_179732v1: 3895433515d2f602b53c660afbcd2179f0326e1e @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v1/index.html

author maintainer
#2 lore raw

Re: ✗ i915.CI.BAT: failure for drm/i915: Reject relocation writes to RO userptr

Quoting Patchwork (2026-11-26 12:45:29)

Quoted 33 lines

Patch Details

Series:  drm/i915: Reject relocation writes to RO userptr
URL:     https://patchwork.freedesktop.org/series/179732/
State:   failure
Details: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v1/index.html

CI Bug Log - changes from CI_DRM_19615 -> Patchwork_179732v1

Summary

FAILURE

Serious unknown changes coming with Patchwork_179732v1 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_179732v1, please notify your bug team ([email protected]) to allow them
to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v1/
index.html

Participating hosts (40 -> 39)

Missing (1): bat-dg2-13

Possible new issues

Here are the unknown changes that may have been introduced in Patchwork_179732v1:

Quoted 6 lines

IGT changes

Possible regressions

• igt@i915_module_load@load:

      □ fi-kbl-8809g: PASS -> ABORT

This failure seems completely unrelated.

Regards, Joonas

Quoted 13 lines

Build changes

• Linux: CI_DRM_19615 -> Patchwork_179732v1

CI-20190529: 20190529
CI_DRM_19615: 3895433515d2f602b53c660afbcd2179f0326e1e @ git://
anongit.freedesktop.org/gfx-ci/linux
IGT_9204: 52e9317c945f97f29fbec75be29280fc7b00cf32 @ https://
gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_179732v1: 3895433515d2f602b53c660afbcd2179f0326e1e @ git://
anongit.freedesktop.org/gfx-ci/linux

#3 lore raw

✓ i915.CI.BAT: success for drm/i915: Reject relocation writes to RO userptr (rev2)

In reply to Joonas Lahtinen
== Series Details ==

== Series Details ==

Series: drm/i915: Reject relocation writes to RO userptr (rev2)
URL : https://patchwork.freedesktop.org/series/179732/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_19615 -> Patchwork_179732v2
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v2/index.html

Participating hosts (40 -> 38)
------------------------------

Missing (2): bat-dg2-13 bat-adls-6

Known issues
------------

Here are the changes found in Patchwork_179732v2 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@late_gt_pm:
- fi-cfl-8109u: [PASS][1] -> [DMESG-WARN][2] ([i915#13735]) +80 other tests dmesg-warn
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19615/fi-cfl-8109u/igt@i915_selftest@live@late_gt_pm.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v2/fi-cfl-8109u/igt@i915_selftest@live@late_gt_pm.html

* igt@kms_pipe_crc_basic@read-crc:
- fi-cfl-8109u: [PASS][3] -> [DMESG-WARN][4] ([i915#13735] / [i915#15673]) +49 other tests dmesg-warn
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19615/fi-cfl-8109u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v2/fi-cfl-8109u/igt@[email protected]

#### Possible fixes ####

* igt@vgem_basic@unload:
- bat-rpls-4: [DMESG-WARN][5] ([i915#13400]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_19615/bat-rpls-4/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v2/bat-rpls-4/igt@[email protected]

[i915#13400]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13400
[i915#13735]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13735
[i915#15673]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15673

Build changes
-------------

* Linux: CI_DRM_19615 -> Patchwork_179732v2

CI-20190529: 20190529
CI_DRM_19615: 3895433515d2f602b53c660afbcd2179f0326e1e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_9204: 52e9317c945f97f29fbec75be29280fc7b00cf32 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_179732v2: 3895433515d2f602b53c660afbcd2179f0326e1e @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_179732v2/index.html

maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Joonas Lahtinen
Quoted 28 lines · Joonas Lahtinen

Read-only userptr BOs shouldn't be allowed to have relocation addresses written back to them. Enforce that.

The relocation slow path where this could have happened has been in place, reverted and then re-introduced. GPU relocations path protected against this via ppGTT flags was also reverted at point.

There's no legimate use-case for this, so instead of trying to track which kernel versions were impacted and which not, just outright reject with EFAULT on all kernels with RO userptr support.

Fixes 0b100760e3e8 ("drm/i915/userptr: Enable read-only support on gen8+")
Cc <[email protected]> # v4.19+
Cc Matthew Auld <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
---
  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +0 -0
index c41e1b9a40bc..7ed23dc392b8 100644

drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c eb_validate_vma(struct i915_execbuffer *eb, · line 520

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +4 -0
@@ -511,6 +511,10 @@ eb_validate_vma(struct i915_execbuffer *eb,
  	if (unlikely(entry->flags & eb->invalid_flags))
  		return -EINVAL;
 
+	if (unlikely(i915_gem_object_is_readonly(vma->obj) &&
+		     entry->relocation_count))
+		return -EFAULT;
+
  	if (unlikely(entry->alignment &&
  		     !is_power_of_2_u64(entry->alignment)))
  		return -EINVAL;

Regards,

Tvrtko