Skip to contentSkip to conversation

runner_tests: Fix the file descriptor leakage subtest

PATCH In review Arkadiusz Hiler 4 participants 5 messages Jun 4, 2019 – Jun 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 runner_tests: Fix the file descriptor leakage subtest

Some libraries (looking at you, GnuTLS) may leave fds opened after the implicitly called library constructor. We don't have full control over them as they may be dependencies of our dependencies and may get pulled in if the user's and distribution's compile/configure/USE are just right.

Let's close all the non-standard fds ahead of executing anything in the igt_runner tests, so we can test for descriptor leakage caused by any of the igt_runner code-paths exercised there.

Cc Antonio Argenziano <[email protected]>
Cc Petri Latvala <[email protected]>
---
 runner/runner_tests.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
runner/runner_tests.c +20 -1
index 1fc09688..c09cda70 100644
@@ -208,8 +208,27 @@ igt_main
 {
 	struct settings *settings = malloc(sizeof(*settings));
 
-	igt_fixture
+	igt_fixture {
+		int i;
+
+		/*
+		 * Let's close all the non-standard fds ahead of executing
+		 * anything, so we can test for descriptor leakage caused by
+		 * any of the igt_runner code-paths exercised here.
+		 *
+		 * See file-descriptor-leakage subtest at the end.
+		 *
+		 * Some libraries (looking at you, GnuTLS) may leave fds opened
+		 * after the implicitly called library constructor. We don't
+		 * have full control over them as they may be dependencies of
+		 * our dependencies and may get pulled in if the user's and
+		 * distribution's compile/configure/USE are just right.
+		 */
+		for (i = 3; i < 400; i++)
+			close(i);
+
 		init_settings(settings);
+	}
 
 	igt_subtest("default-settings") {
 		const char *argv[] = { "runner",
Signature · 6 lines
2.21.0

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

[igt-dev] ✓ Fi.CI.BAT: success for runner_tests: Fix the file descriptor leakage subtest

== Series Details ==

== Series Details ==

Series: runner_tests: Fix the file descriptor leakage subtest
URL : https://patchwork.freedesktop.org/series/61592/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6186 -> IGTPW_3105
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_flink_basic@basic:
- fi-icl-u3: [PASS][1] -> [DMESG-WARN][2] ([fdo#107724]) +2 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/fi-icl-u3/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/fi-icl-u3/igt@[email protected]

* igt@i915_selftest@live_hangcheck:
- fi-icl-u3: [PASS][3] -> [INCOMPLETE][4] ([fdo#107713] / [fdo#108569])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/fi-icl-u3/igt@i915_selftest@live_hangcheck.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/fi-icl-u3/igt@i915_selftest@live_hangcheck.html

#### Possible fixes ####

* igt@gem_ctx_switch@basic-default:
- {fi-icl-guc}: [INCOMPLETE][5] ([fdo#107713] / [fdo#108569]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/fi-icl-guc/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/fi-icl-guc/igt@[email protected]

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

* {igt@i915_selftest@live_blt}:
- fi-skl-iommu: [INCOMPLETE][9] ([fdo#108602]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/fi-skl-iommu/igt@i915_selftest@live_blt.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/fi-skl-iommu/igt@i915_selftest@live_blt.html

* {igt@i915_selftest@live_mman}:
- fi-icl-y: [TIMEOUT][11] ([fdo#110818 ]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/fi-icl-y/igt@i915_selftest@live_mman.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/fi-icl-y/igt@i915_selftest@live_mman.html

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- fi-blb-e6850: [INCOMPLETE][13] ([fdo#107718]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/fi-blb-e6850/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/fi-blb-e6850/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#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
[fdo#108602]: https://bugs.freedesktop.org/show_bug.cgi?id=108602
[fdo#109673]: https://bugs.freedesktop.org/show_bug.cgi?id=109673
[fdo#110818 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110818

Participating hosts (53 -> 46)
------------------------------

Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-kbl-7560u fi-byt-clapper fi-bdw-samus

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

* IGT: IGT_5037 -> IGTPW_3105

CI_DRM_6186: a629ccaaa66bb4effc461a00de5b3f92b6ea9c4c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3105: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/
IGT_5037: a98c9cd50aa48933217ca41055279ccb1680d25b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Arkadiusz Hiler
Quoted 6 lines · Arkadiusz Hiler

Some libraries (looking at you, GnuTLS) may leave fds opened after the implicitly called library constructor. We don't have full control over them as they may be dependencies of our dependencies and may get pulled in if the user's and distribution's compile/configure/USE are just right.

Quoted 7 lines

Let's close all the non-standard fds ahead of executing anything in the igt_runner tests, so we can test for descriptor leakage caused by any of the igt_runner code-paths exercised there.

Cc Antonio Argenziano <[email protected]>
Cc Petri Latvala <[email protected]>

LGTM.

Quoted 28 lines
---
  runner/runner_tests.c | 21 ++++++++++++++++++++-
  1 file changed, 20 insertions(+), 1 deletion(-)
runner/runner_tests.c +14 -1
index 1fc09688..c09cda70 100644
@@ -208,8 +208,27 @@ igt_main
  {
  	struct settings *settings = malloc(sizeof(*settings));
 
-	igt_fixture
+	igt_fixture {
+		int i;
+
+		/*
+		 * Let's close all the non-standard fds ahead of executing
+		 * anything, so we can test for descriptor leakage caused by
+		 * any of the igt_runner code-paths exercised here.
+		 *
+		 * See file-descriptor-leakage subtest at the end.
+		 *
+		 * Some libraries (looking at you, GnuTLS) may leave fds opened
+		 * after the implicitly called library constructor. We don't
+		 * have full control over them as they may be dependencies of
+		 * our dependencies and may get pulled in if the user's and

runner/runner_tests.c igt_main · line 234

Quoted 10 lines
runner/runner_tests.c +6 -0
+		 * distribution's compile/configure/USE are just right.
+		 */
+		for (i = 3; i < 400; i++)
+			close(i);
+
  		init_settings(settings);
+	}
 
  	igt_subtest("default-settings") {
  		const char *argv[] = { "runner",

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

#3 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for runner_tests: Fix the file descriptor leakage subtest

In reply to Arkadiusz Hiler
== Series Details ==

== Series Details ==

Series: runner_tests: Fix the file descriptor leakage subtest
URL : https://patchwork.freedesktop.org/series/61592/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6186_full -> IGTPW_3105_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_mmap_gtt@forked-basic-small-copy-odd:
- shard-iclb: [PASS][1] -> [INCOMPLETE][2] ([fdo#107713])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb6/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-hsw: [PASS][3] -> [FAIL][4] ([fdo#108686])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-hsw2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-hsw1/igt@[email protected]

* igt@i915_pm_rpm@cursor-dpms:
- shard-iclb: [PASS][5] -> [INCOMPLETE][6] ([fdo#107713] / [fdo#108840])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb4/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb5/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-dpms:
- shard-apl: [PASS][7] -> [FAIL][8] ([fdo#103232])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-apl6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-apl8/igt@[email protected]
- shard-kbl: [PASS][9] -> [FAIL][10] ([fdo#103232])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-kbl7/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-kbl1/igt@[email protected]

* igt@kms_cursor_legacy@cursorb-vs-flipb-atomic:
- shard-hsw: [PASS][11] -> [SKIP][12] ([fdo#109271]) +17 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-hsw2/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-hsw1/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
- shard-glk: [PASS][13] -> [FAIL][14] ([fdo#102887])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-glk1/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-glk4/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-onoff:
- shard-apl: [PASS][15] -> [FAIL][16] ([fdo#103167])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-apl1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-apl1/igt@[email protected]
- shard-kbl: [PASS][17] -> [FAIL][18] ([fdo#103167])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-kbl3/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-kbl2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-rgb565-draw-pwrite:
- shard-iclb: [PASS][19] -> [FAIL][20] ([fdo#103167]) +4 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb5/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb7/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- shard-apl: [PASS][21] -> [DMESG-WARN][22] ([fdo#108566]) +4 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-apl2/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-apl5/igt@[email protected]

* igt@kms_setmode@basic:
- shard-apl: [PASS][23] -> [FAIL][24] ([fdo#99912])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-apl8/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-apl2/igt@[email protected]

* igt@kms_sysfs_edid_timing:
- shard-hsw: [PASS][25] -> [FAIL][26] ([fdo#100047])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-hsw2/igt@kms_sysfs_edid_timing.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-hsw1/igt@kms_sysfs_edid_timing.html

#### Possible fixes ####

* {igt@gem_ctx_param@vm}:
- shard-hsw: [DMESG-WARN][27] ([fdo#110836]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-hsw6/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-hsw4/igt@[email protected]

* igt@gem_mmap_gtt@forked-medium-copy-odd:
- shard-iclb: [INCOMPLETE][29] ([fdo#107713]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb8/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb2/igt@[email protected]

* igt@kms_flip@2x-modeset-vs-vblank-race-interruptible:
- shard-glk: [FAIL][31] ([fdo#103060]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-glk3/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-glk4/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [FAIL][33] ([fdo#103167]) -> [PASS][34] +2 similar issues
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb7/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_plane_lowres@pipe-a-tiling-x:
- shard-iclb: [FAIL][35] ([fdo#103166]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb4/igt@[email protected]

* igt@kms_psr@psr2_no_drrs:
- shard-iclb: [SKIP][37] ([fdo#109441]) -> [PASS][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb3/igt@kms_psr@psr2_no_drrs.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb2/igt@kms_psr@psr2_no_drrs.html

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-apl: [DMESG-WARN][39] ([fdo#108566]) -> [PASS][40] +1 similar issue
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-apl1/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-apl8/igt@[email protected]

* igt@perf@blocking:
- shard-iclb: [FAIL][41] ([fdo#110728]) -> [PASS][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb6/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb7/igt@[email protected]

#### Warnings ####

* igt@gem_mmap_gtt@forked-big-copy:
- shard-iclb: [TIMEOUT][43] ([fdo#109673]) -> [INCOMPLETE][44] ([fdo#107713] / [fdo#109100])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb3/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb2/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-iclb: [FAIL][45] ([fdo#108686]) -> [INCOMPLETE][46] ([fdo#107713] / [fdo#108686])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb2/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb1/igt@[email protected]

* igt@kms_atomic_transition@4x-modeset-transitions-nonblocking-fencing:
- shard-snb: [SKIP][47] ([fdo#109271] / [fdo#109278]) -> [SKIP][48] ([fdo#109271])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-snb1/igt@kms_atomic_transition@4x-modeset-transitions-nonblocking-fencing.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-snb6/igt@kms_atomic_transition@4x-modeset-transitions-nonblocking-fencing.html

* igt@kms_hdmi_inject@inject-audio:
- shard-iclb: [FAIL][49] ([fdo#110842]) -> [FAIL][50] ([fdo#102370])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6186/shard-iclb2/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/shard-iclb1/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#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
[fdo#102370]: https://bugs.freedesktop.org/show_bug.cgi?id=102370
[fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
[fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#108686]: https://bugs.freedesktop.org/show_bug.cgi?id=108686
[fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109673]: https://bugs.freedesktop.org/show_bug.cgi?id=109673
[fdo#110728]: https://bugs.freedesktop.org/show_bug.cgi?id=110728
[fdo#110836]: https://bugs.freedesktop.org/show_bug.cgi?id=110836
[fdo#110842]: https://bugs.freedesktop.org/show_bug.cgi?id=110842
[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
-------------

* IGT: IGT_5037 -> IGTPW_3105
* Piglit: piglit_4509 -> None

CI_DRM_6186: a629ccaaa66bb4effc461a00de5b3f92b6ea9c4c @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3105: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3105/
IGT_5037: a98c9cd50aa48933217ca41055279ccb1680d25b @ 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_3105/
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Reviewed-by on v1 1/1
#4 lore raw
In reply to Arkadiusz Hiler
Quoted 34 lines · Arkadiusz Hiler

Some libraries (looking at you, GnuTLS) may leave fds opened after the implicitly called library constructor. We don't have full control over them as they may be dependencies of our dependencies and may get pulled in if the user's and distribution's compile/configure/USE are just right.

Let's close all the non-standard fds ahead of executing anything in the igt_runner tests, so we can test for descriptor leakage caused by any of the igt_runner code-paths exercised there.

Cc Antonio Argenziano <[email protected]>
Cc Petri Latvala <[email protected]>
---
 runner/runner_tests.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
runner/runner_tests.c +8 -1
index 1fc09688..c09cda70 100644
@@ -208,8 +208,27 @@ igt_main
 {
 	struct settings *settings = malloc(sizeof(*settings));
 
-	igt_fixture
+	igt_fixture {
+		int i;
+
+		/*
+		 * Let's close all the non-standard fds ahead of executing
+		 * anything, so we can test for descriptor leakage caused by
+		 * any of the igt_runner code-paths exercised here.
+		 *

runner/runner_tests.c igt_main · line 228

Quoted 10 lines
runner/runner_tests.c +10 -0
+		 * See file-descriptor-leakage subtest at the end.
+		 *
+		 * Some libraries (looking at you, GnuTLS) may leave fds opened
+		 * after the implicitly called library constructor. We don't
+		 * have full control over them as they may be dependencies of
+		 * our dependencies and may get pulled in if the user's and
+		 * distribution's compile/configure/USE are just right.
+		 */
+		for (i = 3; i < 400; i++)
+			close(i);

Do we care about not polluting errno?

In any case:

runner/runner_tests.c igt_main · line 234

Quoted 6 lines
runner/runner_tests.c +2 -0
+
 		init_settings(settings);
+	}
 
 	igt_subtest("default-settings") {
 		const char *argv[] = { "runner",

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