* [PATCH v2 bpf-next] selftests/bpf: Fix failure paths in send_signal test
@ 2025-11-13 17:11 Alexei Starovoitov
2025-11-13 20:23 ` Eduard Zingerman
2025-11-15 1:10 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2025-11-13 17:11 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).
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: ab8b7f0cb358 ("tools/bpf: Add self tests for bpf_send_signal_thread()")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
tools/testing/selftests/bpf/prog_tests/send_signal.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/send_signal.c b/tools/testing/selftests/bpf/prog_tests/send_signal.c
index 1702aa592c2c..7ac4d5a488aa 100644
--- a/tools/testing/selftests/bpf/prog_tests/send_signal.c
+++ b/tools/testing/selftests/bpf/prog_tests/send_signal.c
@@ -206,6 +206,11 @@ static void test_send_signal_common(struct perf_event_attr *attr,
skel_open_load_failure:
close(pipe_c2p[0]);
close(pipe_p2c[1]);
+ /*
+ * Child is either about to exit cleanly or stuck in case of errors.
+ * Nudge it to exit.
+ */
+ kill(pid, SIGKILL);
wait(NULL);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2 bpf-next] selftests/bpf: Fix failure paths in send_signal test
2025-11-13 17:11 [PATCH v2 bpf-next] selftests/bpf: Fix failure paths in send_signal test Alexei Starovoitov
@ 2025-11-13 20:23 ` Eduard Zingerman
2025-11-15 1:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Eduard Zingerman @ 2025-11-13 20:23 UTC (permalink / raw)
To: Alexei Starovoitov, bpf; +Cc: daniel, andrii, martin.lau
On Thu, 2025-11-13 at 09:11 -0800, Alexei Starovoitov wrote:
> 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).
> 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: ab8b7f0cb358 ("tools/bpf: Add self tests for bpf_send_signal_thread()")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
From the same test:
/* wait a little for signal handler */
for (int i = 0; i < 1000000000 && !sigusr1_received; i++) {
j /= i + j + 1;
if (remote)
sleep(seconds: 1);
else
if (!attr)
/* trigger the nanosleep tracepoint program. */
usleep(useconds: 1);
}
Constants are probably a bit too high: from 10**3 to 10**9 seconds.
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2 bpf-next] selftests/bpf: Fix failure paths in send_signal test
2025-11-13 17:11 [PATCH v2 bpf-next] selftests/bpf: Fix failure paths in send_signal test Alexei Starovoitov
2025-11-13 20:23 ` Eduard Zingerman
@ 2025-11-15 1:10 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-15 1:10 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: bpf, daniel, andrii, martin.lau
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Thu, 13 Nov 2025 09:11:53 -0800 you wrote:
> 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).
> Other error paths have similar issue, so kill the child before waiting on it.
>
> [...]
Here is the summary with links:
- [v2,bpf-next] selftests/bpf: Fix failure paths in send_signal test
https://git.kernel.org/bpf/bpf-next/c/c13339039891
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-15 1:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 17:11 [PATCH v2 bpf-next] selftests/bpf: Fix failure paths in send_signal test Alexei Starovoitov
2025-11-13 20:23 ` Eduard Zingerman
2025-11-15 1:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox