Skip to contentSkip to conversation

tools/intel_reg: fix use-after-free bug in register spec read

PATCH In review Jani Nikula 3 participants 5 messages Aug 21, 2019 – Aug 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/intel_reg: fix use-after-free bug in register spec read

e points into the buffer pointer to by p.

Fixes dfda0b6aecce ("intel_reg: introduce one intel_reg tool to rule them all")
---
 tools/intel_reg_spec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/intel_reg_spec.c +1 -1
index 0df69b6884de..5ab56ec1a31f 100644
@@ -233,9 +233,9 @@ static int parse_line(struct reg *reg, const char *line)
 			reg->name = p;
 		} else if (i == 2) {
 			reg->addr = strtoul(p, &e, 16);
-			free(p);
 			if (*e)
 				ret = -1;
+			free(p);
 		} else if (i == 3) {
 			ret = parse_port_desc(reg, p);
 			free(p);
Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Jani Nikula

e points into the buffer pointer to by p.

Typo: pointed

Quoted 3 lines
Fixes dfda0b6aecce ("intel_reg: introduce one intel_reg tool to rule them all")
Quoted 9 lines
---
 tools/intel_reg_spec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/intel_reg_spec.c +0 -0
index 0df69b6884de..5ab56ec1a31f 100644

tools/intel_reg_spec.c static int parse_line(struct reg *reg, const char *line) · line 241

Quoted 10 lines
tools/intel_reg_spec.c +1 -1
@@ -233,9 +233,9 @@ static int parse_line(struct reg *reg, const char *line)
 			reg->name = p;
 		} else if (i == 2) {
 			reg->addr = strtoul(p, &e, 16);
-			free(p);
 			if (*e)
 				ret = -1;
+			free(p);
 		} else if (i == 3) {
 			ret = parse_port_desc(reg, p);
 			free(p);

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw
Quoted 4 lines · Simon
Quoted 1 line · Jani Nikula

e points into the buffer pointer to by p.

Typo: pointed

Whoops. Fixed while applying, thanks for the review.

BR,
Jani.

Quoted 26 lines
Quoted 4 lines
Fixes dfda0b6aecce ("intel_reg: introduce one intel_reg tool to rule them all")
Quoted 19 lines
---
 tools/intel_reg_spec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/intel_reg_spec.c +1 -1
index 0df69b6884de..5ab56ec1a31f 100644
@@ -233,9 +233,9 @@ static int parse_line(struct reg *reg, const char *line)
 			reg->name = p;
 		} else if (i == 2) {
 			reg->addr = strtoul(p, &e, 16);
-			free(p);
 			if (*e)
 				ret = -1;
+			free(p);
 		} else if (i == 3) {
 			ret = parse_port_desc(reg, p);
 			free(p);
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for tools/intel_reg: fix use-after-free bug in register spec read

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: tools/intel_reg: fix use-after-free bug in register spec read
URL : https://patchwork.freedesktop.org/series/65540/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6754 -> IGTPW_3370
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/65540/revisions/1/mbox/

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_module_load@reload:
- fi-blb-e6850: [PASS][1] -> [INCOMPLETE][2] ([fdo#107718])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/fi-blb-e6850/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/fi-blb-e6850/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy: [PASS][3] -> [DMESG-WARN][4] ([fdo#102614])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/fi-hsw-peppy/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/fi-hsw-peppy/igt@[email protected]

#### Possible fixes ####

* igt@gem_sync@basic-store-each:
- fi-cfl-8109u: [INCOMPLETE][5] ([fdo#111427]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/fi-cfl-8109u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/fi-cfl-8109u/igt@[email protected]

* igt@i915_module_load@reload:
- fi-icl-u3: [DMESG-WARN][7] ([fdo#107724]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/fi-icl-u3/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/fi-icl-u3/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111427]: https://bugs.freedesktop.org/show_bug.cgi?id=111427

Participating hosts (56 -> 48)
------------------------------

Missing (8): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* IGT: IGT_5146 -> IGTPW_3370

CI-20190529: 20190529
CI_DRM_6754: f4168ecba1e5c41cbf25d7b5db0c685ee7470d60 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3370: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/
IGT_5146: 357dbe1869d88a2f08bcee4eebceff4ee9014424 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw

[igt-dev] ✗ Fi.CI.IGT: failure for tools/intel_reg: fix use-after-free bug in register spec read

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: tools/intel_reg: fix use-after-free bug in register spec read
URL : https://patchwork.freedesktop.org/series/65540/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6754_full -> IGTPW_3370_full
====================================================

Summary
-------

**FAILURE**

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

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

External URL: https://patchwork.freedesktop.org/api/1.0/series/65540/revisions/1/mbox/

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_parallel@bcs0-contexts:
- shard-hsw: [PASS][1] -> [FAIL][2] +1 similar issue
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-hsw1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-hsw4/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_blt@dumb-buf-max:
- shard-apl: [PASS][3] -> [INCOMPLETE][4] ([fdo#103927])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-apl7/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-apl3/igt@[email protected]

* igt@gem_exec_schedule@preempt-other-chain-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325]) +5 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb5/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@preempt-other-chain-bsd2:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#109276]) +13 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb1/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb3/igt@[email protected]

* igt@kms_atomic_interruptible@atomic-setmode:
- shard-iclb: [PASS][9] -> [INCOMPLETE][10] ([fdo#107713])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb7/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-dpms:
- shard-apl: [PASS][11] -> [FAIL][12] ([fdo#103232])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-apl2/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-apl6/igt@[email protected]
- shard-kbl: [PASS][13] -> [FAIL][14] ([fdo#103232])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-kbl6/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-kbl4/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-atomic:
- shard-hsw: [PASS][15] -> [FAIL][16] ([fdo#105767])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-hsw8/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-hsw8/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy:
- shard-glk: [PASS][17] -> [FAIL][18] ([fdo#104873])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-glk4/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-glk8/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-apl: [PASS][19] -> [FAIL][20] ([fdo#105363])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-apl3/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-apl5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite:
- shard-iclb: [PASS][21] -> [FAIL][22] ([fdo#103167]) +4 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb4/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb1/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-pwrite.html

* igt@kms_psr@no_drrs:
- shard-iclb: [PASS][23] -> [FAIL][24] ([fdo#108341])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb2/igt@kms_psr@no_drrs.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb1/igt@kms_psr@no_drrs.html

* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [PASS][25] -> [SKIP][26] ([fdo#109441]) +5 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb5/igt@kms_psr@psr2_primary_mmap_cpu.html

* igt@kms_setmode@basic:
- shard-apl: [PASS][27] -> [FAIL][28] ([fdo#99912])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-apl1/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-apl5/igt@[email protected]

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-apl: [PASS][29] -> [DMESG-WARN][30] ([fdo#108566]) +2 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-apl7/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-apl6/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_schedule@in-order-bsd:
- shard-iclb: [SKIP][31] ([fdo#111325]) -> [PASS][32] +3 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb2/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb6/igt@[email protected]

* igt@gem_exec_schedule@preempt-bsd1:
- shard-iclb: [SKIP][33] ([fdo#109276]) -> [PASS][34] +17 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb7/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb2/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-glk: [DMESG-WARN][35] ([fdo#108686]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-glk5/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-glk3/igt@[email protected]

* igt@i915_suspend@debugfs-reader:
- shard-apl: [DMESG-WARN][37] ([fdo#108566]) -> [PASS][38] +4 similar issues
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-apl4/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-apl3/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-256x256-onscreen:
- shard-hsw: [INCOMPLETE][39] ([fdo#103540]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-hsw8/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-hsw5/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
- shard-hsw: [FAIL][41] ([fdo#105767]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-hsw8/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-hsw5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-gtt:
- shard-glk: [FAIL][43] ([fdo#103167]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-glk4/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-gtt.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-glk3/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-indfb-draw-mmap-gtt.html

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [FAIL][45] ([fdo#103167]) -> [PASS][46] +6 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb4/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_psr2_su@page_flip:
- shard-iclb: [SKIP][47] ([fdo#109642] / [fdo#111068]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb8/igt@kms_psr2_su@page_flip.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb2/igt@kms_psr2_su@page_flip.html

* igt@kms_psr@psr2_dpms:
- shard-iclb: [SKIP][49] ([fdo#109441]) -> [PASS][50] +1 similar issue
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb4/igt@kms_psr@psr2_dpms.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb2/igt@kms_psr@psr2_dpms.html

#### Warnings ####

* igt@kms_dp_dsc@basic-dsc-enable-edp:
- shard-iclb: [DMESG-WARN][51] ([fdo#107724]) -> [SKIP][52] ([fdo#109349])
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6754/shard-iclb2/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/shard-iclb1/igt@[email protected]

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104873]: https://bugs.freedesktop.org/show_bug.cgi?id=104873
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#108341]: https://bugs.freedesktop.org/show_bug.cgi?id=108341
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 6)
------------------------------

Missing (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005

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

* CI: CI-20190529 -> None
* IGT: IGT_5146 -> IGTPW_3370
* Piglit: piglit_4509 -> None

CI-20190529: 20190529
CI_DRM_6754: f4168ecba1e5c41cbf25d7b5db0c685ee7470d60 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3370: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/
IGT_5146: 357dbe1869d88a2f08bcee4eebceff4ee9014424 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3370/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev