patch 'mem: fix data race in Linux hugepage prefault' has been queued to stable release 25.11.3

Kevin Traynor ktraynor at redhat.com
Thu Jul 23 19:15:38 CEST 2026


Hi,

FYI, your patch has been queued to stable release 25.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/27/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/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/49b7fcb174a56209fb3eb9012389141bf4231c97

Thanks.

Kevin

---
>From 49b7fcb174a56209fb3eb9012389141bf4231c97 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Mon, 1 Jun 2026 09:00:18 -0700
Subject: [PATCH] mem: fix data race in Linux hugepage prefault

[ upstream commit 0c0f70f98dcf5b860b2e422ad20f40cc9f1d3705 ]

The prefault step in alloc_seg() reads a value from the hugepage and
writes it back unchanged to force the kernel to commit the backing
page. The read and write were not atomic, which races with concurrent
access to the same physical page from a secondary process attaching
to the hugetlbfs-backed mapping during rte_eal_init().

Replace the non-atomic load+store with a single atomic fetch-or of
zero. This touches the page with an atomic read-modify-write without
changing its contents, eliminating the race while preserving the
original intent of forcing a write fault.

Fixes: 0f1631be24bd ("mem: fix page fault trigger")

Reported-by: Michal Sieron <michal.sieron at nokia.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 .mailmap                     | 1 +
 lib/eal/linux/eal_memalloc.c | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.mailmap b/.mailmap
index 974e93d4f3..51dda31a3d 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1089,4 +1089,5 @@ Michal Michalik <michal.michalik at intel.com>
 Michal Nowak <michal2.nowak at intel.com>
 Michal Schmidt <mschmidt at redhat.com>
+Michal Sieron <michal.sieron at nokia.com>
 Michal Swiatkowski <michal.swiatkowski at intel.com>
 Michal Wilczynski <michal.wilczynski at intel.com>
diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c
index 57fb40deb0..fb66d14376 100644
--- a/lib/eal/linux/eal_memalloc.c
+++ b/lib/eal/linux/eal_memalloc.c
@@ -26,4 +26,5 @@
 #include <linux/mman.h> /* for hugetlb-related mmap flags */
 
+#include <rte_atomic.h>
 #include <rte_common.h>
 #include <rte_log.h>
@@ -591,8 +592,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
 	/* we need to trigger a write to the page to enforce page fault and
 	 * ensure that page is accessible to us, but we can't overwrite value
-	 * that is already there, so read the old value, and write itback.
-	 * kernel populates the page with zeroes initially.
+	 * that is already there.
+	 * Use an atomic OR with zero to touch the page without changing its contents.
 	 */
-	*(volatile int *)addr = *(volatile int *)addr;
+	(void)rte_atomic_fetch_or_explicit((__rte_atomic uint64_t *)addr, 0,
+					   rte_memory_order_relaxed);
 
 	iova = rte_mem_virt2iova(addr);
-- 
2.55.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-07-23 17:58:00.806796701 +0100
+++ 0075-mem-fix-data-race-in-Linux-hugepage-prefault.patch	2026-07-23 17:57:58.688918545 +0100
@@ -1 +1 @@
-From 0c0f70f98dcf5b860b2e422ad20f40cc9f1d3705 Mon Sep 17 00:00:00 2001
+From 49b7fcb174a56209fb3eb9012389141bf4231c97 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 0c0f70f98dcf5b860b2e422ad20f40cc9f1d3705 ]
+
@@ -18 +19,0 @@
-Cc: stable at dpdk.org
@@ -28 +29 @@
-index 118dfa0ff9..364e027894 100644
+index 974e93d4f3..51dda31a3d 100644
@@ -31 +32 @@
-@@ -1095,4 +1095,5 @@ Michal Michalik <michal.michalik at intel.com>
+@@ -1089,4 +1089,5 @@ Michal Michalik <michal.michalik at intel.com>
@@ -38 +39 @@
-index a39bc31c7b..7359a41d3f 100644
+index 57fb40deb0..fb66d14376 100644
@@ -47 +48 @@
-@@ -598,8 +599,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,
+@@ -591,8 +592,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id,



More information about the stable mailing list