patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Olivier Matz <>
To: Thomas Monjalon <>
Cc: Wenwu Ma <>,,,,,
Subject: Re: [dpdk-stable] [v2] test/mempool: fix heap buffer overflow
Date: Thu, 15 Apr 2021 08:45:21 +0200
Message-ID: <20210415064521.GE1650@platinum> (raw)
In-Reply-To: <2483269.apo0RDFAAg@thomas>

On Tue, Apr 13, 2021 at 01:52:26PM +0200, Thomas Monjalon wrote:
> 13/04/2021 22:05, Wenwu Ma:
> > Amount of allocated memory was not enough for mempool
> > which cause buffer overflow when access fields of mempool
> > private structure in the rte_pktmbuf_priv_size function.
> Was it causing the test to fail?
> How do you reproduce the overflow?

In the test, right after the rte_mempool_create(), the function
rte_mempool_obj_iter() is called too initialize the mempool objects with
the rte_pktmbuf_init() callback function. This callback expects that the
mempool is a packet pool, i.e. its private area is a struct
rte_pktmbuf_pool_private structure.

In the current test, the size of the private area is 0, which probably
causes the function rte_pktmbuf_priv_size() to return an unpredictable
value, and this value is used as a size in a memset.

This part of the test was added in commit 923ceaeac140 ("test/mempool:
add unit test cases").

Instead of changing the size of the private area like done in the patch,
I suggest to use another callback than rte_pktmbuf_init(). After all,
this is a mempool test, so we should not rely on mbuf features. The
function my_obj_init() could be used like in other places of the test,
like this:

  @@ -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,
  	 if (nb_objs == 0)
  		 GOTO_ERR(ret, err);

Wenwu, does it solve your issue?


  reply	other threads:[~2021-04-15  6:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
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 [this message]
2021-04-15 12:51       ` Aaron Conole
2021-04-16  7:20         ` Olivier Matz
2021-04-27 13:56   ` [dpdk-stable] [PATCH v3 1/2] " Olivier Matz
2021-05-04 18:07     ` Thomas Monjalon
2021-04-13 20:03 [dpdk-stable] [v2] " Wenwu Ma
  -- strict thread matches above, loose matches on Subject: below --
2021-04-13 19:22 Wenwu Ma

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210415064521.GE1650@platinum \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ \
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone