mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
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: ab8b7f0cb3 ("tools/bpf: Add self tests for bpf_send_signal_thread()")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/bpf/20251113171153.2583-1-alexei.starovoitov@gmail.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
63066b7a8e
commit
c133390398
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user