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 v4 2/5] psp: support tx rekey operation
Date: Wed, 18 Nov 2026 06:05:04 +0000 [thread overview]
Message-ID: <179498190470.3136.17804985440456720671@kernel.org> (raw)
In-Reply-To: <20261116-psp-v4-2-1a599df2aefa@gmail.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In the commit "psp: support tx rekey operation", the
documentation and the code disagree.
Pre-existing issues:
- [Low] Retired PSP key material is freed without being zeroized.
--
psp: support tx rekey operation
This commit lets tx-assoc be called on a socket that already has a Tx
key. A new psp_assoc is allocated with the same Rx state and the new Tx
key, then published to the socket with rcu_assign_pointer(). For now,
devices that store Tx keys on the device (SADB) get -EOPNOTSUPP.
> diff --git a/net/psp/psp_sock.c b/net/psp/psp_sock.c
> index c1e38845f08c3..d497f41c483e1 100644
> --- a/net/psp/psp_sock.c
> +++ b/net/psp/psp_sock.c
> @@ -280,6 +280,53 @@ psp_sock_set_tx_key(struct sock *sk, struct psp_dev *psd, struct psp_assoc *pas,
> return err;
> }
>
> +static int
> +psp_sock_tx_rekey(struct sock *sk, struct psp_dev *psd, struct psp_assoc *pas,
> + struct psp_key_parsed *key, struct netlink_ext_ack *extack)
> +{
> + struct psp_assoc *new;
> + int err;
> +
> + if (psp_dev_has_sadb(psd)) {
> + NL_SET_ERR_MSG(extack, "Tx rekey not supported on this device");
> + return -EOPNOTSUPP;
> + }
[Severity: Low]
Should the documentation updated in this patch mention this restriction?
The tx-assoc doc in psp.yaml now says, with no condition:
If the socket already has a Tx association, rekey its Tx direction.
psp.rst says tx-assoc "installs a new Tx key, which takes effect
immediately". The only rekey errors it lists are -EINVAL and -EBUSY.
psp_dev_has_sadb() is true for mlx5, which sets
.tx_key_del = mlx5e_psp_assoc_del. So at this commit, a Tx rekey on the
only in-tree hardware driver always fails with -EOPNOTSUPP, and the docs
never mention that errno.
The next patch in the series, "psp: defer tx key deletions for SADB
drivers", removes this check and adds deferred Tx key deletion. After it,
the code and the docs agree. The mismatch only exists between these two
patches, and the commit message calls it out ("return -EOPNOTSUPP for
now").
> + if (!pas->peer_tx) {
> + NL_SET_ERR_MSG(extack, "Socket PSP state is not fully established");
> + return -EBUSY;
> + }
[ ... ]
> + memcpy(&new->rx, &pas->rx, sizeof(new->rx));
> +
> + err = psp_assoc_set_tx(psd, new, key, extack);
> + if (err) {
> + kfree(new);
> + return err;
> + }
> +
> + psp_dev_get(new->psd);
> + list_add(&new->assocs_list, &pas->assocs_list);
> + list_move(&pas->assocs_list, &psd->stale_assocs);
> +
> + rcu_assign_pointer(sk->psp_assoc, new);
> + psp_assoc_put(pas);
[Severity: Low]
This isn't a bug introduced by this patch, but should the retired key
material be wiped before it is freed?
The replaced association still holds the old Tx key in pas->tx and the Rx
key in pas->rx. It is released through:
psp_assoc_put()
call_rcu(&pas->rcu, psp_assoc_free_queue)
psp_assoc_free()
kfree(pas);
The kfree(new) on the psp_assoc_set_tx() error path also frees an object
that already holds a copy of the live Rx key.
Neither path uses kfree_sensitive() or memzero_explicit(), so the keys
stay in freed slab memory until that memory is reused. Since a rekey can
now happen while the connection stays up, this can repeat many times on
one socket.
The same pattern already existed before this patch, in psp_assoc_free()
and in the kfree(dummy) in psp_dev_tx_key_add(). Nothing in net/psp
zeroizes key material today. Reading these keys would also need a
separate kernel memory disclosure bug.
> int psp_sock_assoc_set_tx(struct sock *sk, struct psp_dev *psd,
> u32 version, struct psp_key_parsed *key,
> struct netlink_ext_ack *extack)
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-psp-v4-0-1a599df2aefa%40gmail.com
next prev parent reply other threads:[~2026-11-18 6:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 12:04 [PATCH net-next v4 0/5] psp: support rekeying psp protected tcp connections Daniel Zahka
2026-11-16 12:04 ` [PATCH net-next v4 1/5] psp: support rx rekey operation Daniel Zahka
2026-11-18 6:05 ` netdev-bot+sashiko
2026-11-16 12:04 ` [PATCH net-next v4 2/5] psp: support tx " Daniel Zahka
2026-11-18 6:05 ` netdev-bot+sashiko [this message]
2026-11-16 12:04 ` [PATCH net-next v4 3/5] psp: defer tx key deletions for SADB drivers Daniel Zahka
2026-11-18 6:05 ` netdev-bot+sashiko
2026-11-16 12:04 ` [PATCH net-next v4 4/5] selftests: drv-net: psp: factor out psp connection setup Daniel Zahka
2026-11-16 12:04 ` [PATCH net-next v4 5/5] selftests: drv-net: psp: add rekey tests Daniel Zahka
2026-11-18 6:05 ` netdev-bot+sashiko
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=179498190470.3136.17804985440456720671@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®