lib/igt_list: igt_list_empty() Detect uninitialized list
PATCH 1/1 lib/igt_list: igt_list_empty() Detect uninitialized list
Add a check to igt_list_empty() to return true if the list head pointer or its next/prev pointers are NULL, preventing segfaults when operating on uninitialized or potentially broken lists.
--- lib/igt_list.c | 4 ++++ 1 file changed, 4 insertions(+)
lib/igt_list.c +4 -0
@@ -79,5 +79,9 @@ int igt_list_length(const struct igt_list_head *head)bool igt_list_empty (const struct igt_list_head *head) { +/* Detect uninitialized / potentially broken list */ +if (!head || !head->next || !head->prev) +return true; +return head->next == head; }
Signature · 1 line
2.43.0
Patchwork
CI✓ Xe.CI.BAT: success for lib/igt_list: igt_list_empty() Detect uninitialized list
== Series Details ==
== Series Details ==
Series: lib/igt_list: igt_list_empty() Detect uninitialized list
URL : https://patchwork.freedesktop.org/series/154855/
State : success
== Summary ==
CI Bug Log - changes from XEIGT_8548_BAT -> XEIGTPW_13797_BAT
====================================================
Summary
-------
**WARNING**
Minor unknown changes coming with XEIGTPW_13797_BAT need to be verified manually.
If you think the reported changes have nothing to do with the changes
introduced in XEIGTPW_13797_BAT, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.
Participating hosts (11 -> 11)
------------------------------
No changes in participating hosts
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in XEIGTPW_13797_BAT:
### IGT changes ###
#### Warnings ####
* igt@xe_module_load@load:
- bat-bmg-1: [ABORT][1] ([Intel XE#6201]) -> [ABORT][2]
[1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8548/bat-bmg-1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_13797/bat-bmg-1/igt@[email protected]
Known issues
------------
Here are the changes found in XEIGTPW_13797_BAT that come from known issues:
### IGT changes ###
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[Intel XE#6201]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/6201
Build changes
-------------
* IGT: IGT_8548 -> IGTPW_13797
IGTPW_13797: 13797
IGT_8548: 8548
xe-3813-3ff214d6c6a86025aa3feadcb5bba4abfc2dd8f1: 3ff214d6c6a86025aa3feadcb5bba4abfc2dd8f1
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_13797/index.html
Patchwork
CI✗ i915.CI.BAT: failure for lib/igt_list: igt_list_empty() Detect uninitialized list
In reply to Peter Senna Tschudin== Series Details ==
== Series Details ==
Series: lib/igt_list: igt_list_empty() Detect uninitialized list
URL : https://patchwork.freedesktop.org/series/154855/
State : failure
== Summary ==
CI Bug Log - changes from IGT_8548 -> IGTPW_13797
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_13797 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_13797, 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/IGTPW_13797/index.html
Participating hosts (39 -> 38)
------------------------------
Missing (1): bat-adls-6
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_13797:
### IGT changes ###
#### Possible regressions ####
* igt@core_auth@basic-auth:
- fi-glk-j4005: NOTRUN -> [INCOMPLETE][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/fi-glk-j4005/igt@[email protected]
* igt@i915_selftest@live@requests:
- bat-atsm-1: [PASS][2] -> [DMESG-WARN][3]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8548/bat-atsm-1/igt@i915_selftest@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/bat-atsm-1/igt@i915_selftest@[email protected]
* igt@kms_force_connector_basic@force-edid:
- bat-kbl-2: NOTRUN -> [ABORT][4]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/bat-kbl-2/igt@[email protected]
* igt@runner@aborted:
- fi-glk-j4005: NOTRUN -> [FAIL][5]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/fi-glk-j4005/igt@[email protected]
Known issues
------------
Here are the changes found in IGTPW_13797 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_force_connector_basic@force-connector-state:
- fi-kbl-8809g: [PASS][6] -> [ABORT][7] ([i915#15020])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8548/fi-kbl-8809g/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/fi-kbl-8809g/igt@[email protected]
#### Possible fixes ####
* igt@i915_module_load@load:
- fi-glk-j4005: [ABORT][8] ([i915#15020]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8548/fi-glk-j4005/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/fi-glk-j4005/igt@[email protected]
* igt@kms_force_connector_basic@force-connector-state:
- bat-kbl-2: [ABORT][10] ([i915#15020]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8548/bat-kbl-2/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/bat-kbl-2/igt@[email protected]
#### Warnings ####
* igt@i915_module_load@load:
- fi-elk-e7500: [ABORT][12] -> [ABORT][13] ([i915#15020])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8548/fi-elk-e7500/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/fi-elk-e7500/igt@[email protected]
* igt@i915_selftest@live:
- bat-atsm-1: [DMESG-FAIL][14] ([i915#12061] / [i915#14204]) -> [DMESG-FAIL][15] ([i915#12061] / [i915#13929])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8548/bat-atsm-1/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/bat-atsm-1/igt@[email protected]
* igt@i915_selftest@live@mman:
- bat-atsm-1: [DMESG-FAIL][16] ([i915#14204]) -> [DMESG-FAIL][17] ([i915#13929])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8548/bat-atsm-1/igt@i915_selftest@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/bat-atsm-1/igt@i915_selftest@[email protected]
[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#13929]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13929
[i915#14204]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14204
[i915#15020]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15020
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_8548 -> IGTPW_13797
CI-20190529: 20190529
CI_DRM_17254: 3ff214d6c6a86025aa3feadcb5bba4abfc2dd8f1 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_13797: 13797
IGT_8548: 8548
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13797/index.html
Patchwork
CI✓ Xe.CI.Full: success for lib/igt_list: igt_list_empty() Detect uninitialized list
In reply to Peter Senna Tschudin== Series Details ==
== Series Details ==
Series: lib/igt_list: igt_list_empty() Detect uninitialized list
URL : https://patchwork.freedesktop.org/series/154855/
State : success
== Summary ==
CI Bug Log - changes from XEIGT_8548_FULL -> XEIGTPW_13797_FULL
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (4 -> 3)
------------------------------
Missing (1): shard-adlp
Changes
-------
No changes found
Build changes
-------------
* IGT: IGT_8548 -> IGTPW_13797
IGTPW_13797: 13797
IGT_8548: 8548
xe-3813-3ff214d6c6a86025aa3feadcb5bba4abfc2dd8f1: 3ff214d6c6a86025aa3feadcb5bba4abfc2dd8f1
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_13797/index.html
Hi Peter,
Quoted 14 lines · Peter Senna Tschudin
Add a check to
igt_list_empty()to return true if the list head pointer or its next/prev pointers are NULL, preventing segfaults when operating on uninitialized or potentially broken lists.Signed-off-by Peter Senna Tschudin <[email protected]>--- lib/igt_list.c | 4 ++++ 1 file changed, 4 insertions(+)lib/igt_list.c +0
-0
lib/igt_list.c int igt_list_length(const struct igt_list_head *head) · line 85
Quoted 7 lines
lib/igt_list.c +4
-0@@ -79,5 +79,9 @@ int igt_list_length(const struct igt_list_head *head)bool igt_list_empty (const struct igt_list_head *head) { +/* Detect uninitialized / potentially broken list */ +if (!head || !head->next || !head->prev) +return true; +
Without this change:
1. Passing an uninitialized list is a bug
2. The function doesn't check any condition and returns 'normally' regardless
With this change:
1. Passing an uninitialized list is a bug (still)
2. The function *may* detect an uninitialized list which is a bug but returns 'normally' regardless
If we are adding a check that catches some invalid/buggy condition the reasonable thing to do would be to assert/abort.
Regards,
Christoph
Quoted 2 lines
lib/igt_list.c +0
-0return head->next == head; }
Hi Christoph,
Quoted 29 lines · Christoph
Hi Peter,
Quoted 14 lines · Peter Senna Tschudin
Add a check to
igt_list_empty()to return true if the list head pointer or its next/prev pointers are NULL, preventing segfaults when operating on uninitialized or potentially broken lists.Signed-off-by Peter Senna Tschudin <[email protected]>---
lib/igt_list.c| 4 ++++1 file changed, 4 insertions(+)lib/igt_list.c +0
-0lib/igt_list.c int igt_list_length(const struct igt_list_head *head) · line 84
Quoted 6 lines
lib/igt_list.c +4
-0@@ -79,5 +79,9 @@ int igt_list_length(const struct igt_list_head *head) bool igt_list_empty(const struct igt_list_head *head) { + /* Detect uninitialized / potentially broken list */ + if (!head || !head->next || !head->prev) + return true; +Without this change:
1. Passing an uninitialized list is a bug
2. The function doesn't check any condition and returns 'normally' regardless
Quoted 7 lines
With this change:
1. Passing an uninitialized list is a bug (still)
2. The function *may* detect an uninitialized list which is a bug but returns 'normally' regardlessIf we are adding a check that catches some invalid/buggy condition the reasonable thing to do would be to assert/abort.
I agree with you. I would say that even more concerning is to distance our implementation from the kernel implementation. I suggest we nack this change. If you are ok with it
Quoted 8 lines
Regards,
ChristophQuoted 2 lines
lib/igt_list.c +0
-0return head->next == head; }
Hi Peter,
Quoted 37 lines · Peter Senna Tschudin
Hi Christoph,
Quoted 34 lines · Christoph
Hi Peter,
Quoted 14 lines · Peter Senna Tschudin
Add a check to
igt_list_empty()to return true if the list head pointer or its next/prev pointers are NULL, preventing segfaults when operating on uninitialized or potentially broken lists.Signed-off-by Peter Senna Tschudin <[email protected]>--- lib/igt_list.c | 4 ++++ 1 file changed, 4 insertions(+)lib/igt_list.c +0
-0lib/igt_list.c int igt_list_length(const struct igt_list_head *head) · line 84
Quoted 6 lines
lib/igt_list.c +4
-0@@ -79,5 +79,9 @@ int igt_list_length(const struct igt_list_head *head) bool igt_list_empty(const struct igt_list_head *head) { + /* Detect uninitialized / potentially broken list */ + if (!head || !head->next || !head->prev) + return true; +Without this change:
1. Passing an uninitialized list is a bug
2. The function doesn't check any condition and returns 'normally' regardlessWith this change:
1. Passing an uninitialized list is a bug (still)
2. The function *may* detect an uninitialized list which is a bug but returns 'normally' regardless
Quoted 6 lines
Quoted 2 lines
If we are adding a check that catches some invalid/buggy condition the reasonable thing to do would be to assert/abort.
I agree with you. I would say that even more concerning is to distance our implementation from the kernel implementation. I suggest we nack this change. If you are ok with it
Well either way is fine with by me. I just wanted to make a point that when we add a check that catches a bug it makes sense to alarm the developer right away.
Regards,
Christoph
Quoted 12 lines
Nacked-by Peter Senna Tschudin <[email protected]>Quoted 8 lines
Regards,
ChristophQuoted 2 lines
lib/igt_list.c +0
-0return head->next == head; }