* [PATCH] drm/i915: zero fill vma name buffer
@ 2021-09-15 19:23 ` Tim Gardner
0 siblings, 0 replies; 12+ messages in thread
From: Tim Gardner @ 2021-09-15 19:23 UTC (permalink / raw)
To: linux-kernel
Cc: tim.gardner, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
David Airlie, Daniel Vetter, intel-gfx, dri-devel
In capture_vma() Coverity complains of a possible buffer overrun. Even
though this is a static function where all call sites can be checked,
limiting the copy length could save some future grief.
CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
by copying name without checking the length.
5. parameter_as_source: Note: This defect has an elevated risk because the
source argument is a parameter of the current function.
1326 strcpy(c->name, name);
Fix any possible overflows by using strncpy(). Zero fill the name buffer to
guarantee ASCII string NULL termination.
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9cf6ac575de1..154df174e2d7 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1297,10 +1297,11 @@ static bool record_context(struct i915_gem_context_coredump *e,
return simulated;
}
+#define VMA_NAME_LEN 16
struct intel_engine_capture_vma {
struct intel_engine_capture_vma *next;
struct i915_vma *vma;
- char name[16];
+ char name[VMA_NAME_LEN];
};
static struct intel_engine_capture_vma *
@@ -1314,7 +1315,7 @@ capture_vma(struct intel_engine_capture_vma *next,
if (!vma)
return next;
- c = kmalloc(sizeof(*c), gfp);
+ c = kzalloc(sizeof(*c), gfp);
if (!c)
return next;
@@ -1323,7 +1324,7 @@ capture_vma(struct intel_engine_capture_vma *next,
return next;
}
- strcpy(c->name, name);
+ strncpy(c->name, name, VMA_NAME_LEN-1);
c->vma = vma; /* reference held while active */
c->next = next;
--
2.33.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-gfx] [PATCH] drm/i915: zero fill vma name buffer
@ 2021-09-15 19:23 ` Tim Gardner
0 siblings, 0 replies; 12+ messages in thread
From: Tim Gardner @ 2021-09-15 19:23 UTC (permalink / raw)
To: linux-kernel
Cc: tim.gardner, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
David Airlie, Daniel Vetter, intel-gfx, dri-devel
In capture_vma() Coverity complains of a possible buffer overrun. Even
though this is a static function where all call sites can be checked,
limiting the copy length could save some future grief.
CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
by copying name without checking the length.
5. parameter_as_source: Note: This defect has an elevated risk because the
source argument is a parameter of the current function.
1326 strcpy(c->name, name);
Fix any possible overflows by using strncpy(). Zero fill the name buffer to
guarantee ASCII string NULL termination.
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9cf6ac575de1..154df174e2d7 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1297,10 +1297,11 @@ static bool record_context(struct i915_gem_context_coredump *e,
return simulated;
}
+#define VMA_NAME_LEN 16
struct intel_engine_capture_vma {
struct intel_engine_capture_vma *next;
struct i915_vma *vma;
- char name[16];
+ char name[VMA_NAME_LEN];
};
static struct intel_engine_capture_vma *
@@ -1314,7 +1315,7 @@ capture_vma(struct intel_engine_capture_vma *next,
if (!vma)
return next;
- c = kmalloc(sizeof(*c), gfp);
+ c = kzalloc(sizeof(*c), gfp);
if (!c)
return next;
@@ -1323,7 +1324,7 @@ capture_vma(struct intel_engine_capture_vma *next,
return next;
}
- strcpy(c->name, name);
+ strncpy(c->name, name, VMA_NAME_LEN-1);
c->vma = vma; /* reference held while active */
c->next = next;
--
2.33.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: zero fill vma name buffer
2021-09-15 19:23 ` [Intel-gfx] " Tim Gardner
(?)
@ 2021-09-15 20:34 ` Patchwork
-1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2021-09-15 20:34 UTC (permalink / raw)
To: Tim Gardner; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: zero fill vma name buffer
URL : https://patchwork.freedesktop.org/series/94708/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
3215090a38c8 drm/i915: zero fill vma name buffer
-:11: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#11:
4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
-:61: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV)
#61: FILE: drivers/gpu/drm/i915/i915_gpu_error.c:1347:
+ strncpy(c->name, name, VMA_NAME_LEN-1);
^
total: 0 errors, 1 warnings, 1 checks, 28 lines checked
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: zero fill vma name buffer
2021-09-15 19:23 ` [Intel-gfx] " Tim Gardner
(?)
(?)
@ 2021-09-15 21:01 ` Patchwork
-1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2021-09-15 21:01 UTC (permalink / raw)
To: Tim Gardner; +Cc: intel-gfx
[-- Attachment #1: Type: text/plain, Size: 11647 bytes --]
== Series Details ==
Series: drm/i915: zero fill vma name buffer
URL : https://patchwork.freedesktop.org/series/94708/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_10593 -> Patchwork_21066
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_21066 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_21066, please notify your bug team 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_21066/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_21066:
### IGT changes ###
#### Possible regressions ####
* igt@i915_module_load@reload:
- fi-rkl-guc: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-rkl-guc/igt@i915_module_load@reload.html
- fi-skl-6700k2: NOTRUN -> [INCOMPLETE][2]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-skl-6700k2/igt@i915_module_load@reload.html
- fi-skl-guc: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-skl-guc/igt@i915_module_load@reload.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-skl-guc/igt@i915_module_load@reload.html
- fi-icl-y: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-icl-y/igt@i915_module_load@reload.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-icl-y/igt@i915_module_load@reload.html
#### Warnings ####
* igt@i915_module_load@reload:
- fi-cml-u2: [INCOMPLETE][7] ([i915#4136]) -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-cml-u2/igt@i915_module_load@reload.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-cml-u2/igt@i915_module_load@reload.html
- fi-kbl-soraka: [INCOMPLETE][9] ([i915#4136]) -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-kbl-soraka/igt@i915_module_load@reload.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-kbl-soraka/igt@i915_module_load@reload.html
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses.
They do not affect the overall result.
* igt@i915_module_load@reload:
- {fi-tgl-dsi}: [INCOMPLETE][11] ([i915#4136]) -> [INCOMPLETE][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-tgl-dsi/igt@i915_module_load@reload.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-dsi/igt@i915_module_load@reload.html
- {fi-ehl-2}: [INCOMPLETE][13] ([i915#4136]) -> [INCOMPLETE][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-ehl-2/igt@i915_module_load@reload.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-ehl-2/igt@i915_module_load@reload.html
Known issues
------------
Here are the changes found in Patchwork_21066 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_cs_nop@fork-gfx0:
- fi-icl-u2: NOTRUN -> [SKIP][15] ([fdo#109315]) +17 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-icl-u2/igt@amdgpu/amd_cs_nop@fork-gfx0.html
* igt@core_hotunplug@unbind-rebind:
- fi-cfl-guc: [PASS][16] -> [INCOMPLETE][17] ([i915#4130])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-cfl-guc/igt@core_hotunplug@unbind-rebind.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-cfl-guc/igt@core_hotunplug@unbind-rebind.html
- fi-tgl-1115g4: NOTRUN -> [INCOMPLETE][18] ([i915#4130])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@core_hotunplug@unbind-rebind.html
- fi-cfl-8700k: [PASS][19] -> [INCOMPLETE][20] ([i915#4130])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-cfl-8700k/igt@core_hotunplug@unbind-rebind.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-cfl-8700k/igt@core_hotunplug@unbind-rebind.html
- fi-rkl-11600: [PASS][21] -> [INCOMPLETE][22] ([i915#4130])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-rkl-11600/igt@core_hotunplug@unbind-rebind.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-rkl-11600/igt@core_hotunplug@unbind-rebind.html
* igt@gem_huc_copy@huc-copy:
- fi-tgl-1115g4: NOTRUN -> [SKIP][23] ([i915#2190])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@gem_huc_copy@huc-copy.html
* igt@i915_pm_backlight@basic-brightness:
- fi-tgl-1115g4: NOTRUN -> [SKIP][24] ([i915#1155])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@i915_pm_backlight@basic-brightness.html
* igt@kms_chamelium@common-hpd-after-suspend:
- fi-tgl-1115g4: NOTRUN -> [SKIP][25] ([fdo#111827]) +8 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@kms_chamelium@common-hpd-after-suspend.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-tgl-1115g4: NOTRUN -> [SKIP][26] ([i915#4103]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html
* igt@kms_force_connector_basic@force-load-detect:
- fi-tgl-1115g4: NOTRUN -> [SKIP][27] ([fdo#109285])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@kms_force_connector_basic@force-load-detect.html
* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
- fi-rkl-11600: [PASS][28] -> [SKIP][29] ([i915#3919] / [i915#4098])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-rkl-11600/igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-rkl-11600/igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a.html
* igt@kms_psr@primary_mmap_gtt:
- fi-tgl-1115g4: NOTRUN -> [SKIP][30] ([i915#1072]) +3 similar issues
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@kms_psr@primary_mmap_gtt.html
* igt@prime_vgem@basic-userptr:
- fi-tgl-1115g4: NOTRUN -> [SKIP][31] ([i915#3301])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@prime_vgem@basic-userptr.html
* igt@runner@aborted:
- fi-kbl-8809g: NOTRUN -> [FAIL][32] ([i915#2722] / [i915#3363])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-kbl-8809g/igt@runner@aborted.html
- fi-cml-u2: NOTRUN -> [FAIL][33] ([i915#2082] / [i915#2426] / [i915#3363])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-cml-u2/igt@runner@aborted.html
- fi-rkl-guc: NOTRUN -> [FAIL][34] ([i915#2426])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-rkl-guc/igt@runner@aborted.html
- fi-tgl-1115g4: NOTRUN -> [FAIL][35] ([i915#1602] / [i915#2722])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-tgl-1115g4/igt@runner@aborted.html
- fi-skl-guc: NOTRUN -> [FAIL][36] ([i915#2426] / [i915#3363])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-skl-guc/igt@runner@aborted.html
- fi-skl-6700k2: NOTRUN -> [FAIL][37] ([i915#2426] / [i915#3363])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-skl-6700k2/igt@runner@aborted.html
#### Possible fixes ####
* igt@core_hotunplug@unbind-rebind:
- fi-skl-6700k2: [INCOMPLETE][38] ([i915#4130]) -> [PASS][39]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-skl-6700k2/igt@core_hotunplug@unbind-rebind.html
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-skl-6700k2/igt@core_hotunplug@unbind-rebind.html
- fi-rkl-guc: [INCOMPLETE][40] ([i915#4130]) -> [PASS][41]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-rkl-guc/igt@core_hotunplug@unbind-rebind.html
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-rkl-guc/igt@core_hotunplug@unbind-rebind.html
- fi-icl-u2: [INCOMPLETE][42] ([i915#4130]) -> [PASS][43]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-icl-u2/igt@core_hotunplug@unbind-rebind.html
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-icl-u2/igt@core_hotunplug@unbind-rebind.html
* igt@i915_module_load@reload:
- fi-kbl-guc: [INCOMPLETE][44] -> [PASS][45]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-kbl-guc/igt@i915_module_load@reload.html
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-kbl-guc/igt@i915_module_load@reload.html
#### Warnings ####
* igt@i915_module_load@reload:
- fi-kbl-8809g: [INCOMPLETE][46] -> [INCOMPLETE][47] ([i915#4136])
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10593/fi-kbl-8809g/igt@i915_module_load@reload.html
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/fi-kbl-8809g/igt@i915_module_load@reload.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#2082]: https://gitlab.freedesktop.org/drm/intel/issues/2082
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#2932]: https://gitlab.freedesktop.org/drm/intel/issues/2932
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#3690]: https://gitlab.freedesktop.org/drm/intel/issues/3690
[i915#3919]: https://gitlab.freedesktop.org/drm/intel/issues/3919
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4130]: https://gitlab.freedesktop.org/drm/intel/issues/4130
[i915#4136]: https://gitlab.freedesktop.org/drm/intel/issues/4136
Participating hosts (39 -> 37)
------------------------------
Additional (1): fi-tgl-1115g4
Missing (3): fi-bdw-samus fi-bsw-cyan bat-dg1-6
Build changes
-------------
* Linux: CI_DRM_10593 -> Patchwork_21066
CI-20190529: 20190529
CI_DRM_10593: 6bc334de7baec4510b614dc80c330bf81fb8ca6f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6209: 07d6594ed02f55b68d64fa6dd7f80cfbc1ce4ef8 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21066: 3215090a38c8278c2a4e4562d4a74dc697764af0 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
3215090a38c8 drm/i915: zero fill vma name buffer
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21066/index.html
[-- Attachment #2: Type: text/html, Size: 13953 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: zero fill vma name buffer
2021-09-15 19:23 ` [Intel-gfx] " Tim Gardner
` (2 preceding siblings ...)
(?)
@ 2021-09-16 8:23 ` Tvrtko Ursulin
2021-09-16 10:43 ` Jani Nikula
-1 siblings, 1 reply; 12+ messages in thread
From: Tvrtko Ursulin @ 2021-09-16 8:23 UTC (permalink / raw)
To: Tim Gardner, linux-kernel
Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
Daniel Vetter, intel-gfx, dri-devel
On 15/09/2021 20:23, Tim Gardner wrote:
> In capture_vma() Coverity complains of a possible buffer overrun. Even
> though this is a static function where all call sites can be checked,
> limiting the copy length could save some future grief.
>
> CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
> 4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
> by copying name without checking the length.
> 5. parameter_as_source: Note: This defect has an elevated risk because the
> source argument is a parameter of the current function.
> 1326 strcpy(c->name, name);
>
> Fix any possible overflows by using strncpy(). Zero fill the name buffer to
> guarantee ASCII string NULL termination.
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
> drivers/gpu/drm/i915/i915_gpu_error.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 9cf6ac575de1..154df174e2d7 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1297,10 +1297,11 @@ static bool record_context(struct i915_gem_context_coredump *e,
> return simulated;
> }
>
> +#define VMA_NAME_LEN 16
> struct intel_engine_capture_vma {
> struct intel_engine_capture_vma *next;
> struct i915_vma *vma;
> - char name[16];
> + char name[VMA_NAME_LEN];
> };
>
> static struct intel_engine_capture_vma *
> @@ -1314,7 +1315,7 @@ capture_vma(struct intel_engine_capture_vma *next,
> if (!vma)
> return next;
>
> - c = kmalloc(sizeof(*c), gfp);
> + c = kzalloc(sizeof(*c), gfp);
> if (!c)
> return next;
>
> @@ -1323,7 +1324,7 @@ capture_vma(struct intel_engine_capture_vma *next,
> return next;
> }
>
> - strcpy(c->name, name);
> + strncpy(c->name, name, VMA_NAME_LEN-1);
GCC is supposed to catch any problems here as you say in the commit message.
But to fix I suggest a single line change to strlcpy(c->name, name,
sizeof(c->name)) which always null terminates as bonus.
Probably same in i915_vma_coredump_create() which with strncpy would
have a theoretical chance of attempting to copy over a
non-null-terminated string.
Regards,
Tvrtko
> c->vma = vma; /* reference held while active */
>
> c->next = next;
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: zero fill vma name buffer
2021-09-16 8:23 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
@ 2021-09-16 10:43 ` Jani Nikula
2021-09-16 11:37 ` Tim Gardner
0 siblings, 1 reply; 12+ messages in thread
From: Jani Nikula @ 2021-09-16 10:43 UTC (permalink / raw)
To: Tvrtko Ursulin, Tim Gardner, linux-kernel
Cc: Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter,
intel-gfx, dri-devel
On Thu, 16 Sep 2021, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> On 15/09/2021 20:23, Tim Gardner wrote:
>> In capture_vma() Coverity complains of a possible buffer overrun. Even
>> though this is a static function where all call sites can be checked,
>> limiting the copy length could save some future grief.
>>
>> CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
>> 4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
>> by copying name without checking the length.
>> 5. parameter_as_source: Note: This defect has an elevated risk because the
>> source argument is a parameter of the current function.
>> 1326 strcpy(c->name, name);
>>
>> Fix any possible overflows by using strncpy(). Zero fill the name buffer to
>> guarantee ASCII string NULL termination.
>>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>> Cc: David Airlie <airlied@linux.ie>
>> Cc: Daniel Vetter <daniel@ffwll.ch>
>> Cc: intel-gfx@lists.freedesktop.org
>> Cc: dri-devel@lists.freedesktop.org
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
>> ---
>> drivers/gpu/drm/i915/i915_gpu_error.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
>> index 9cf6ac575de1..154df174e2d7 100644
>> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
>> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
>> @@ -1297,10 +1297,11 @@ static bool record_context(struct i915_gem_context_coredump *e,
>> return simulated;
>> }
>>
>> +#define VMA_NAME_LEN 16
>> struct intel_engine_capture_vma {
>> struct intel_engine_capture_vma *next;
>> struct i915_vma *vma;
>> - char name[16];
>> + char name[VMA_NAME_LEN];
>> };
>>
>> static struct intel_engine_capture_vma *
>> @@ -1314,7 +1315,7 @@ capture_vma(struct intel_engine_capture_vma *next,
>> if (!vma)
>> return next;
>>
>> - c = kmalloc(sizeof(*c), gfp);
>> + c = kzalloc(sizeof(*c), gfp);
>> if (!c)
>> return next;
>>
>> @@ -1323,7 +1324,7 @@ capture_vma(struct intel_engine_capture_vma *next,
>> return next;
>> }
>>
>> - strcpy(c->name, name);
>> + strncpy(c->name, name, VMA_NAME_LEN-1);
>
> GCC is supposed to catch any problems here as you say in the commit message.
>
> But to fix I suggest a single line change to strlcpy(c->name, name,
> sizeof(c->name)) which always null terminates as bonus.
strscpy() is preferred over both strncpy() and strlcpy(). :)
BR,
Jani.
>
> Probably same in i915_vma_coredump_create() which with strncpy would
> have a theoretical chance of attempting to copy over a
> non-null-terminated string.
>
> Regards,
>
> Tvrtko
>
>> c->vma = vma; /* reference held while active */
>>
>> c->next = next;
>>
--
Jani Nikula, Intel Open Source Graphics Center
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [PATCH] drm/i915: zero fill vma name buffer
2021-09-16 10:43 ` Jani Nikula
@ 2021-09-16 11:37 ` Tim Gardner
2021-09-16 12:26 ` [Intel-gfx] " Tim Gardner
0 siblings, 1 reply; 12+ messages in thread
From: Tim Gardner @ 2021-09-16 11:37 UTC (permalink / raw)
To: Jani Nikula, Tvrtko Ursulin, linux-kernel
Cc: Joonas Lahtinen, Rodrigo Vivi, David Airlie, Daniel Vetter,
intel-gfx, dri-devel
On 9/16/21 4:43 AM, Jani Nikula wrote:
> On Thu, 16 Sep 2021, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
>> On 15/09/2021 20:23, Tim Gardner wrote:
>>> In capture_vma() Coverity complains of a possible buffer overrun. Even
>>> though this is a static function where all call sites can be checked,
>>> limiting the copy length could save some future grief.
>>>
>>> CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
>>> 4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
>>> by copying name without checking the length.
>>> 5. parameter_as_source: Note: This defect has an elevated risk because the
>>> source argument is a parameter of the current function.
>>> 1326 strcpy(c->name, name);
>>>
>>> Fix any possible overflows by using strncpy(). Zero fill the name buffer to
>>> guarantee ASCII string NULL termination.
>>>
>>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>> Cc: David Airlie <airlied@linux.ie>
>>> Cc: Daniel Vetter <daniel@ffwll.ch>
>>> Cc: intel-gfx@lists.freedesktop.org
>>> Cc: dri-devel@lists.freedesktop.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
>>> ---
>>> drivers/gpu/drm/i915/i915_gpu_error.c | 7 ++++---
>>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
>>> index 9cf6ac575de1..154df174e2d7 100644
>>> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
>>> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
>>> @@ -1297,10 +1297,11 @@ static bool record_context(struct i915_gem_context_coredump *e,
>>> return simulated;
>>> }
>>>
>>> +#define VMA_NAME_LEN 16
>>> struct intel_engine_capture_vma {
>>> struct intel_engine_capture_vma *next;
>>> struct i915_vma *vma;
>>> - char name[16];
>>> + char name[VMA_NAME_LEN];
>>> };
>>>
>>> static struct intel_engine_capture_vma *
>>> @@ -1314,7 +1315,7 @@ capture_vma(struct intel_engine_capture_vma *next,
>>> if (!vma)
>>> return next;
>>>
>>> - c = kmalloc(sizeof(*c), gfp);
>>> + c = kzalloc(sizeof(*c), gfp);
>>> if (!c)
>>> return next;
>>>
>>> @@ -1323,7 +1324,7 @@ capture_vma(struct intel_engine_capture_vma *next,
>>> return next;
>>> }
>>>
>>> - strcpy(c->name, name);
>>> + strncpy(c->name, name, VMA_NAME_LEN-1);
>>
>> GCC is supposed to catch any problems here as you say in the commit message.
>>
>> But to fix I suggest a single line change to strlcpy(c->name, name,
>> sizeof(c->name)) which always null terminates as bonus.
>
> strscpy() is preferred over both strncpy() and strlcpy(). :)
>
> BR,
> Jani.
>
Good call. v2 on the way.
rtg
>>
>> Probably same in i915_vma_coredump_create() which with strncpy would
>> have a theoretical chance of attempting to copy over a
>> non-null-terminated string.
>>
>> Regards,
>>
>> Tvrtko
>>
>>> c->vma = vma; /* reference held while active */
>>>
>>> c->next = next;
>>>
>
--
-----------
Tim Gardner
Canonical, Inc
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] drm/i915: use strscpy() to avoid buffer overrun
2021-09-16 11:37 ` Tim Gardner
@ 2021-09-16 12:26 ` Tim Gardner
0 siblings, 0 replies; 12+ messages in thread
From: Tim Gardner @ 2021-09-16 12:26 UTC (permalink / raw)
To: intel-gfx
Cc: tim.gardner, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
David Airlie, Daniel Vetter, dri-devel, linux-kernel
In capture_vma() Coverity complains of a possible buffer overrun. Even
though this is a static function where all call sites can be checked,
limiting the copy length could save some future grief.
CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
by copying name without checking the length.
5. parameter_as_source: Note: This defect has an elevated risk because the
source argument is a parameter of the current function.
1326 strcpy(c->name, name);
Fix any possible overflows by using strscpy() which guarantees NULL termination.
Also correct 2 other strcpy() call sites with the same potential for Coverity
warnings or overruns.
v2 - Change $SUBJECT from "drm/i915: zero fill vma name buffer"
Use strscpy() instead of strncpy(). Its a much simpler change.
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9cf6ac575de1..7f246f51959d 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1015,7 +1015,7 @@ i915_vma_coredump_create(const struct intel_gt *gt,
return NULL;
}
- strcpy(dst->name, name);
+ strscpy(dst->name, name, sizeof(dst->name));
dst->next = NULL;
dst->gtt_offset = vma->node.start;
@@ -1279,7 +1279,7 @@ static bool record_context(struct i915_gem_context_coredump *e,
rcu_read_lock();
task = pid_task(ctx->pid, PIDTYPE_PID);
if (task) {
- strcpy(e->comm, task->comm);
+ strscpy(e->comm, task->comm, sizeof(e->comm));
e->pid = task->pid;
}
rcu_read_unlock();
@@ -1323,7 +1323,7 @@ capture_vma(struct intel_engine_capture_vma *next,
return next;
}
- strcpy(c->name, name);
+ strscpy(c->name, name, sizeof(c->name));
c->vma = vma; /* reference held while active */
c->next = next;
--
2.33.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-gfx] [PATCH v2] drm/i915: use strscpy() to avoid buffer overrun
@ 2021-09-16 12:26 ` Tim Gardner
0 siblings, 0 replies; 12+ messages in thread
From: Tim Gardner @ 2021-09-16 12:26 UTC (permalink / raw)
To: intel-gfx
Cc: tim.gardner, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
David Airlie, Daniel Vetter, dri-devel, linux-kernel
In capture_vma() Coverity complains of a possible buffer overrun. Even
though this is a static function where all call sites can be checked,
limiting the copy length could save some future grief.
CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
by copying name without checking the length.
5. parameter_as_source: Note: This defect has an elevated risk because the
source argument is a parameter of the current function.
1326 strcpy(c->name, name);
Fix any possible overflows by using strscpy() which guarantees NULL termination.
Also correct 2 other strcpy() call sites with the same potential for Coverity
warnings or overruns.
v2 - Change $SUBJECT from "drm/i915: zero fill vma name buffer"
Use strscpy() instead of strncpy(). Its a much simpler change.
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9cf6ac575de1..7f246f51959d 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1015,7 +1015,7 @@ i915_vma_coredump_create(const struct intel_gt *gt,
return NULL;
}
- strcpy(dst->name, name);
+ strscpy(dst->name, name, sizeof(dst->name));
dst->next = NULL;
dst->gtt_offset = vma->node.start;
@@ -1279,7 +1279,7 @@ static bool record_context(struct i915_gem_context_coredump *e,
rcu_read_lock();
task = pid_task(ctx->pid, PIDTYPE_PID);
if (task) {
- strcpy(e->comm, task->comm);
+ strscpy(e->comm, task->comm, sizeof(e->comm));
e->pid = task->pid;
}
rcu_read_unlock();
@@ -1323,7 +1323,7 @@ capture_vma(struct intel_engine_capture_vma *next,
return next;
}
- strcpy(c->name, name);
+ strscpy(c->name, name, sizeof(c->name));
c->vma = vma; /* reference held while active */
c->next = next;
--
2.33.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: zero fill vma name buffer (rev2)
2021-09-15 19:23 ` [Intel-gfx] " Tim Gardner
` (3 preceding siblings ...)
(?)
@ 2021-09-16 12:53 ` Patchwork
-1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2021-09-16 12:53 UTC (permalink / raw)
To: Tim Gardner; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: zero fill vma name buffer (rev2)
URL : https://patchwork.freedesktop.org/series/94708/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
129ca4e746b8 drm/i915: use strscpy() to avoid buffer overrun
-:11: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#11:
4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
total: 0 errors, 1 warnings, 0 checks, 24 lines checked
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: zero fill vma name buffer (rev2)
2021-09-15 19:23 ` [Intel-gfx] " Tim Gardner
` (4 preceding siblings ...)
(?)
@ 2021-09-16 13:18 ` Patchwork
-1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2021-09-16 13:18 UTC (permalink / raw)
To: Tim Gardner; +Cc: intel-gfx
[-- Attachment #1: Type: text/plain, Size: 10970 bytes --]
== Series Details ==
Series: drm/i915: zero fill vma name buffer (rev2)
URL : https://patchwork.freedesktop.org/series/94708/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_10596 -> Patchwork_21074
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_21074 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_21074, please notify your bug team 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_21074/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_21074:
### IGT changes ###
#### Possible regressions ####
* igt@core_hotunplug@unbind-rebind:
- fi-rkl-guc: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-rkl-guc/igt@core_hotunplug@unbind-rebind.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-rkl-guc/igt@core_hotunplug@unbind-rebind.html
#### Suppressed ####
The following results come from untrusted machines, tests, or statuses.
They do not affect the overall result.
* igt@i915_module_load@reload:
- {fi-tgl-dsi}: [INCOMPLETE][3] ([i915#4130] / [i915#4136]) -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-tgl-dsi/igt@i915_module_load@reload.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-dsi/igt@i915_module_load@reload.html
- {fi-ehl-2}: [INCOMPLETE][5] ([i915#4136]) -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-ehl-2/igt@i915_module_load@reload.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-ehl-2/igt@i915_module_load@reload.html
Known issues
------------
Here are the changes found in Patchwork_21074 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@amdgpu/amd_basic@cs-gfx:
- fi-skl-6700k2: NOTRUN -> [SKIP][7] ([fdo#109271]) +17 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-skl-6700k2/igt@amdgpu/amd_basic@cs-gfx.html
* igt@amdgpu/amd_basic@cs-sdma:
- fi-cfl-8109u: NOTRUN -> [SKIP][8] ([fdo#109271]) +17 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-cfl-8109u/igt@amdgpu/amd_basic@cs-sdma.html
- fi-kbl-7500u: NOTRUN -> [SKIP][9] ([fdo#109271]) +17 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-kbl-7500u/igt@amdgpu/amd_basic@cs-sdma.html
* igt@amdgpu/amd_cs_nop@sync-fork-gfx0:
- fi-cfl-8700k: NOTRUN -> [SKIP][10] ([fdo#109271]) +17 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-cfl-8700k/igt@amdgpu/amd_cs_nop@sync-fork-gfx0.html
* igt@core_hotunplug@unbind-rebind:
- fi-tgl-1115g4: NOTRUN -> [INCOMPLETE][11] ([i915#4130])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@core_hotunplug@unbind-rebind.html
- fi-icl-u2: [PASS][12] -> [INCOMPLETE][13] ([i915#4130])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-icl-u2/igt@core_hotunplug@unbind-rebind.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-icl-u2/igt@core_hotunplug@unbind-rebind.html
- fi-kbl-7567u: [PASS][14] -> [INCOMPLETE][15] ([i915#4130])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-kbl-7567u/igt@core_hotunplug@unbind-rebind.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-kbl-7567u/igt@core_hotunplug@unbind-rebind.html
* igt@gem_huc_copy@huc-copy:
- fi-tgl-1115g4: NOTRUN -> [SKIP][16] ([i915#2190])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@gem_huc_copy@huc-copy.html
* igt@i915_module_load@reload:
- fi-kbl-guc: [PASS][17] -> [INCOMPLETE][18] ([i915#4139])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-kbl-guc/igt@i915_module_load@reload.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-kbl-guc/igt@i915_module_load@reload.html
- fi-icl-y: [PASS][19] -> [INCOMPLETE][20] ([i915#4130])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-icl-y/igt@i915_module_load@reload.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-icl-y/igt@i915_module_load@reload.html
* igt@i915_pm_backlight@basic-brightness:
- fi-tgl-1115g4: NOTRUN -> [SKIP][21] ([i915#1155])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@i915_pm_backlight@basic-brightness.html
* igt@kms_chamelium@common-hpd-after-suspend:
- fi-tgl-1115g4: NOTRUN -> [SKIP][22] ([fdo#111827]) +8 similar issues
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@kms_chamelium@common-hpd-after-suspend.html
* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-tgl-1115g4: NOTRUN -> [SKIP][23] ([i915#4103]) +1 similar issue
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic.html
* igt@kms_force_connector_basic@force-load-detect:
- fi-tgl-1115g4: NOTRUN -> [SKIP][24] ([fdo#109285])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@kms_force_connector_basic@force-load-detect.html
* igt@kms_psr@primary_mmap_gtt:
- fi-tgl-1115g4: NOTRUN -> [SKIP][25] ([i915#1072]) +3 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@kms_psr@primary_mmap_gtt.html
* igt@prime_vgem@basic-userptr:
- fi-tgl-1115g4: NOTRUN -> [SKIP][26] ([i915#3301])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@prime_vgem@basic-userptr.html
* igt@runner@aborted:
- fi-kbl-8809g: NOTRUN -> [FAIL][27] ([i915#2722] / [i915#3363])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-kbl-8809g/igt@runner@aborted.html
- fi-cml-u2: NOTRUN -> [FAIL][28] ([i915#2082] / [i915#2426] / [i915#3363])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-cml-u2/igt@runner@aborted.html
- fi-tgl-1115g4: NOTRUN -> [FAIL][29] ([i915#1602] / [i915#2722])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-tgl-1115g4/igt@runner@aborted.html
#### Possible fixes ####
* igt@core_hotunplug@unbind-rebind:
- fi-cfl-8700k: [INCOMPLETE][30] ([i915#4130]) -> [PASS][31]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-cfl-8700k/igt@core_hotunplug@unbind-rebind.html
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-cfl-8700k/igt@core_hotunplug@unbind-rebind.html
- fi-kbl-7500u: [INCOMPLETE][32] ([i915#4130]) -> [PASS][33]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-kbl-7500u/igt@core_hotunplug@unbind-rebind.html
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-kbl-7500u/igt@core_hotunplug@unbind-rebind.html
- fi-cfl-8109u: [INCOMPLETE][34] ([i915#4130]) -> [PASS][35]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-cfl-8109u/igt@core_hotunplug@unbind-rebind.html
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-cfl-8109u/igt@core_hotunplug@unbind-rebind.html
* igt@i915_module_load@reload:
- fi-skl-6700k2: [INCOMPLETE][36] ([i915#4130] / [i915#4136]) -> [PASS][37]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-skl-6700k2/igt@i915_module_load@reload.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-skl-6700k2/igt@i915_module_load@reload.html
#### Warnings ####
* igt@i915_module_load@reload:
- fi-kbl-8809g: [INCOMPLETE][38] -> [INCOMPLETE][39] ([i915#4136])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-kbl-8809g/igt@i915_module_load@reload.html
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-kbl-8809g/igt@i915_module_load@reload.html
- fi-cml-u2: [INCOMPLETE][40] ([i915#4136]) -> [INCOMPLETE][41] ([i915#4130])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-cml-u2/igt@i915_module_load@reload.html
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-cml-u2/igt@i915_module_load@reload.html
- fi-kbl-soraka: [INCOMPLETE][42] ([i915#4130] / [i915#4136]) -> [INCOMPLETE][43] ([i915#4136])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10596/fi-kbl-soraka/igt@i915_module_load@reload.html
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/fi-kbl-soraka/igt@i915_module_load@reload.html
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#2082]: https://gitlab.freedesktop.org/drm/intel/issues/2082
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2426]: https://gitlab.freedesktop.org/drm/intel/issues/2426
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4130]: https://gitlab.freedesktop.org/drm/intel/issues/4130
[i915#4136]: https://gitlab.freedesktop.org/drm/intel/issues/4136
[i915#4139]: https://gitlab.freedesktop.org/drm/intel/issues/4139
Participating hosts (37 -> 36)
------------------------------
Additional (1): fi-tgl-1115g4
Missing (2): fi-bsw-cyan fi-bdw-samus
Build changes
-------------
* Linux: CI_DRM_10596 -> Patchwork_21074
CI-20190529: 20190529
CI_DRM_10596: 3e450101ba783c61e51898a84b7758efbb505e8f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6209: 07d6594ed02f55b68d64fa6dd7f80cfbc1ce4ef8 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21074: 129ca4e746b820a9c29ef1d1be70da6af98f2eaa @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
129ca4e746b8 drm/i915: use strscpy() to avoid buffer overrun
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21074/index.html
[-- Attachment #2: Type: text/html, Size: 13649 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Intel-gfx] [PATCH v2] drm/i915: use strscpy() to avoid buffer overrun
2021-09-16 12:26 ` [Intel-gfx] " Tim Gardner
(?)
@ 2021-09-17 7:37 ` Tvrtko Ursulin
-1 siblings, 0 replies; 12+ messages in thread
From: Tvrtko Ursulin @ 2021-09-17 7:37 UTC (permalink / raw)
To: Tim Gardner, intel-gfx
Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, David Airlie,
Daniel Vetter, dri-devel, linux-kernel
On 16/09/2021 13:26, Tim Gardner wrote:
> In capture_vma() Coverity complains of a possible buffer overrun. Even
> though this is a static function where all call sites can be checked,
> limiting the copy length could save some future grief.
>
> CID 93300 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
> 4. fixed_size_dest: You might overrun the 16-character fixed-size string c->name
> by copying name without checking the length.
> 5. parameter_as_source: Note: This defect has an elevated risk because the
> source argument is a parameter of the current function.
> 1326 strcpy(c->name, name);
>
> Fix any possible overflows by using strscpy() which guarantees NULL termination.
>
> Also correct 2 other strcpy() call sites with the same potential for Coverity
> warnings or overruns.
>
> v2 - Change $SUBJECT from "drm/i915: zero fill vma name buffer"
> Use strscpy() instead of strncpy(). Its a much simpler change.
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
> drivers/gpu/drm/i915/i915_gpu_error.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 9cf6ac575de1..7f246f51959d 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1015,7 +1015,7 @@ i915_vma_coredump_create(const struct intel_gt *gt,
> return NULL;
> }
>
> - strcpy(dst->name, name);
> + strscpy(dst->name, name, sizeof(dst->name));
> dst->next = NULL;
>
> dst->gtt_offset = vma->node.start;
> @@ -1279,7 +1279,7 @@ static bool record_context(struct i915_gem_context_coredump *e,
> rcu_read_lock();
> task = pid_task(ctx->pid, PIDTYPE_PID);
> if (task) {
> - strcpy(e->comm, task->comm);
> + strscpy(e->comm, task->comm, sizeof(e->comm));
> e->pid = task->pid;
> }
> rcu_read_unlock();
> @@ -1323,7 +1323,7 @@ capture_vma(struct intel_engine_capture_vma *next,
> return next;
> }
>
> - strcpy(c->name, name);
> + strscpy(c->name, name, sizeof(c->name));
> c->vma = vma; /* reference held while active */
>
> c->next = next;
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-09-17 7:37 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 19:23 [PATCH] drm/i915: zero fill vma name buffer Tim Gardner
2021-09-15 19:23 ` [Intel-gfx] " Tim Gardner
2021-09-15 20:34 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-09-15 21:01 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-09-16 8:23 ` [Intel-gfx] [PATCH] " Tvrtko Ursulin
2021-09-16 10:43 ` Jani Nikula
2021-09-16 11:37 ` Tim Gardner
2021-09-16 12:26 ` [PATCH v2] drm/i915: use strscpy() to avoid buffer overrun Tim Gardner
2021-09-16 12:26 ` [Intel-gfx] " Tim Gardner
2021-09-17 7:37 ` Tvrtko Ursulin
2021-09-16 12:53 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: zero fill vma name buffer (rev2) Patchwork
2021-09-16 13:18 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.