patch 'eal/linux: fix fbarray name collision in containers' has been queued to stable release 24.11.5
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Fri Feb 20 15:56:52 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/22/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/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/b8f14f89d3c08e731a6b92b20bf7911bc3cd0715
Thanks.
Luca Boccassi
---
>From b8f14f89d3c08e731a6b92b20bf7911bc3cd0715 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 | 27 ++++++++++++++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/.mailmap b/.mailmap
index 992e96ca72..bb1ca48db2 100644
--- a/.mailmap
+++ b/.mailmap
@@ -281,6 +281,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 1c72b02b1b..4239aedc85 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,12 +1450,21 @@ 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 */
- ret = snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
- primary_msl->memseg_arr.name, getpid());
- if (ret >= RTE_FBARRAY_NAME_LEN) {
- EAL_LOG(ERR, "fbarray name %s_%i is too long",
- 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)) {
+ EAL_LOG(ERR, "fbarray name \"%s_%d_%"PRIx64"\" is too long",
+ primary_msl->memseg_arr.name, pid, tsc);
return -1;
}
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-02-20 14:55:47.406675425 +0000
+++ 0110-eal-linux-fix-fbarray-name-collision-in-containers.patch 2026-02-20 14:55:43.376193990 +0000
@@ -1 +1 @@
-From 9b1eae94b3e40b5829b36a30f1d07b79899224ce Mon Sep 17 00:00:00 2001
+From b8f14f89d3c08e731a6b92b20bf7911bc3cd0715 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 9b1eae94b3e40b5829b36a30f1d07b79899224ce ]
+
@@ -21 +22,0 @@
-Cc: stable at dpdk.org
@@ -31 +32 @@
-index 8bbfcc1703..1a587eb4fb 100644
+index 992e96ca72..bb1ca48db2 100644
@@ -34 +35 @@
-@@ -293,6 +293,7 @@ Ciara Power <ciara.power at intel.com>
+@@ -281,6 +281,7 @@ Ciara Power <ciara.power at intel.com>
@@ -43 +44 @@
-index 4dee224ac5..a39bc31c7b 100644
+index 1c72b02b1b..4239aedc85 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,12 +1450,21 @@ secondary_msl_create_walk(const struct rte_memseg_list *msl,
More information about the stable
mailing list