public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	rbhansali@marvell.com, stable@dpdk.org,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Subject: [PATCH v5 4/6] common/cnxk: fix buffer overflow in SA setup
Date: Tue, 20 Jan 2026 11:52:09 -0800	[thread overview]
Message-ID: <20260120195418.466318-5-stephen@networkplumber.org> (raw)
In-Reply-To: <20260120195418.466318-1-stephen@networkplumber.org>

The nix_inl_reass_inb_sa_tbl_setup() function initializes inb_sa_sz
to 1 byte, then allocates a buffer of that size. However, the buffer
is subsequently passed to roc_ow_reass_inb_sa_init() which performs:

    memset(sa, 0, sizeof(struct roc_ow_ipsec_inb_sa));

This writes 808 bytes into a 1-byte allocation, causing heap corruption.

This bug was detected by GCC's -Wstringop-overflow warning when
building with LTO, which enables cross-compilation-unit inlining
and allows the compiler to track the allocation size through to
the memset call.

Fix by initializing inb_sa_sz to ROC_NIX_INL_OW_IPSEC_INB_SA_SZ,
which is the standard macro used elsewhere in this file for OW
(Sobek) inbound SA allocations.

Bugzilla ID: 1513
Fixes: fc9a711b5c8f ("common/cnxk: add NIX inline reassembly profile config")
Cc: rbhansali@marvell.com
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/cnxk/roc_nix_inl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c
index f8be98efd5..1766f68c17 100644
--- a/drivers/common/cnxk/roc_nix_inl.c
+++ b/drivers/common/cnxk/roc_nix_inl.c
@@ -583,7 +583,7 @@ nix_inl_reass_inb_sa_tbl_setup(struct roc_nix *roc_nix)
 	uint64_t sa_idx_w, lenm1_max;
 	uint64_t res_addr_offset = 0;
 	uint64_t def_cptq = 0;
-	size_t inb_sa_sz = 1;
+	size_t inb_sa_sz = ROC_NIX_INL_OW_IPSEC_INB_SA_SZ;
 	uint8_t profile_id;
 	struct mbox *mbox;
 	void *sa;
-- 
2.51.0


  parent reply	other threads:[~2026-01-20 19:54 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-23 19:41 [RFC 0/3] common/cnxk: remove dependence on VLA Stephen Hemminger
2025-10-23 19:41 ` [RFC 1/3] common/cnxk: replace variable length state array Stephen Hemminger
2025-10-23 19:41 ` [RFC 2/3] common/cnxk: replace variable length array Stephen Hemminger
2025-10-27  5:22   ` [EXTERNAL] " Harman Kalra
2025-10-23 19:41 ` [RFC 3/3] common/cnxk: re-enable vla warnings Stephen Hemminger
2026-01-14  1:49 ` [PATCH v2 0/3] common/cnxk: remove variable length arrays Stephen Hemminger
2026-01-14  1:49   ` [PATCH v2 1/3] common/cnxk: replace variable length state array Stephen Hemminger
2026-01-14  1:50   ` [PATCH v2 2/3] common/cnxk: replace variable length array Stephen Hemminger
2026-01-14  1:50   ` [PATCH v2 3/3] common/cnxk: re-enable vla warnings Stephen Hemminger
2026-01-16  6:46 ` [PATCH v3 0/6] fix GCC warnings when building with LTO Stephen Hemminger
2026-01-16  6:46   ` [PATCH v3 1/6] test/soring: fix buffer overflow warnings " Stephen Hemminger
2026-01-16  9:32     ` Morten Brørup
2026-01-19 22:48       ` Stephen Hemminger
2026-01-20  8:49         ` Morten Brørup
2026-01-20 14:34           ` Stephen Hemminger
2026-01-20 15:01             ` Morten Brørup
2026-01-20 15:40               ` Konstantin Ananyev
2026-01-20 15:48                 ` Stephen Hemminger
2026-01-20 16:52                 ` Stephen Hemminger
2026-01-20 19:27                 ` Stephen Hemminger
2026-01-21 10:40                   ` Morten Brørup
2026-01-21 12:56                   ` Konstantin Ananyev
2026-01-21 14:57                     ` Stephen Hemminger
2026-01-16  6:46   ` [PATCH v3 2/6] common/cnxk: replace variable length state array Stephen Hemminger
2026-01-16  6:46   ` [PATCH v3 3/6] common/cnxk: replace variable length array Stephen Hemminger
2026-01-16  6:46   ` [PATCH v3 4/6] common/cnxk: re-enable vla warnings Stephen Hemminger
2026-01-16  6:46   ` [PATCH v3 5/6] common/cnxk: fix buffer overflow in reassembly SA setup Stephen Hemminger
2026-01-16  6:46   ` [PATCH v3 6/6] net/mlx5/hws: fix LTO false positive stringop-overflow warning Stephen Hemminger
2026-01-19 22:44 ` [PATCH v4 0/6] fix build failures with LTO enabled Stephen Hemminger
2026-01-19 22:44   ` [PATCH v4 1/6] common/cnxk: replace variable length state array Stephen Hemminger
2026-01-19 22:44   ` [PATCH v4 2/6] common/cnxk: replace variable length array Stephen Hemminger
2026-01-19 22:44   ` [PATCH v4 3/6] common/cnxk: re-enable vla warnings Stephen Hemminger
2026-01-19 22:44   ` [PATCH v4 4/6] common/cnxk: fix buffer overflow in reassembly SA setup Stephen Hemminger
2026-01-19 22:44   ` [PATCH v4 5/6] net/mlx5: fix LTO false positive stringop-overflow warning Stephen Hemminger
2026-01-19 22:44   ` [PATCH v4 6/6] test/soring: fix stringop-overflow warning with LTO Stephen Hemminger
2026-01-20 19:52 ` [PATCH 0/6] Fix LTO compilation warnings Stephen Hemminger
2026-01-20 19:52   ` [PATCH v5 1/6] common/cnxk: replace variable length state array Stephen Hemminger
2026-01-20 19:52   ` [PATCH v5 2/6] common/cnxk: replace variable length array Stephen Hemminger
2026-01-20 19:52   ` [PATCH v5 3/6] common/cnxk: re-enable vla warnings Stephen Hemminger
2026-01-20 19:52   ` Stephen Hemminger [this message]
2026-01-20 19:52   ` [PATCH v5 5/6] net/mlx5: fix LTO stringop-overflow warning Stephen Hemminger
2026-02-05 13:43     ` Dariusz Sosnowski
2026-02-05 17:07       ` Stephen Hemminger
2026-01-20 19:52   ` [PATCH v5 6/6] ring: use inline instead of always inline in soring Stephen Hemminger
2026-01-22  9:52     ` Konstantin Ananyev
2026-01-22 10:49       ` Morten Brørup
2026-02-05 17:55   ` [PATCH v6 0/6] Fix LTO compilation warnings Stephen Hemminger
2026-02-05 17:55     ` [PATCH v6 1/6] common/cnxk: replace variable length state array Stephen Hemminger
2026-03-02 19:06       ` [EXTERNAL] " Tejasree Kondoj
2026-03-02 19:36         ` Stephen Hemminger
2026-02-05 17:55     ` [PATCH v6 2/6] common/cnxk: replace variable length array Stephen Hemminger
2026-03-02 10:51       ` [EXTERNAL] " Tejasree Kondoj
2026-02-05 17:55     ` [PATCH v6 3/6] common/cnxk: re-enable vla warnings Stephen Hemminger
2026-03-02 16:50       ` Nithin Dabilpuram
2026-02-05 17:55     ` [PATCH v6 4/6] common/cnxk: fix buffer overflow in SA setup Stephen Hemminger
2026-03-02 16:40       ` Nithin Dabilpuram
2026-02-05 17:55     ` [PATCH v6 5/6] ring: use inline instead of always inline in soring Stephen Hemminger
2026-02-05 17:55     ` [PATCH v6 6/6] net/mlx5: fix LTO stringop-overflow warning Stephen Hemminger
2026-02-06  9:51       ` Dariusz Sosnowski
2026-02-27  7:57     ` [PATCH v6 0/6] Fix LTO compilation warnings David Marchand
2026-03-03 16:24     ` David Marchand

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=20260120195418.466318-5-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=rbhansali@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=stable@dpdk.org \
    /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