From bcad69a1f9f205a854802701514aee8479065a56 Mon Sep 17 00:00:00 2001 From: Alexei Starovoitov Date: Wed, 12 Nov 2025 23:05:31 -0800 Subject: [PATCH] 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 Tested-by: Yonghong Song --- 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 1702aa592c2c2..61521dc76c3cb 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