DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/test: fix stack overflow in lpm6_perf_autotest
@ 2024-12-13  2:39 Andre Muezerie
  2024-12-13 10:22 ` Medvedkin, Vladimir
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andre Muezerie @ 2024-12-13  2:39 UTC (permalink / raw)
  To: Bruce Richardson, Vladimir Medvedkin; +Cc: dev, Andre Muezerie

Test lpm6_perf_autotest was hitting a stack overflow on Windows
with both MSVC and Clang.

The fix is to move some of the data from the stack to the heap.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 app/test/test_lpm6_perf.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c
index 1860a99ed6..8231ad825d 100644
--- a/app/test/test_lpm6_perf.c
+++ b/app/test/test_lpm6_perf.c
@@ -117,8 +117,12 @@ test_lpm6_perf(void)
 	total_time = 0;
 	count = 0;
 
-	struct rte_ipv6_addr ip_batch[NUM_IPS_ENTRIES];
-	int32_t next_hops[NUM_IPS_ENTRIES];
+	struct rte_ipv6_addr *ip_batch = (struct rte_ipv6_addr *)malloc(
+			sizeof(struct rte_ipv6_addr) * NUM_IPS_ENTRIES);
+	TEST_LPM_ASSERT(ip_batch != NULL);
+
+	int32_t *next_hops = (int32_t *)malloc(sizeof(int32_t) * NUM_IPS_ENTRIES);
+	TEST_LPM_ASSERT(next_hops != NULL);
 
 	for (i = 0; i < NUM_IPS_ENTRIES; i++)
 		ip_batch[i] = large_ips_table[i].ip;
@@ -153,6 +157,9 @@ test_lpm6_perf(void)
 	printf("Average LPM Delete: %g cycles\n",
 			(double)total_time / NUM_ROUTE_ENTRIES);
 
+	free(next_hops);
+	free(ip_batch);
+
 	rte_lpm6_delete_all(lpm);
 	rte_lpm6_free(lpm);
 
-- 
2.47.0.vfs.0.3


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-18 15:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13  2:39 [PATCH] app/test: fix stack overflow in lpm6_perf_autotest Andre Muezerie
2024-12-13 10:22 ` Medvedkin, Vladimir
2024-12-13 17:05   ` Andre Muezerie
2024-12-13 17:08   ` Stephen Hemminger
2024-12-13 17:08 ` [PATCH v2] " Andre Muezerie
2024-12-13 17:15   ` Stephen Hemminger
2024-12-18 15:12     ` Andre Muezerie
2024-12-18 15:21 ` [PATCH v3] " Andre Muezerie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).