* [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat
@ 2026-08-21 3:09 Qingshuang Fu
2026-08-21 3:14 ` [PATCH net v2 1/2] selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat Qingshuang Fu
2026-08-21 6:45 ` [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Hangbin Liu
0 siblings, 2 replies; 4+ messages in thread
From: Qingshuang Fu @ 2026-08-21 3:09 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
SeongJae Park
Cc: netdev, linux-kselftest, linux-kernel, Qingshuang Fu,
Qingshuang Fu
From: Qingshuang Fu <fuqingshuang@kylinos.cn>
This series fixes two bugs in the fin_ack_lat self-test.
Patch 1 fixes the swapped kill() arguments in sig_handler(), so the
server actually forwards SIGTERM to the client. It also makes the
wrapper script's cleanup tolerant of ESRCH, since the client may now
exit before the kill command reaches its PID.
Patch 2 adds a missing fork() error check: on failure the code falls
into server()'s infinite accept loop, producing empty output that the
wrapper script treats as a passing test.
Qingshuang Fu (2):
selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat
selftests/net: check fork() return value in fin_ack_lat
tools/testing/selftests/net/fin_ack_lat.c | 5 +++-
tools/testing/selftests/net/fin_ack_lat.sh | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
---
v1: https://lore.kernel.org/all/20260817091017.281104-1-fffsqian@163.com/
v2:
- Split into two patches
- Add shell cleanup tolerance for ESRCH per Sashiko-AI review
- Add missing fork() error check per Sashiko-AI review
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net v2 1/2] selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat
2026-08-21 3:09 [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Qingshuang Fu
@ 2026-08-21 3:14 ` Qingshuang Fu
2026-08-21 3:14 ` [PATCH net v2 2/2] selftests/net: check fork() return value " Qingshuang Fu
2026-08-21 6:45 ` [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Hangbin Liu
1 sibling, 1 reply; 4+ messages in thread
From: Qingshuang Fu @ 2026-08-21 3:14 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
SeongJae Park
Cc: netdev, linux-kselftest, linux-kernel, Qingshuang Fu,
Qingshuang Fu
From: Qingshuang Fu <fuqingshuang@kylinos.cn>
sig_handler() passes its arguments to kill() in the wrong order: it sends
signal number child_pid to PID SIGTERM (15) instead of sending SIGTERM
to the client process. The call therefore always fails and the signal
is never forwarded: when only the server process receives SIGTERM, the
client keeps running its infinite connect loop as an orphan process.
Swap the arguments so that the server forwards SIGTERM to the client.
Guard the call with child_pid > 0: the client inherits the handler and
sees child_pid == 0, and a plain argument swap would make it call
kill(0, SIGTERM), signaling the whole process group instead of exiting
quietly.
Now that the server actually terminates the client before the wrapper
script's cleanup runs, kill() may fail with ESRCH for the already-exited
client. The script uses set -e, so make the kill tolerant to avoid
aborting the EXIT trap and leaking temporary files.
Fixes: af8c8a450bf4 ("selftests: net: Add FIN_ACK processing order related latency spike test")
Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
---
tools/testing/selftests/net/fin_ack_lat.c | 3 ++-
tools/testing/selftests/net/fin_ack_lat.sh | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/fin_ack_lat.c b/tools/testing/selftests/net/fin_ack_lat.c
index 4117332eb1a9..98044e6f9f43 100644
--- a/tools/testing/selftests/net/fin_ack_lat.c
+++ b/tools/testing/selftests/net/fin_ack_lat.c
@@ -103,7 +103,8 @@ static void server(int sock, struct sockaddr_in address)
static void sig_handler(int signum)
{
- kill(SIGTERM, child_pid);
+ if (child_pid > 0)
+ kill(child_pid, SIGTERM);
exit(0);
}
diff --git a/tools/testing/selftests/net/fin_ack_lat.sh b/tools/testing/selftests/net/fin_ack_lat.sh
index a3ff6e0b2c7a..a8aa2238ab5c 100755
--- a/tools/testing/selftests/net/fin_ack_lat.sh
+++ b/tools/testing/selftests/net/fin_ack_lat.sh
@@ -9,7 +9,7 @@ set -e
tmpfile=$(mktemp /tmp/fin_ack_latency.XXXX.log)
cleanup() {
- kill $(pidof fin_ack_lat)
+ kill $(pidof fin_ack_lat) 2>/dev/null || true
rm -f $tmpfile
}
base-commit: 7f063b2f17eaba2a35e251aa53627f2a70d536e2
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net v2 2/2] selftests/net: check fork() return value in fin_ack_lat
2026-08-21 3:14 ` [PATCH net v2 1/2] selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat Qingshuang Fu
@ 2026-08-21 3:14 ` Qingshuang Fu
0 siblings, 0 replies; 4+ messages in thread
From: Qingshuang Fu @ 2026-08-21 3:14 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
SeongJae Park
Cc: netdev, linux-kselftest, linux-kernel, Qingshuang Fu,
Qingshuang Fu
From: Qingshuang Fu <fuqingshuang@kylinos.cn>
main() never checks fork() for failure. When fork() returns -1
(EAGAIN/ENOMEM/RLIMIT_NPROC), the !child_pid test is false and the
process falls into server()'s infinite accept() loop with no client ever
connecting, producing empty output. The wrapper script treats an
empty log as a passing test, producing a false positive.
Check fork() for failure with error(), as is done for every other
syscall in this file.
Fixes: af8c8a450bf4 ("selftests: net: Add FIN_ACK processing order related latency spike test")
Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
---
tools/testing/selftests/net/fin_ack_lat.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/fin_ack_lat.c b/tools/testing/selftests/net/fin_ack_lat.c
index 98044e6f9f43..4068f8e227cf 100644
--- a/tools/testing/selftests/net/fin_ack_lat.c
+++ b/tools/testing/selftests/net/fin_ack_lat.c
@@ -143,6 +143,8 @@ int main(int argc, char const *argv[])
fprintf(stderr, "server port: %d\n", ntohs(laddr.sin_port));
child_pid = fork();
+ if (child_pid < 0)
+ error(-1, errno, "fork");
if (!child_pid)
client(ntohs(laddr.sin_port));
else
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat
2026-08-21 3:09 [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Qingshuang Fu
2026-08-21 3:14 ` [PATCH net v2 1/2] selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat Qingshuang Fu
@ 2026-08-21 6:45 ` Hangbin Liu
1 sibling, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2026-08-21 6:45 UTC (permalink / raw)
To: Qingshuang Fu
Cc: Andy Whitcroft, Joe Perches, David S . Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan,
SeongJae Park, netdev, linux-kselftest, linux-kernel,
Qingshuang Fu
On Fri, Aug 21, 2026 at 11:09:20AM +0800, Qingshuang Fu wrote:
> From: Qingshuang Fu <fuqingshuang@kylinos.cn>
>
> This series fixes two bugs in the fin_ack_lat self-test.
>
> Patch 1 fixes the swapped kill() arguments in sig_handler(), so the
> server actually forwards SIGTERM to the client. It also makes the
> wrapper script's cleanup tolerant of ESRCH, since the client may now
> exit before the kill command reaches its PID.
>
> Patch 2 adds a missing fork() error check: on failure the code falls
> into server()'s infinite accept loop, producing empty output that the
> wrapper script treats as a passing test.
>
> Qingshuang Fu (2):
> selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat
> selftests/net: check fork() return value in fin_ack_lat
>
> tools/testing/selftests/net/fin_ack_lat.c | 5 +++-
> tools/testing/selftests/net/fin_ack_lat.sh | 2 +-
> 2 files changed, 5 insertions(+), 2 deletions(-)
> ---
> v1: https://lore.kernel.org/all/20260817091017.281104-1-fffsqian@163.com/
>
> v2:
> - Split into two patches
> - Add shell cleanup tolerance for ESRCH per Sashiko-AI review
> - Add missing fork() error check per Sashiko-AI review
> --
> 2.25.1
>
LGTM, for the series
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-21 6:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 3:09 [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Qingshuang Fu
2026-08-21 3:14 ` [PATCH net v2 1/2] selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat Qingshuang Fu
2026-08-21 3:14 ` [PATCH net v2 2/2] selftests/net: check fork() return value " Qingshuang Fu
2026-08-21 6:45 ` [PATCH net v2 0/2] selftests/net: fixes for fin_ack_lat Hangbin Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.