From: Robert Sanford <rsanford2@gmail.com>
To: dev@dpdk.org
Cc: andrew.rybchenko@oktetlabs.ru, mb@smartsharesystems.com,
olivier.matz@6wind.com, Robert Sanford <rsanford@akamai.com>
Subject: [PATCH v1 0/3] mempool: fix races between list walk and create/free
Date: Mon, 2 Nov 2026 20:11:04 -0500 [thread overview]
Message-ID: <20261103011107.3658840-1-rsanford2@gmail.com> (raw)
From: Robert Sanford <rsanford@akamai.com>
A thread walking the mempool list with rte_mempool_walk(),
rte_mempool_lookup() or rte_mempool_list_dump() can crash while other
threads create and free mempools. We hit this in production, in a
process that walks the mempools while other threads create and free
them.
There are two races:
- rte_mempool_free() unlinks and frees the list entry without the
mempool list lock that the walkers hold, so a walker can reach a
freed entry or mempool. Patch 1 takes the lock in rte_mempool_free(),
as rte_mempool_create_empty() already does. A rte_mempool_walk()
callback can therefore no longer free a mempool; this is documented.
- A mempool is on the list before its store exists, and walking or
dumping it reads the store. Patch 2 skips mempools without
RTE_MEMPOOL_F_POOL_CREATED in rte_mempool_walk() and
rte_mempool_list_dump(). The release/acquire fences it adds generate
no instructions on x86.
Patch 3 adds a test to mempool_autotest. On x86 with 4 or 8 lcores,
it crashed in all 20 runs without patch 1, without patch 2, or
without both, and passed in all 20 runs with both patches.
Robert Sanford (3):
mempool: fix race between list walk and free
mempool: skip unpopulated pools in walk and dump
test/mempool: add list walk race test
app/test/test_mempool.c | 137 ++++++++++++++++++++++++++++++++++++++
lib/mempool/rte_mempool.c | 28 +++++++-
lib/mempool/rte_mempool.h | 6 ++
3 files changed, 170 insertions(+), 1 deletion(-)
--
2.34.1
next reply other threads:[~2026-11-03 1:11 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 1:11 Robert Sanford [this message]
2026-11-03 1:11 ` [PATCH v1 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-03 13:54 ` Morten Brørup
2026-11-03 1:11 ` [PATCH v1 2/3] mempool: skip unpopulated pools in walk and dump Robert Sanford
2026-11-03 14:12 ` Morten Brørup
2026-11-03 1:11 ` [PATCH v1 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-03 14:15 ` Morten Brørup
2026-11-03 17:35 ` [PATCH v2 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-03 17:35 ` [PATCH v2 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-03 17:35 ` [PATCH v2 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-06 8:43 ` Morten Brørup
2026-11-06 18:43 ` Robert Sanford
2026-11-06 19:24 ` Morten Brørup
2026-11-03 17:35 ` [PATCH v2 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-09 14:40 ` [PATCH v3 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-09 14:40 ` [PATCH v3 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-09 14:40 ` [PATCH v3 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-09 14:40 ` [PATCH v3 3/3] test/mempool: add list walk race test Robert Sanford
2026-11-11 13:00 ` Morten Brørup
2026-11-12 15:43 ` [PATCH v4 0/3] mempool: fix races between list walk and create/free Robert Sanford
2026-11-12 15:43 ` [PATCH v4 1/3] mempool: fix race between list walk and free Robert Sanford
2026-11-12 15:43 ` [PATCH v4 2/3] mempool: fix dump of unpopulated pool Robert Sanford
2026-11-12 15:43 ` [PATCH v4 3/3] test/mempool: add list walk race test Robert Sanford
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=20261103011107.3658840-1-rsanford2@gmail.com \
--to=rsanford2@gmail.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=olivier.matz@6wind.com \
--cc=rsanford@akamai.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