mbox series

[SRU,E,0/2] kselftest: properly use timeout

Message ID 20200410105518.521722-1-andrea.righi@canonical.com
Headers show
Series kselftest: properly use timeout | expand

Message

Andrea Righi April 10, 2020, 10:55 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1872047

[Impact]

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).

[Test 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.

[Fix]

This problem can be prevented by passing --foreground to
/usr/bin/timeout, allowing to properly deliver signals to children
processes.

In addition to that make sure to use /usr/bin/timeout only when it's
needed (this is addressed by PATCH 2/2): when timeout is set to 0 (no
timeout) via the file 'settings', simply run the test without using
/usr/bin/timeout.

[Regression potential]

These two fixes are not upsteam (not yet), but they are trivial and they
are affecting only the selftest infrastructure, so regression potential
is minimal.

----------------------------------------------------------------
Andrea Righi (2):
      UBUNTU: SAUCE: kselftest/runner: avoid using timeout if timeout is disabled
      UBUNTU: SAUCE: kselftest/runner: allow to properly deliver signals to tests

 tools/testing/selftests/kselftest/runner.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thadeu Lima de Souza Cascardo April 10, 2020, 11:28 a.m. UTC | #1
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Kamal Mostafa April 15, 2020, 5:04 p.m. UTC | #2
Acked-by: Kamal Mostafa <kamal@canonical.com>

 -Kamal


On Fri, Apr 10, 2020 at 12:55:16PM +0200, Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1872047
> 
> [Impact]
> 
> 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).
> 
> [Test 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.
> 
> [Fix]
> 
> This problem can be prevented by passing --foreground to
> /usr/bin/timeout, allowing to properly deliver signals to children
> processes.
> 
> In addition to that make sure to use /usr/bin/timeout only when it's
> needed (this is addressed by PATCH 2/2): when timeout is set to 0 (no
> timeout) via the file 'settings', simply run the test without using
> /usr/bin/timeout.
> 
> [Regression potential]
> 
> These two fixes are not upsteam (not yet), but they are trivial and they
> are affecting only the selftest infrastructure, so regression potential
> is minimal.
> 
> ----------------------------------------------------------------
> Andrea Righi (2):
>       UBUNTU: SAUCE: kselftest/runner: avoid using timeout if timeout is disabled
>       UBUNTU: SAUCE: kselftest/runner: allow to properly deliver signals to tests
> 
>  tools/testing/selftests/kselftest/runner.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Kelsey Skunberg April 17, 2020, 5:38 p.m. UTC | #3
On 2020-04-10 12:55:16 , Andrea Righi wrote:
> BugLink: https://bugs.launchpad.net/bugs/1872047
> 
> [Impact]
> 
> 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).
> 
> [Test 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.
> 
> [Fix]
> 
> This problem can be prevented by passing --foreground to
> /usr/bin/timeout, allowing to properly deliver signals to children
> processes.
> 
> In addition to that make sure to use /usr/bin/timeout only when it's
> needed (this is addressed by PATCH 2/2): when timeout is set to 0 (no
> timeout) via the file 'settings', simply run the test without using
> /usr/bin/timeout.
> 
> [Regression potential]
> 
> These two fixes are not upsteam (not yet), but they are trivial and they
> are affecting only the selftest infrastructure, so regression potential
> is minimal.
> 
> ----------------------------------------------------------------
> Andrea Righi (2):
>       UBUNTU: SAUCE: kselftest/runner: avoid using timeout if timeout is disabled
>       UBUNTU: SAUCE: kselftest/runner: allow to properly deliver signals to tests
> 
>  tools/testing/selftests/kselftest/runner.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
>

Applied to Eoan/master-next. Thank you!

-Kelsey
 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team