patch 'telemetry: fix autotest on Alpine' has been queued to stable release 20.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Jun 15 03:32:03 CEST 2023


Hi,

FYI, your patch has been queued to stable release 20.11.9

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/17/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://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/fa193cc3a43f7e495c174bc245686f8f117680ee

Thanks.

Luca Boccassi

---
>From fa193cc3a43f7e495c174bc245686f8f117680ee Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Wed, 5 Apr 2023 17:03:22 +0100
Subject: [PATCH] telemetry: fix autotest on Alpine

[ upstream commit 6ffce64857216344f02ee88d92cb69ee241b3c7b ]

On Alpine linux, the telemetry_data_autotest was failing for the
test where we had dictionaries embedded in other dictionaries up
to three levels deep. Indications are that this issue is due to
excess data being stored on the stack, so replace stack-allocated
buffer data with dynamically allocated data in the case where we
are doing recursive processing of telemetry data structures into
json.

Bugzilla ID: 1177
Fixes: c933bb5177ca ("telemetry: support array values in data object")
Fixes: d2671e642a8e ("telemetry: support dict of dicts")

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
 lib/librte_telemetry/telemetry.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c
index ed00c17d9f..3f80d72c3f 100644
--- a/lib/librte_telemetry/telemetry.c
+++ b/lib/librte_telemetry/telemetry.c
@@ -217,7 +217,11 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
 				break;
 			case RTE_TEL_CONTAINER:
 			{
-				char temp[buf_len];
+				char *temp = malloc(buf_len);
+				if (temp == NULL)
+					break;
+				*temp = '\0';  /* ensure valid string */
+
 				const struct container *cont =
 						&v->value.container;
 				if (container_to_json(cont->data,
@@ -228,6 +232,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
 							v->name, temp);
 				if (!cont->keep)
 					rte_tel_data_free(cont->data);
+				free(temp);
 			}
 			}
 		}
@@ -259,7 +264,11 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
 						buf_len, used,
 						d->data.array[i].u64val);
 			else if (d->type == RTE_TEL_ARRAY_CONTAINER) {
-				char temp[buf_len];
+				char *temp = malloc(buf_len);
+				if (temp == NULL)
+					break;
+				*temp = '\0';  /* ensure valid string */
+
 				const struct container *rec_data =
 						&d->data.array[i].container;
 				if (container_to_json(rec_data->data,
@@ -269,6 +278,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
 							buf_len, used, temp);
 				if (!rec_data->keep)
 					rte_tel_data_free(rec_data->data);
+				free(temp);
 			}
 		used += prefix_used;
 		used += strlcat(out_buf + used, "}", sizeof(out_buf) - used);
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-06-15 01:56:35.175810405 +0100
+++ 0008-telemetry-fix-autotest-on-Alpine.patch	2023-06-15 01:56:34.499539817 +0100
@@ -1 +1 @@
-From 6ffce64857216344f02ee88d92cb69ee241b3c7b Mon Sep 17 00:00:00 2001
+From fa193cc3a43f7e495c174bc245686f8f117680ee Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 6ffce64857216344f02ee88d92cb69ee241b3c7b ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
@@ -22,2 +23,2 @@
- lib/telemetry/telemetry.c | 21 ++++++++++++++++++---
- 1 file changed, 18 insertions(+), 3 deletions(-)
+ lib/librte_telemetry/telemetry.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
@@ -25,26 +26,5 @@
-diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
-index deba7f34a3..590720bfa6 100644
---- a/lib/telemetry/telemetry.c
-+++ b/lib/telemetry/telemetry.c
-@@ -208,7 +208,11 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len)
- 				break;
- 			case RTE_TEL_CONTAINER:
- 			{
--				char temp[buf_len];
-+				char *temp = malloc(buf_len);
-+				if (temp == NULL)
-+					break;
-+				*temp = '\0';  /* ensure valid string */
-+
- 				const struct container *cont =
- 						&v->value.container;
- 				if (container_to_json(cont->data,
-@@ -219,6 +223,7 @@ container_to_json(const struct rte_tel_data *d, char *out_buf, size_t buf_len)
- 							v->name, temp);
- 				if (!cont->keep)
- 					rte_tel_data_free(cont->data);
-+				free(temp);
- 				break;
- 			}
- 			}
-@@ -275,7 +280,11 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
+diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c
+index ed00c17d9f..3f80d72c3f 100644
+--- a/lib/librte_telemetry/telemetry.c
++++ b/lib/librte_telemetry/telemetry.c
+@@ -217,7 +217,11 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
@@ -63 +43 @@
-@@ -286,6 +295,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
+@@ -228,6 +232,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
@@ -71 +51 @@
-@@ -311,7 +321,11 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
+@@ -259,7 +264,11 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
@@ -73,2 +53,2 @@
- 						d->data.array[i].uval);
- 			else if (d->type == TEL_ARRAY_CONTAINER) {
+ 						d->data.array[i].u64val);
+ 			else if (d->type == RTE_TEL_ARRAY_CONTAINER) {
@@ -84 +64 @@
-@@ -321,6 +335,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
+@@ -269,6 +278,7 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s)
@@ -90,2 +70,2 @@
- 		break;
- 	}
+ 		used += prefix_used;
+ 		used += strlcat(out_buf + used, "}", sizeof(out_buf) - used);


More information about the stable mailing list