selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat
authorQingshuang Fu <fuqingshuang@kylinos.cn>
Fri, 21 Aug 2026 03:14:41 +0000 (11:14 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 24 Aug 2026 18:40:25 +0000 (11:40 -0700)
commit2d83aa65dc983368ce14f1a1daa05ca56d38ab5c
tree5a69f5b6ddbaf673209e7fb9e35fea4b707901ce
parent403f96c32c9e24600093d7d0c61c17daeedca957
selftests/net: fix kill() argument order and wrapper cleanup in fin_ack_lat

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.

Signed-off-by: Qingshuang Fu <fuqingshuang@kylinos.cn>
Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260821031442.1124777-1-fffsqian@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/fin_ack_lat.c
tools/testing/selftests/net/fin_ack_lat.sh