Skip to content

Commit f5bca7d

Browse files
Alexei StarovoitovKernel Patches Daemon
authored andcommitted
selftests/bpf: Fix failure paths in send_signal test
When test_send_signal_kern__open_and_load() fails parent closes the pipe which cases ASSERT_EQ(read(pipe_p2c...)) to fail, but child continues and enters infinite loop, while parent is stuck in wait(NULL). Other error paths have similar issue, so kill the child before waiting on it. The bug was discovered while compiling all of selftests with -O1 instead of -O2 which caused progs/test_send_signal_kern.c to fail to load. Fixes: ab8b7f0 ("tools/bpf: Add self tests for bpf_send_signal_thread()") Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Eduard Zingerman <[email protected]>
1 parent e1b05fd commit f5bca7d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/testing/selftests/bpf/prog_tests/send_signal.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ static void test_send_signal_common(struct perf_event_attr *attr,
206206
skel_open_load_failure:
207207
close(pipe_c2p[0]);
208208
close(pipe_p2c[1]);
209+
/*
210+
* Child is either about to exit cleanly or stuck in case of errors.
211+
* Nudge it to exit.
212+
*/
213+
kill(pid, SIGKILL);
209214
wait(NULL);
210215
}
211216

0 commit comments

Comments
 (0)