Skip to content

Commit 09fe11b

Browse files
Alexei StarovoitovKernel Patches Daemon
authored andcommitted
selftests/bpf: Fix failure path 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). Fix the issue by killing the child before jumping to skel_open_load_failure. 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. Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 4eb9670 commit 09fe11b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ static void test_send_signal_common(struct perf_event_attr *attr,
110110
close(pipe_p2c[0]); /* close read */
111111

112112
skel = test_send_signal_kern__open_and_load();
113-
if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
113+
if (!ASSERT_OK_PTR(skel, "skel_open_and_load")) {
114+
kill(pid, SIGKILL);
114115
goto skel_open_load_failure;
116+
}
115117

116118
/* boost with a high priority so we got a higher chance
117119
* that if an interrupt happens, the underlying task

0 commit comments

Comments
 (0)