drm/damage_helper: Check if damage clips has valid values
Subsystems (2)
PATCH 1/1 drm/damage_helper: Check if damage clips has valid values
Userspace can set a damage clip with a negative coordinate, negative width or height or larger than the plane.
This invalid values could cause issues in some HW or even worst enable security flaws.
--- drivers/gpu/drm/drm_atomic_helper.c | 4 ++- drivers/gpu/drm/drm_damage_helper.c | 49 +++++++++++++++++++++++------ include/drm/drm_damage_helper.h | 4 +-- 3 files changed, 45 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +3 -1
@@ -897,7 +897,9 @@ drm_atomic_helper_check_planes(struct drm_device *dev,drm_atomic_helper_plane_changed (state, old_plane_state, new_plane_state, plane); -drm_atomic_helper_check_plane_damage (state, new_plane_state); + ret =drm_atomic_helper_check_plane_damage (state, new_plane_state); +if (ret) +return ret;if (!funcs || !funcs->atomic_check)continue ;
drivers/gpu/drm/drm_damage_helper.c +40 -9
76 lines not on this page · raw message
include/drm/drm_damage_helper.h +2 -2
@@ -65,8 +65,8 @@ struct drm_atomic_helper_damage_iter { };void drm_plane_enable_fb_damage_clips (struct drm_plane *plane); -void drm_atomic_helper_check_plane_damage (struct drm_atomic_state *state, -struct drm_plane_state *plane_state); +int drm_atomic_helper_check_plane_damage (struct drm_atomic_state *state, +struct drm_plane_state *plane_state); int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, struct drm_file *file_priv, unsigned int flags, unsigned int color, struct drm_clip_rect *clips,
Signature · 6 lines
2.29.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/damage_helper: Check if damage clips has valid values
== Series Details ==
== Series Details ==
Series: drm/damage_helper: Check if damage clips has valid values
URL : https://patchwork.freedesktop.org/series/84871/
State : warning
== Summary ==
$ make htmldocs 2>&1 > /dev/null | grep i915 Error: Cannot open file ./drivers/gpu/drm/i915/gt/intel_lrc.c WARNING: kernel-doc './scripts/kernel-doc -rst -enable-lineno -sphinx-version 1.7.9 -function Logical Rings, Logical Ring Contexts and Execlists ./drivers/gpu/drm/i915/gt/intel_lrc.c' failed with return code 1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Can you add some drm_dbg_atomic logs when the damage is invalid, to make it easier for user-space to understand why an atomic commit failed?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · Simon Ser
Can you add some
drm_dbg_atomiclogs when the damage is invalid, to make it easier for user-space to understand why an atomic commit failed?
sure, this is enough? will wait for a couple of more days before send another version.
drivers/gpu/drm/drm_damage_helper.c +13 -3
@@ -33,6 +33,7 @@#include <drm/drm_atomic.h> #include <drm/drm_damage_helper.h> #include <drm/drm_device.h> +#include <drm/drm_print.h> /** * DOC: overview
@@ -152,16 +153,25 @@ int drm_atomic_helper_check_plane_damage(struct drm_atomic_state *state,for (; num_clips; num_clips--, damaged_clips++) {if (damaged_clips->x1 <0 || damaged_clips->x2 <0 || - damaged_clips->y1 <0 || damaged_clips->y2 <0 ) + damaged_clips->y1 <0 || damaged_clips->y2 <0 ) { +drm_dbg_atomic (state->dev, +"Invalid damage clip, negative coordinate\n" );return -EINVAL ; + }if (damaged_clips->x2 < damaged_clips->x1 || - damaged_clips->y2 < damaged_clips->y1) + damaged_clips->y2 < damaged_clips->y1) { +drm_dbg_atomic (state->dev, +"Invalid damage clip, negative width or height\n" );return -EINVAL ; + }if ((damaged_clips->x2 - damaged_clips->x1) > w || - (damaged_clips->y2 - damaged_clips->y1) > h) + (damaged_clips->y2 - damaged_clips->y1) > h) { +drm_dbg_atomic (state->dev, +"Invalid damage clip, width or height larger than plane\n" );return -EINVAL ; + } }return 0 ;
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/damage_helper: Check if damage clips has valid values (rev2)
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: drm/damage_helper: Check if damage clips has valid values (rev2)
URL : https://patchwork.freedesktop.org/series/84871/
State : failure
== Summary ==
Applying: drm/damage_helper: Check if damage clips has valid values
error: patch failed: drivers/gpu/drm/drm_damage_helper.c:152
error: drivers/gpu/drm/drm_damage_helper.c: patch does not apply
error: Did you hand edit your patch?
It does not apply to blobs recorded in its index.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Using index info to reconstruct a base tree...
M drivers/gpu/drm/drm_damage_helper.c
Patch failed at 0001 drm/damage_helper: Check if damage clips has valid values When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for drm/damage_helper: Check if damage clips has valid values
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: drm/damage_helper: Check if damage clips has valid values
URL : https://patchwork.freedesktop.org/series/84871/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_9478 -> Patchwork_19128
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19128/index.html
Known issues
------------
Here are the changes found in Patchwork_19128 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][1] ([i915#2029] / [i915#2722])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19128/fi-bdw-5557u/igt@[email protected]
* igt@vgem_basic@debugfs:
- fi-tgl-y: [PASS][2] -> [DMESG-WARN][3] ([i915#402]) +1 similar issue
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9478/fi-tgl-y/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19128/fi-tgl-y/igt@[email protected]
#### Possible fixes ####
* igt@fbdev@read:
- fi-tgl-y: [DMESG-WARN][4] ([i915#402]) -> [PASS][5] +1 similar issue
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9478/fi-tgl-y/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19128/fi-tgl-y/igt@[email protected]
[i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
Participating hosts (42 -> 35)
------------------------------
Missing (7): fi-bxt-dsi fi-bdw-samus fi-bsw-n3050 fi-hsw-4200u fi-skl-guc fi-blb-e6850 fi-skl-6700k2
Build changes
-------------
* Linux: CI_DRM_9478 -> Patchwork_19128
CI-20190529: 20190529
CI_DRM_9478: 94cf3a4cc350324f21728c70954c46e535405c87 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5890: 0e209dc3cd7561a57ec45be74b8b299eaf391950 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19128: 126999772374409aeab1028524a48eea612aee5d @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
126999772374 drm/damage_helper: Check if damage clips has valid values
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19128/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx