From: netdev-bot+sashiko@kernel.org
To: dennylin0707@gmail.com
Cc: edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
davem@davemloft.net, willemb@google.com, horms@kernel.org,
shuah@kernel.org, 0x7f454c46@gmail.com, dsahern@kernel.org,
rastislav.szabo@isovalent.com, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next] selftests: net: tcp_ao: test listen socket RST to a v4-mapped peer
Date: Sun, 06 Dec 2026 02:53:37 +0000 [thread overview]
Message-ID: <179652561759.3148.5987827821452714745@kernel.org> (raw)
In-Reply-To: <20261205022210.49972-1-dennylin0707@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The only client-side check in test_client_listen_rst()
(tools/testing/selftests/net/tcp_ao/rst.c) can never fail.
- [Low] The file-level header comment of
tools/testing/selftests/net/tcp_ao/rst.c says the test covers two…
--
selftests: net: tcp_ao: test listen socket RST to a v4-mapped peer
This adds a case to the tcp_ao rst selftest. A dual-stack listen socket
must reply with an AO-signed RST to an IPv4 peer whose key was added with
a v4-mapped address. The patch also makes __test_listen_socket() take the
family from the address, and lets test_cmp_getsockopt_setsockopt()
compare v4-mapped key addresses.
Link: https://lore.kernel.org/all/CAL4WiiovxhEi8G4W9F7faF9COPTaUcjo_1VF2ObJpbUB0i1ibw@mail.gmail.com/
> diff --git a/tools/testing/selftests/net/tcp_ao/rst.c b/tools/testing/selftests/net/tcp_ao/rst.c
> index 883cddf377cff..ce9d24ac6437b 100644
> --- a/tools/testing/selftests/net/tcp_ao/rst.c
> +++ b/tools/testing/selftests/net/tcp_ao/rst.c
> @@ -170,6 +170,74 @@ static void test_server_passive_rst(unsigned int port)
[ ... ]
> +static void test_server_listen_rst(unsigned int port)
> +{
> + uint64_t before_cnt, after_cnt;
> + int sk, lsk;
[ ... ]
> + sk = accept(lsk, NULL, NULL);
> + if (sk < 0)
> + test_error("accept()");
> +
> + test_kill_sk(sk);
> + before_cnt = netstat_get_one("OutRsts", NULL);
> +
> + synchronize_threads(); /* 2: accepted socket killed => send data */
> + synchronize_threads(); /* 3: client counters read => data sent */
> + synchronize_threads(); /* 4: client waited for the RST */
> + after_cnt = netstat_get_one("OutRsts", NULL);
> + if (after_cnt <= before_cnt)
> + test_fail("listen RST: OutRsts counter did not increase: %" PRIu64 " <= %" PRIu64,
> + after_cnt, before_cnt);
> + else
> + test_ok("listen RST: counter OutRsts increased %" PRIu64 " => %" PRIu64,
> + before_cnt, after_cnt);
[Severity: Low]
This isn't a bug, but the header comment at the top of rst.c still
describes only the active reset and the passive (TIME-WAIT) reset:
* In both cases TCP-AO signatures have to be correct, which is verified by
* (1) checking that the TCP-AO connection was reset and (2) TCP-AO counters.
In the new listen socket case the client is expected to reject the RST
with a TCP_AO_MISMATCH instead of being reset. The case is checked with
the OutRsts counter and a trace event, not with a reset plus TCP-AO
counters.
Should the header be updated to describe this third case?
> +
> + close(lsk);
> +}
[ ... ]
> @@ -433,6 +503,32 @@ static void test_client_passive_rst(unsigned int port)
> test_assert_counters("client passive RST", &cnt1, &cnt2, TEST_CNT_GOOD);
> }
>
> +static void test_client_listen_rst(unsigned int port)
> +{
[ ... ]
> + trace_ao_event_expect(TCP_AO_MISMATCH, this_ip_dest, this_ip_addr,
> + port, -1, 0, 0, 0, 1, 0, 0, 100, 100, -1);
> +
> + synchronize_threads(); /* 2: accepted socket killed => send data */
> + if (!test_skpair_client(sk, packet_sz, 1, TEST_CNT_BAD, &dummy))
> + test_fail("listen RST: client sock is yet connected");
[Severity: Medium]
Can this test_fail() ever be reached? test_skpair_client() returns 0 only
when test_client_loop() gets back all buf_sz bytes:
tools/testing/selftests/net/tcp_ao/lib/sock.c:test_skpair_client() {
...
ret = test_client_loop(sk, buf_sz, msg_len, &c, cond, err);
test_tcp_counters_free(&c);
if (ret < 0)
return (int)ret;
return ret != buf_sz ? -1 : 0;
}
test_server_listen_rst() calls test_kill_sk() on the accepted socket and
never echoes anything back. Every outcome seems to give a non-zero
return:
- RST accepted: -ECONNRESET from __test_wait_fd()
- RST rejected and the TEST_CNT_BAD condition met: -ETIMEDOUT
- no RST at all: a real timeout, also -ETIMEDOUT
- short recv(): -1
The condition-met case and the real timeout both end up here in
__test_skpair_poll():
if (c && cond && __skpair_poll_should_stop(sk, c, cond))
break;
...
if (err)
*err = -ETIMEDOUT;
So the caller cannot tell those two apart either.
As a result, the client never asserts that its TCP-AO bad counters went
up. Two checks remain. One is the server's netns-wide OutRsts counter,
which goes up for any RST, signed or unsigned. The other is the
TCP_AO_MISMATCH trace expectation, which is dropped on kernels without
ftrace:
tools/testing/selftests/net/tcp_ao/lib/ftrace-tcp.c:trace_ao_event_expect() {
if (!kernel_config_has(KCONFIG_FTRACE))
return 0;
...
}
In that case the final trace check becomes test_skip(). The OutRsts check
does catch the failure from the commit message, where no RST is sent at
all.
On a kernel without ftrace, though, would a regression where the listener
sends an unsigned or wrongly keyed RST still pass?
For comparison, test_client_passive_rst() checks err == -ECONNRESET and
then calls test_assert_counters(). Could this case read the client
counters before and after and assert that the bad counters increased?
> +
> + synchronize_threads(); /* 4: client waited for the RST */
> + test_kill_sk(sk);
> +}
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261205022210.49972-1-dennylin0707%40gmail.com
prev parent reply other threads:[~2026-12-06 2:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-05 2:22 [PATCH net-next] selftests: net: tcp_ao: test listen socket RST to a v4-mapped peer Hungyu Lin
2026-12-06 2:53 ` netdev-bot+sashiko [this message]
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=179652561759.3148.5987827821452714745@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=0x7f454c46@gmail.com \
--cc=davem@davemloft.net \
--cc=dennylin0707@gmail.com \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rastislav.szabo@isovalent.com \
--cc=shuah@kernel.org \
--cc=willemb@google.com \
/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