BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Fix failure path in send_signal test
@ 2025-11-13  7:05 Alexei Starovoitov
  2025-11-13  7:31 ` bot+bpf-ci
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2025-11-13  7:05 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, martin.lau

From: Alexei Starovoitov <ast@kernel.org>

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 <ast@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/send_signal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/send_signal.c b/tools/testing/selftests/bpf/prog_tests/send_signal.c
index 1702aa592c2c..61521dc76c3c 100644
--- a/tools/testing/selftests/bpf/prog_tests/send_signal.c
+++ b/tools/testing/selftests/bpf/prog_tests/send_signal.c
@@ -110,8 +110,10 @@ static void test_send_signal_common(struct perf_event_attr *attr,
 	close(pipe_p2c[0]); /* close read */
 
 	skel = test_send_signal_kern__open_and_load();
-	if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
+	if (!ASSERT_OK_PTR(skel, "skel_open_and_load")) {
+		kill(pid, SIGKILL);
 		goto skel_open_load_failure;
+	}
 
 	/* boost with a high priority so we got a higher chance
 	 * that if an interrupt happens, the underlying task
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-15  1:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13  7:05 [PATCH bpf-next] selftests/bpf: Fix failure path in send_signal test Alexei Starovoitov
2025-11-13  7:31 ` bot+bpf-ci
2025-11-13 21:59 ` Yonghong Song
2025-11-14 22:20 ` Andrii Nakryiko
2025-11-14 22:25   ` Alexei Starovoitov
2025-11-15  1:02     ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox