Skip to content

Commit f54cd8f

Browse files
james-c-linaronamhyung
authored andcommitted
perf test: Don't signal all processes on system when interrupting tests
This signal handler loops over all tests on ctrl-C, but it's active while the test list is being constructed. process.pid is 0, then -1, then finally set to the child pid on fork. If the Ctrl-C is received during this point a kill(-1, SIGINT) can be sent which affects all processes. Make sure the child has forked first before forwarding the signal. This can be reproduced with ctrl-C immediately after launching perf test which terminates the ssh connection. Fixes: 553d5ef ("perf test: Add a signal handler to kill forked child processes") Signed-off-by: James Clark <[email protected]> Reviewed-by: Ian Rogers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 23c44f6 commit f54cd8f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/tests/builtin-test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ static int __cmd_test(struct test_suite **suites, int argc, const char *argv[],
508508
for (size_t x = 0; x < num_tests; x++) {
509509
struct child_test *child_test = child_tests[x];
510510

511-
if (!child_test)
511+
if (!child_test || child_test->process.pid <= 0)
512512
continue;
513513

514514
pr_debug3("Killing %d pid %d\n",

0 commit comments

Comments
 (0)