Skip to content

Commit 0c18a75

Browse files
zhijianli88gregkh
authored andcommitted
kselftest: signal all child processes
[ Upstream commit 92d2563 ] We have some many cases that will create child process as well, such as pidfd_wait. Previously, we will signal/kill the parent process when it is time out, but this signal will not be sent to its child process. In such case, if child process doesn't terminate itself, ksefltest framework will hang forever. Here we group all its child processes so that kill() can signal all of them in timeout. Fixed change log: Shuah Khan <skhan@linuxfoundation.org> Suggested-by: yang xu <xuyang2018.jy@cn.fujitsu.com> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 1136141 commit 0c18a75

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎tools/testing/selftests/kselftest_harness.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext)
871871
}
872872

873873
t->timed_out = true;
874-
kill(t->pid, SIGKILL);
874+
// signal process group
875+
kill(-(t->pid), SIGKILL);
875876
}
876877

877878
void __wait_for_test(struct __test_metadata *t)
@@ -981,6 +982,7 @@ void __run_test(struct __fixture_metadata *f,
981982
ksft_print_msg("ERROR SPAWNING TEST CHILD\n");
982983
t->passed = 0;
983984
} else if (t->pid == 0) {
985+
setpgrp();
984986
t->fn(t, variant);
985987
if (t->skip)
986988
_exit(255);

0 commit comments

Comments
 (0)