From: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
To: Zilin Guan <zilin@seu.edu.cn>, anthony.l.nguyen@intel.com
Cc: przemyslaw.kitszel@intel.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
jianhao.xu@seu.edu.cn
Subject: Re: [PATCH] ixgbe/ipsec: use memzero_explicit() for stack SA structs
Date: Mon, 12 May 2025 14:53:12 +0200 [thread overview]
Message-ID: <170f287e-23b1-468b-9b59-08680de1ecf1@linux.intel.com> (raw)
In-Reply-To: <20250512105855.3748230-1-zilin@seu.edu.cn>
On 2025-05-12 12:58 PM, Zilin Guan wrote:
> The function ixgbe_ipsec_add_sa() currently uses memset() to zero out
> stack-allocated SA structs (rsa and tsa) before return, but the gcc-11.4.0
> compiler optimizes these calls away. This leaves sensitive key and salt
> material on the stack after return.
>
> Replace these memset() calls with memzero_explicit() to prevent the
> compiler from optimizing them away. This guarantees that the SA key and
> salt are reliably cleared from the stack.
>
> Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Thanks for your patch.
Please use the correct target iwl-net for fixes, iwl-next for features
and others.
Maybe add a tag? Fixes: 63a67fe229ea ("ixgbe: add ipsec offload add and
remove SA")
In the future when sending patches against Intel networking drivers
please send them directly To: intel-wired-lan@lists.osuosl.org and Cc:
netdev@vger.kernel.org.
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
> index 07ea1954a276..e8c84f7e937b 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
> @@ -678,7 +678,7 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs,
> } else {
> /* no match and no empty slot */
> NL_SET_ERR_MSG_MOD(extack, "No space for SA in Rx IP SA table");
> - memset(&rsa, 0, sizeof(rsa));
> + memzero_explicit(&rsa, sizeof(rsa));
> return -ENOSPC;
> }
>
> @@ -727,7 +727,7 @@ static int ixgbe_ipsec_add_sa(struct xfrm_state *xs,
> ret = ixgbe_ipsec_parse_proto_keys(xs, tsa.key, &tsa.salt);
> if (ret) {
> NL_SET_ERR_MSG_MOD(extack, "Failed to get key data for Tx SA table");
> - memset(&tsa, 0, sizeof(tsa));
> + memzero_explicit(&tsa, sizeof(tsa));
As for the code change itself, LGTM.
Acked-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
Thanks,
Dawid
> return ret;
> }
>
next prev parent reply other threads:[~2025-05-12 12:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 10:58 Zilin Guan
2025-05-12 12:53 ` Dawid Osuchowski [this message]
2025-05-13 12:24 ` Zilin Guan
2025-05-13 13:21 ` Dawid Osuchowski
2025-05-13 13:31 ` Zilin Guan
2025-05-13 13:54 ` Dawid Osuchowski
2025-05-15 9:27 ` Przemek Kitszel
2025-05-16 15:04 ` Zilin Guan
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=170f287e-23b1-468b-9b59-08680de1ecf1@linux.intel.com \
--to=dawid.osuchowski@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jianhao.xu@seu.edu.cn \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=zilin@seu.edu.cn \
/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®