public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ser, Simon" <simon.ser@intel.com>
To: "Hiler, Arkadiusz" <arkadiusz.hiler@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Latvala, Petri" <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t] runner_tests: Fix the file descriptor leakage subtest
Date: Wed, 5 Jun 2019 10:04:40 +0000	[thread overview]
Message-ID: <69aaca7b85f45dac57143338614b486cbca2f489.camel@intel.com> (raw)
In-Reply-To: <20190604151254.7192-1-arkadiusz.hiler@intel.com>

On Tue, 2019-06-04 at 18:12 +0300, Arkadiusz Hiler wrote:
> 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 <antonio.argenziano@intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
>  runner/runner_tests.c | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/runner/runner_tests.c b/runner/runner_tests.c
> index 1fc09688..c09cda70 100644
> --- a/runner/runner_tests.c
> +++ b/runner/runner_tests.c
> @@ -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);

Do we care about not polluting errno?

In any case:

Reviewed-by: Simon Ser <simon.ser@intel.com>

> +
>  		init_settings(settings);
> +	}
>  
>  	igt_subtest("default-settings") {
>  		const char *argv[] = { "runner",
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      parent reply	other threads:[~2019-06-05 10:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 15:12 [igt-dev] [PATCH i-g-t] runner_tests: Fix the file descriptor leakage subtest Arkadiusz Hiler
2019-06-04 16:13 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-06-04 16:16 ` [igt-dev] [PATCH i-g-t] " Antonio Argenziano
2019-06-05 10:02 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork
2019-06-05 10:04 ` Ser, Simon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69aaca7b85f45dac57143338614b486cbca2f489.camel@intel.com \
    --to=simon.ser@intel.com \
    --cc=arkadiusz.hiler@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox