From: Qingshuang Fu <fffsqian@163.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
SeongJae Park <sjpark@amazon.de>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Qingshuang Fu <fuqingshuang@kylinos.cn>,
Qingshuang Fu <fffsqian@163.com>
Subject: [PATCH net v2 1/2] selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat
Date: Fri, 21 Aug 2026 11:14:41 +0800 [thread overview]
Message-ID: <20260821031442.1124777-1-fffsqian@163.com> (raw)
In-Reply-To: <20260821030922.1123754-1-fffsqian@163.com>
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
next prev parent reply other threads:[~2026-08-21 3:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-08-21 3:14 ` [PATCH net v2 2/2] selftests/net: check fork() return value 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821031442.1124777-1-fffsqian@163.com \
--to=fffsqian@163.com \
--cc=apw@canonical.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fuqingshuang@kylinos.cn \
--cc=horms@kernel.org \
--cc=joe@perches.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=sjpark@amazon.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox