patch 'test/mbuf: fix crash in a forked process' has been queued to stable release 22.11.3
Xueming Li
xuemingl at nvidia.com
Sun Jun 25 08:35:41 CEST 2023
Hi,
FYI, your patch has been queued to stable release 22.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 06/27/23. 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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=55fbb9de8dd932518cccc95bdee011adfcdf2c32
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 55fbb9de8dd932518cccc95bdee011adfcdf2c32 Mon Sep 17 00:00:00 2001
From: Ruifeng Wang <ruifeng.wang at arm.com>
Date: Mon, 22 May 2023 14:01:37 +0800
Subject: [PATCH] test/mbuf: fix crash in a forked process
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit b6c419dde10e9f5dec7a02098c48060a7493420c ]
Access of any memory in the hugepage shared file-backed area will trigger
an unexpected forked child process segment fault. The root cause is DPDK
doesn't support fork model [1] (calling rte_eal_init() before fork()).
Forked child process can't be treated as a secondary process.
Hence fix it by avoiding fork and doing verification in the main process.
[1] https://mails.dpdk.org/archives/dev/2018-July/108106.html
Fixes: af75078fece3 ("first public release")
Signed-off-by: Jia He <justin.he at arm.com>
Signed-off-by: Ruifeng Wang <ruifeng.wang at arm.com>
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
---
app/test/test_mbuf.c | 50 +++++++++++++-------------------------------
1 file changed, 14 insertions(+), 36 deletions(-)
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index 1f4dd62466..7a2f8a9980 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -1167,38 +1167,16 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
return TEST_SKIPPED;
}
#else
-
-#include <unistd.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-#include <sys/wait.h>
-
-/* use fork() to test mbuf errors panic */
-static int
-verify_mbuf_check_panics(struct rte_mbuf *buf)
+/* Verify if mbuf can pass the check */
+static bool
+mbuf_check_pass(struct rte_mbuf *buf)
{
- int pid;
- int status;
+ const char *reason;
- pid = fork();
+ if (rte_mbuf_check(buf, 1, &reason) == 0)
+ return true;
- if (pid == 0) {
- struct rlimit rl;
-
- /* No need to generate a coredump when panicking. */
- rl.rlim_cur = rl.rlim_max = 0;
- setrlimit(RLIMIT_CORE, &rl);
- rte_mbuf_sanity_check(buf, 1); /* should panic */
- exit(0); /* return normally if it doesn't panic */
- } else if (pid < 0) {
- printf("Fork Failed\n");
- return -1;
- }
- wait(&status);
- if(status == 0)
- return -1;
-
- return 0;
+ return false;
}
static int
@@ -1215,19 +1193,19 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
return -1;
printf("Checking good mbuf initially\n");
- if (verify_mbuf_check_panics(buf) != -1)
+ if (!mbuf_check_pass(buf))
return -1;
printf("Now checking for error conditions\n");
- if (verify_mbuf_check_panics(NULL)) {
+ if (mbuf_check_pass(NULL)) {
printf("Error with NULL mbuf test\n");
return -1;
}
badbuf = *buf;
badbuf.pool = NULL;
- if (verify_mbuf_check_panics(&badbuf)) {
+ if (mbuf_check_pass(&badbuf)) {
printf("Error with bad-pool mbuf test\n");
return -1;
}
@@ -1235,7 +1213,7 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
if (RTE_IOVA_AS_PA) {
badbuf = *buf;
rte_mbuf_iova_set(&badbuf, 0);
- if (verify_mbuf_check_panics(&badbuf)) {
+ if (mbuf_check_pass(&badbuf)) {
printf("Error with bad-physaddr mbuf test\n");
return -1;
}
@@ -1243,21 +1221,21 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool)
badbuf = *buf;
badbuf.buf_addr = NULL;
- if (verify_mbuf_check_panics(&badbuf)) {
+ if (mbuf_check_pass(&badbuf)) {
printf("Error with bad-addr mbuf test\n");
return -1;
}
badbuf = *buf;
badbuf.refcnt = 0;
- if (verify_mbuf_check_panics(&badbuf)) {
+ if (mbuf_check_pass(&badbuf)) {
printf("Error with bad-refcnt(0) mbuf test\n");
return -1;
}
badbuf = *buf;
badbuf.refcnt = UINT16_MAX;
- if (verify_mbuf_check_panics(&badbuf)) {
+ if (mbuf_check_pass(&badbuf)) {
printf("Error with bad-refcnt(MAX) mbuf test\n");
return -1;
}
--
2.25.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2023-06-25 14:32:01.762868000 +0800
+++ 0123-test-mbuf-fix-crash-in-a-forked-process.patch 2023-06-25 14:31:58.585773900 +0800
@@ -1 +1 @@
-From b6c419dde10e9f5dec7a02098c48060a7493420c Mon Sep 17 00:00:00 2001
+From 55fbb9de8dd932518cccc95bdee011adfcdf2c32 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit b6c419dde10e9f5dec7a02098c48060a7493420c ]
@@ -16 +18,0 @@
-Cc: stable at dpdk.org
@@ -26 +28 @@
-index 8d8d3b9386..efac01806b 100644
+index 1f4dd62466..7a2f8a9980 100644
@@ -99 +101 @@
- if (RTE_IOVA_IN_MBUF) {
+ if (RTE_IOVA_AS_PA) {
More information about the stable
mailing list