patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Cc: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Pallantla Poornima <pallantlax.poornima@intel.com>,
	Wenwu Ma <wenwux.ma@intel.com>,
	Peng Zhihong <zhihongx.peng@intel.com>,
	Aaron Conole <aconole@redhat.com>,
	Thomas Monjalon <thomas@monjalon.net>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH v3 1/2] test/mempool: fix heap buffer overflow
Date: Tue, 27 Apr 2021 15:56:45 +0200	[thread overview]
Message-ID: <20210427135646.871-1-olivier.matz@6wind.com> (raw)
In-Reply-To: <20210413200513.330399-1-wenwux.ma@intel.com>

The function rte_pktmbuf_init() expects that the mempool private area is
large enough and was previously initialized by rte_pktmbuf_pool_init(),
which is not the case.

This causes the function rte_pktmbuf_priv_size() to return an
unpredictable value, and this value is used as a size in a memset.

Replace the mempool object initializer by my_obj_init(), which does not
have this constraint, and fits the needs for this test.

Fixes: 923ceaeac140 ("test/mempool: add unit test cases")
Cc: stable@dpdk.org

Signed-off-by: Wenwu Ma <wenwux.ma@intel.com>
---
 app/test/test_mempool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 084842fdaa..3adadd6731 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -552,7 +552,7 @@ test_mempool(void)
 		GOTO_ERR(ret, err);
 
 	/* test to initialize mempool objects and memory */
-	nb_objs = rte_mempool_obj_iter(mp_stack_mempool_iter, rte_pktmbuf_init,
+	nb_objs = rte_mempool_obj_iter(mp_stack_mempool_iter, my_obj_init,
 			NULL);
 	if (nb_objs == 0)
 		GOTO_ERR(ret, err);
-- 
2.29.2


  parent reply	other threads:[~2021-04-27 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210331210557.4919-1-wenwux.ma@intel.com>
2021-04-12 14:10 ` [dpdk-stable] [PATCH v1] test/mempool: fix out of memory bound for mempool Wenwu Ma
2021-04-13 20:05 ` [dpdk-stable] [v2] test/mempool: fix heap buffer overflow Wenwu Ma
2021-04-13 11:52   ` Thomas Monjalon
2021-04-15  6:45     ` Olivier Matz
2021-04-15 12:51       ` Aaron Conole
2021-04-16  7:20         ` Olivier Matz
2021-04-27 13:56   ` Olivier Matz [this message]
2021-05-04 18:07     ` [dpdk-stable] [PATCH v3 1/2] " Thomas Monjalon

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=20210427135646.871-1-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=aconole@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=pallantlax.poornima@intel.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=wenwux.ma@intel.com \
    --cc=zhihongx.peng@intel.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;
as well as URLs for NNTP newsgroup(s).