All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Andrea Righi <andrea.righi@canonical.com>
Cc: Shuah Khan <shuah@kernel.org>,
	Andy Lutomirski <luto@amacapital.net>,
	Will Drewry <wad@chromium.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kselftest/runner: allow to properly deliver signals to tests
Date: Fri, 10 Apr 2020 13:33:19 -0700	[thread overview]
Message-ID: <202004101330.1E1963B5C2@keescook> (raw)
In-Reply-To: <20200410100259.GA457752@xps-13>

On Fri, Apr 10, 2020 at 12:02:59PM +0200, Andrea Righi wrote:
> While running seccomp_bpf, kill_after_ptrace() gets stuck if we run it
> via /usr/bin/timeout (that is the default), until the timeout expires.
> 
> This is because /usr/bin/timeout is preventing to properly deliver
> signals to ptrace'd children (SIGSYS in this case).
> 
> This problem can be easily reproduced by running:
> 
>  $ sudo make TARGETS=seccomp kselftest
>  ...
> 
>  # [ RUN      ] TRACE_syscall.skip_a#
>  not ok 1 selftests: seccomp: seccomp_bpf # TIMEOUT
> 
> The test is hanging at this point until the timeout expires and then it
> reports the timeout error.
> 
> Prevent this problem by passing --foreground to /usr/bin/timeout,
> allowing to properly deliver signals to children processes.

Interesting! This seems a poor behavior on "timeout"'s part. Is it
setting a signal mask? Hmpf. Thanks for tracking this down!  This seems
like the best solution now, so:

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> 
> Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
> ---
>  tools/testing/selftests/kselftest/runner.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kselftest/runner.sh b/tools/testing/selftests/kselftest/runner.sh
> index e84d901f8567..676b3a8b114d 100644
> --- a/tools/testing/selftests/kselftest/runner.sh
> +++ b/tools/testing/selftests/kselftest/runner.sh
> @@ -33,7 +33,7 @@ tap_timeout()
>  {
>  	# Make sure tests will time out if utility is available.
>  	if [ -x /usr/bin/timeout ] ; then
> -		/usr/bin/timeout "$kselftest_timeout" "$1"
> +		/usr/bin/timeout --foreground "$kselftest_timeout" "$1"
>  	else
>  		"$1"
>  	fi
> -- 
> 2.25.1
> 

-- 
Kees Cook

      reply	other threads:[~2020-04-10 20:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-10 10:02 [PATCH] kselftest/runner: allow to properly deliver signals to tests Andrea Righi
2020-04-10 20:33 ` Kees Cook [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=202004101330.1E1963B5C2@keescook \
    --to=keescook@chromium.org \
    --cc=andrea.righi@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=shuah@kernel.org \
    --cc=wad@chromium.org \
    /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 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.