[dpdk-stable] patch 'mem: fix undefined behavior in NUMA-aware mapping' has been queued to stable release 18.08.1
Kevin Traynor
ktraynor at redhat.com
Wed Nov 21 17:47:26 CET 2018
Hi,
FYI, your patch has been queued to stable release 18.08.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/27/18. 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. If the code is different (ie: not only metadata diffs), due for example to
a change in context or macro names, please double check it.
Thanks.
Kevin Traynor
---
>From 2e003e3e3bd3bed9bdf5235349106bdb9d14dd01 Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Fri, 21 Sep 2018 10:27:22 +0100
Subject: [PATCH] mem: fix undefined behavior in NUMA-aware mapping
[ upstream commit b1621823eacbe4669a4b581d6c420db08f9e6505 ]
When NUMA-aware hugepages config option is set, we rely on
libnuma to tell the kernel to allocate hugepages on a specific
NUMA node. However, we allocate node mask before we check if
NUMA is available in the first place, which, according to
the manpage [1], causes undefined behaviour.
Fix by only using nodemask when we have NUMA available.
[1] https://linux.die.net/man/3/numa_alloc_onnode
Bugzilla ID: 20
Fixes: 1b72605d2416 ("mem: balanced allocation of hugepages")
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Ilya Maximets <i.maximets at samsung.com>
---
lib/librte_eal/linuxapp/eal/eal_memory.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
index dbf19499e..7747ee6df 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
@@ -264,5 +264,5 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
int essential_prev = 0;
int oldpolicy;
- struct bitmask *oldmask = numa_allocate_nodemask();
+ struct bitmask *oldmask = NULL;
bool have_numa = true;
unsigned long maxnode = 0;
@@ -276,4 +276,5 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
if (have_numa) {
RTE_LOG(DEBUG, EAL, "Trying to obtain current memory policy.\n");
+ oldmask = numa_allocate_nodemask();
if (get_mempolicy(&oldpolicy, oldmask->maskp,
oldmask->size + 1, 0, 0) < 0) {
@@ -403,5 +404,6 @@ out:
}
}
- numa_free_cpumask(oldmask);
+ if (oldmask != NULL)
+ numa_free_cpumask(oldmask);
#endif
return i;
--
2.19.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2018-11-21 16:44:31.260841932 +0000
+++ 0012-mem-fix-undefined-behavior-in-NUMA-aware-mapping.patch 2018-11-21 16:44:30.000000000 +0000
@@ -1,8 +1,10 @@
-From b1621823eacbe4669a4b581d6c420db08f9e6505 Mon Sep 17 00:00:00 2001
+From 2e003e3e3bd3bed9bdf5235349106bdb9d14dd01 Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Fri, 21 Sep 2018 10:27:22 +0100
Subject: [PATCH] mem: fix undefined behavior in NUMA-aware mapping
+[ upstream commit b1621823eacbe4669a4b581d6c420db08f9e6505 ]
+
When NUMA-aware hugepages config option is set, we rely on
libnuma to tell the kernel to allocate hugepages on a specific
NUMA node. However, we allocate node mask before we check if
@@ -15,7 +17,6 @@
Bugzilla ID: 20
Fixes: 1b72605d2416 ("mem: balanced allocation of hugepages")
-Cc: stable at dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Ilya Maximets <i.maximets at samsung.com>
@@ -24,23 +25,23 @@
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
-index e3ac24815..78bfa2241 100644
+index dbf19499e..7747ee6df 100644
--- a/lib/librte_eal/linuxapp/eal/eal_memory.c
+++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
-@@ -265,5 +265,5 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
+@@ -264,5 +264,5 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
int essential_prev = 0;
int oldpolicy;
- struct bitmask *oldmask = numa_allocate_nodemask();
+ struct bitmask *oldmask = NULL;
bool have_numa = true;
unsigned long maxnode = 0;
-@@ -277,4 +277,5 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
+@@ -276,4 +276,5 @@ map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,
if (have_numa) {
RTE_LOG(DEBUG, EAL, "Trying to obtain current memory policy.\n");
+ oldmask = numa_allocate_nodemask();
if (get_mempolicy(&oldpolicy, oldmask->maskp,
oldmask->size + 1, 0, 0) < 0) {
-@@ -404,5 +405,6 @@ out:
+@@ -403,5 +404,6 @@ out:
}
}
- numa_free_cpumask(oldmask);
More information about the stable
mailing list