patch 'eal/linux: fix fbarray name collision in containers' has been queued to stable release 23.11.7
Shani Peretz
shperetz at nvidia.com
Tue Mar 31 08:25:01 CEST 2026
Hi,
FYI, your patch has been queued to stable release 23.11.7
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/05/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/shanipr/dpdk-stable
This queued commit can be viewed at:
https://github.com/shanipr/dpdk-stable/commit/88c06ff2d8fb81a4d520286eb97f63fa1b28656d
Thanks.
Shani
---
>From 88c06ff2d8fb81a4d520286eb97f63fa1b28656d Mon Sep 17 00:00:00 2001
From: Congjie Zhou <zcjie0802 at qq.com>
Date: Fri, 13 Feb 2026 14:00:23 -0800
Subject: [PATCH] eal/linux: fix fbarray name collision in containers
[ upstream commit 9b1eae94b3e40b5829b36a30f1d07b79899224ce ]
When multiple secondary processes run in different containers that
share the same hugetlbfs mount, the fbarray names can collide.
This happens because containers use separate PID namespaces, so
different processes in different containers can have the same PID.
Fix by replacing the PID with a timestamp-based value. The TSC
(timestamp counter) provides sufficient uniqueness since containers
starting at the same CPU cycle is practically impossible - even 1ms
of startup time difference means millions of cycles apart at GHz
frequencies.
Also, reduce the name buffer from PATH_MAX to RTE_FBARRAY_NAME_LEN
since it is only used for the fbarray name.
Fixes: 524e43c2ad9a ("mem: prepare memseg lists for multiprocess sync")
Signed-off-by: Congjie Zhou <zcjie0802 at qq.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
.mailmap | 1 +
lib/eal/linux/eal_memalloc.c | 26 ++++++++++++++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/.mailmap b/.mailmap
index 30b72846ad..37a31f67cd 100644
--- a/.mailmap
+++ b/.mailmap
@@ -264,6 +264,7 @@ Ciara Power <ciara.power at intel.com>
Claire Murphy <claire.k.murphy at intel.com>
Clemens Famulla-Conrad <cfamullaconrad at suse.com>
Cody Doucette <doucette at bu.edu>
+Congjie Zhou <zcjie0802 at qq.com>
Congwen Zhang <zhang.congwen at zte.com.cn>
Conor Fogarty <conor.fogarty at intel.com>
Conor Walsh <conor.walsh at intel.com>
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index b9fc83fe6a..1c81a0e286 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -31,6 +32,7 @@
#include <rte_log.h>
#include <rte_eal.h>
#include <rte_memory.h>
+#include <rte_cycles.h>
#include "eal_filesystem.h"
#include "eal_internal_cfg.h"
@@ -1436,8 +1438,10 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
{
struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
struct rte_memseg_list *primary_msl, *local_msl;
- char name[PATH_MAX];
+ char name[RTE_FBARRAY_NAME_LEN];
int msl_idx, ret;
+ uint64_t tsc;
+ pid_t pid;
if (msl->external)
return 0;
@@ -1446,9 +1450,23 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
primary_msl = &mcfg->memsegs[msl_idx];
local_msl = &local_memsegs[msl_idx];
- /* create distinct fbarrays for each secondary */
- snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
- primary_msl->memseg_arr.name, getpid());
+ /*
+ * Create distinct fbarrays for each secondary using TSC for uniqueness,
+ * since PID is not unique across containers (different PID namespaces).
+ * The worst case name length is:
+ * Base name: "memseg-1048576k-99-99" ~21 chars
+ * Suffix "_<pid>_<16hex>" +24
+ * Total = ~45 < RTE_FBARRAY_NAME_LEN 64
+ */
+ tsc = rte_get_tsc_cycles();
+ pid = getpid();
+ ret = snprintf(name, sizeof(name), "%s_%d_%"PRIx64,
+ primary_msl->memseg_arr.name, pid, tsc);
+ if (ret >= (int)sizeof(name)) {
+ RTE_LOG(ERR, EAL, "fbarray name \"%s_%d_%"PRIx64"\" is too long\n",
+ primary_msl->memseg_arr.name, pid, tsc);
+ return -1;
+ }
ret = rte_fbarray_init(&local_msl->memseg_arr, name,
primary_msl->memseg_arr.len,
--
2.43.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-03-31 00:32:37.554532309 +0300
+++ 0102-eal-linux-fix-fbarray-name-collision-in-containers.patch 2026-03-31 00:32:29.815324000 +0300
@@ -1 +1 @@
-From 9b1eae94b3e40b5829b36a30f1d07b79899224ce Mon Sep 17 00:00:00 2001
+From 88c06ff2d8fb81a4d520286eb97f63fa1b28656d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 9b1eae94b3e40b5829b36a30f1d07b79899224ce ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -27,2 +28,2 @@
- lib/eal/linux/eal_memalloc.c | 27 ++++++++++++++++++++-------
- 2 files changed, 21 insertions(+), 7 deletions(-)
+ lib/eal/linux/eal_memalloc.c | 26 ++++++++++++++++++++++----
+ 2 files changed, 23 insertions(+), 4 deletions(-)
@@ -31 +32 @@
-index 8bbfcc1703..1a587eb4fb 100644
+index 30b72846ad..37a31f67cd 100644
@@ -34 +35 @@
-@@ -293,6 +293,7 @@ Ciara Power <ciara.power at intel.com>
+@@ -264,6 +264,7 @@ Ciara Power <ciara.power at intel.com>
@@ -43 +44 @@
-index 4dee224ac5..a39bc31c7b 100644
+index b9fc83fe6a..1c81a0e286 100644
@@ -54 +55 @@
-@@ -28,6 +29,7 @@
+@@ -31,6 +32,7 @@
@@ -62 +63 @@
-@@ -1387,8 +1389,10 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
+@@ -1436,8 +1438,10 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
@@ -74 +75 @@
-@@ -1397,12 +1401,21 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
+@@ -1446,9 +1450,23 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
@@ -79 +80 @@
-- ret = snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
+- snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
@@ -81,3 +81,0 @@
-- if (ret >= RTE_FBARRAY_NAME_LEN) {
-- EAL_LOG(ERR, "fbarray name %s_%i is too long",
-- primary_msl->memseg_arr.name, getpid());
@@ -97 +95 @@
-+ EAL_LOG(ERR, "fbarray name \"%s_%d_%"PRIx64"\" is too long",
++ RTE_LOG(ERR, EAL, "fbarray name \"%s_%d_%"PRIx64"\" is too long\n",
@@ -99,2 +97,2 @@
- return -1;
- }
++ return -1;
++ }
@@ -101,0 +100,2 @@
+ ret = rte_fbarray_init(&local_msl->memseg_arr, name,
+ primary_msl->memseg_arr.len,
More information about the stable
mailing list