mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: daniel.zahka@gmail.com
Cc: kuba@kernel.org, willemdebruijn.kernel@gmail.com,
	davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com,
	horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org,
	rdunlap@infradead.org, donald.hunter@gmail.com,
	andrew+netdev@lunn.ch, shuah@kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kselftest@vger.kernel.org, willemb@google.com
Subject: Re: [PATCH net-next v5 6/6] selftests: drv-net: psp: add rekey tests
Date: Sat, 21 Nov 2026 23:03:04 +0000	[thread overview]
Message-ID: <179530218434.3135.4343666486290603431@kernel.org> (raw)
In-Reply-To: <20261118-psp-v5-6-b9ec840e0296@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

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] selftests: drv-net: psp: stale length n in run_session() after
  tx assoc

--

> diff --git a/tools/testing/selftests/drivers/net/psp_responder.c b/tools/testing/selftests/drivers/net/psp_responder.c
> --- a/tools/testing/selftests/drivers/net/psp_responder.c
> +++ b/tools/testing/selftests/drivers/net/psp_responder.c
> @@ -247,6 +354,16 @@ run_session(struct ynl_sock *ys, struct opts *opts,
>  						fprintf(stderr, "WARN: echo but no data sock\n");
>  					send_ack(comm_sock);
>  				}
> +				if (cmd("rx assoc"))
> +					handle_rx_assoc(ys, data_sock,
> +							comm_sock);
> +				if (cmd_w_msg("tx assoc", struct assoc_msg)) {
> +					handle_tx_assoc(ys, buf, data_sock,
> +							comm_sock);
> +					__consume(sizeof(struct assoc_msg));
> +				}
> +				if (cmd("key rotate"))
> +					handle_key_rotate(ys, opts, comm_sock);
>  				if (cmd("data close")) {
>  					if (data_sock >= 0) {
>  						close(data_sock);

[Severity: Medium]
In run_session(), n is set from off once, before the do/while loop,
and is never updated. cmd() still tests n >= sz and __consume() tests
n == sz. For a single tx assoc message n is 49.

cmd("tx assoc") consumes the 9 byte string and moves the struct
assoc_msg to buf[0]. __consume(sizeof(struct assoc_msg)) then takes
the else branch. That leaves off == 0, but the 40 byte assoc_msg is
still in buf[0..39].

The checks that follow in the same iteration (key rotate, data close,
conn psp, conn clr, exit) still see n == 49. They memcmp() buf against
the SPI, version and key bytes of a message that was already handled.
Suppose those bytes match a command string. For example, an SPI of
0x65786974 with version 0 reads as "exit\0". The matching __consume()
then does off -= sz starting from zero, and memmove() gets a negative
length converted to a huge size_t, which crashes the responder.

The conn psp handler already has the same stale-n pattern, but it
only leaves the two version bytes behind. tx assoc is the first
command that leaves an arbitrary binary payload at the front of buf.

Would it make sense to have cmd() and __consume() check off rather
than n, perhaps as a small fix ahead of this patch? Then a command
could only match bytes that have not been consumed yet.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-psp-v5-0-b9ec840e0296%40gmail.com

      reply	other threads:[~2026-11-21 23:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 14:08 [PATCH net-next v5 0/6] psp: support rekeying psp protected tcp connections Daniel Zahka
2026-11-18 14:08 ` [PATCH net-next v5 1/6] psp: support rx rekey operation Daniel Zahka
2026-11-21 23:03   ` netdev-bot+sashiko
2026-11-18 14:08 ` [PATCH net-next v5 2/6] psp: support tx " Daniel Zahka
2026-11-18 14:08 ` [PATCH net-next v5 3/6] psp: document lock ordering with the netdev instance lock Daniel Zahka
2026-11-18 14:08 ` [PATCH net-next v5 4/6] psp: defer tx key deletions for SADB drivers Daniel Zahka
2026-11-21 23:03   ` netdev-bot+sashiko
2026-11-18 14:08 ` [PATCH net-next v5 5/6] selftests: drv-net: psp: factor out psp connection setup Daniel Zahka
2026-11-18 14:08 ` [PATCH net-next v5 6/6] selftests: drv-net: psp: add rekey tests Daniel Zahka
2026-11-21 23:03   ` 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=179530218434.3135.4343666486290603431@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=daniel.zahka@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.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

all inboxes | Powered by JetHome®