From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 594B4A0032 for ; Fri, 18 Feb 2022 13:44:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 53FA740E2D; Fri, 18 Feb 2022 13:44:23 +0100 (CET) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mails.dpdk.org (Postfix) with ESMTP id 8625C41151 for ; Fri, 18 Feb 2022 13:44:22 +0100 (CET) Received: by mail-wm1-f45.google.com with SMTP id az26-20020a05600c601a00b0037c078db59cso6319143wmb.4 for ; Fri, 18 Feb 2022 04:44:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IdbdUzadKQjhQDT0ibPBRhxAIpyQAJBqguySQRf7SiA=; b=imoKKDuUpqUqeABr6nOP9ltcKeltt5aMgizZy1WMyNqAd5XhhiInoskRR78oI6lkwM FK137he+eVIAY+CMCQjTyzKA6/5e5jqMea/c4UR3Txj4rDVP9VIvI+iKskLDgtn4C3Rl 2CEzP0s//JfikEntTuTP4mnA2kWaWjxXhyR4puJeyPN9SWSvkkvg980oZRL1OWLlv5av 7wK/u2zdrvPO0V2xanUpMV6vyGb9jYQsYV3BSzvNABjMSPOACDHF0oniYl63il0a8xEp DnnAt0mfrb25VulZ0mShVQJkGc4X4Qv2kOjUODdJuh1R62bjRB5N5ttoitKJ5cn5mNZH V6Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IdbdUzadKQjhQDT0ibPBRhxAIpyQAJBqguySQRf7SiA=; b=DGiaFA6MI/ohV9SFev90DfaGipa0moieOXK8O8dNiLp0BVUyK7N8djiE7juC66pz2M NVM3P3sBVLd8dzgplfoz8m9AZm6fuIpO5BTfsWcerDBTYgG77A8R0+legoYqt/kpUGNT gPLizzwBYA0J+hDBMpK4XWe6XFgX+9bjfhl6bi2vZ9IvD5dpTnZkAdRkzOdNYEzYs9H5 Rp96nw8WZE8a1JjtNVq2TVAKpU+3Fxt1zHcWv4Y4rCLpLZm7rcsDA8KI5DP3Ku7cLs08 7QqiBzv5FtO3iZbKGQ/wGwMOHPWwA53pmtuTGPw3lStYdJ/c9hCj6vPW+KMLqi29wpQk mmIQ== X-Gm-Message-State: AOAM533VMuUMb5Ao2WMZE2TaAY9m5sycylqzmdBCnC56ipkgCvnQrIP9 Tu2Zh5uLKF+PzCp7RNcPunaYfZtRZVcrYeMb X-Google-Smtp-Source: ABdhPJzfSDzs8JtxLN3hEpPO+gtNF1uX5q0XSqhDDM3wogX0u//QMLcpBQoVLx2FMIJHmpqtP/viVw== X-Received: by 2002:a05:600c:1c1a:b0:37b:ead2:8e6d with SMTP id j26-20020a05600c1c1a00b0037bead28e6dmr10811421wms.94.1645188262292; Fri, 18 Feb 2022 04:44:22 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id c8sm5319654wmq.34.2022.02.18.04.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 04:44:21 -0800 (PST) From: luca.boccassi@gmail.com To: Steve Yang Cc: Aman Singh , Ferruh Yigit , dpdk stable Subject: patch 'app/testpmd: fix stack overflow for EEPROM display' has been queued to stable release 20.11.5 Date: Fri, 18 Feb 2022 12:39:03 +0000 Message-Id: <20220218123931.1749595-94-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218123931.1749595-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 20.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/20/22. 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/58767a90f4b169d62b4e42086473bec562ed3ab7 Thanks. Luca Boccassi --- >From 58767a90f4b169d62b4e42086473bec562ed3ab7 Mon Sep 17 00:00:00 2001 From: Steve Yang Date: Thu, 20 Jan 2022 02:59:31 +0000 Subject: [PATCH] app/testpmd: fix stack overflow for EEPROM display [ upstream commit ff6db8829678396d2d10b3c29744d36149608982 ] When the size of EEPROM exceeds the default thread stack size(8MB), e.g.: 10MB size, it will crash due to stack overflow. Allocate the data of EPPROM information on the heap. Fixes: 6b67721dee2a ("app/testpmd: add EEPROM command") Signed-off-by: Steve Yang Acked-by: Aman Singh Tested-by: Ferruh Yigit --- app/test-pmd/config.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 8e37602f6b..abe2cc394c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -797,10 +797,15 @@ port_eeprom_display(portid_t port_id) return; } - char buf[len_eeprom]; einfo.offset = 0; einfo.length = len_eeprom; - einfo.data = buf; + einfo.data = calloc(1, len_eeprom); + if (!einfo.data) { + fprintf(stderr, + "Allocation of port %u eeprom data failed\n", + port_id); + return; + } ret = rte_eth_dev_get_eeprom(port_id, &einfo); if (ret != 0) { @@ -818,10 +823,12 @@ port_eeprom_display(portid_t port_id) printf("Unable to get EEPROM: %d\n", ret); break; } + free(einfo.data); return; } rte_hexdump(stdout, "hexdump", einfo.data, einfo.length); printf("Finish -- Port: %d EEPROM length: %d bytes\n", port_id, len_eeprom); + free(einfo.data); } void @@ -856,10 +863,15 @@ port_module_eeprom_display(portid_t port_id) return; } - char buf[minfo.eeprom_len]; einfo.offset = 0; einfo.length = minfo.eeprom_len; - einfo.data = buf; + einfo.data = calloc(1, minfo.eeprom_len); + if (!einfo.data) { + fprintf(stderr, + "Allocation of port %u eeprom data failed\n", + port_id); + return; + } ret = rte_eth_dev_get_module_eeprom(port_id, &einfo); if (ret != 0) { @@ -877,11 +889,13 @@ port_module_eeprom_display(portid_t port_id) printf("Unable to get module EEPROM: %d\n", ret); break; } + free(einfo.data); return; } rte_hexdump(stdout, "hexdump", einfo.data, einfo.length); printf("Finish -- Port: %d MODULE EEPROM length: %d bytes\n", port_id, einfo.length); + free(einfo.data); } void -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-18 12:37:41.481428216 +0000 +++ 0094-app-testpmd-fix-stack-overflow-for-EEPROM-display.patch 2022-02-18 12:37:37.822794868 +0000 @@ -1 +1 @@ -From ff6db8829678396d2d10b3c29744d36149608982 Mon Sep 17 00:00:00 2001 +From 58767a90f4b169d62b4e42086473bec562ed3ab7 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit ff6db8829678396d2d10b3c29744d36149608982 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index 1722d6c8f8..e812f57151 100644 +index 8e37602f6b..abe2cc394c 100644 @@ -25 +26 @@ -@@ -912,10 +912,15 @@ port_eeprom_display(portid_t port_id) +@@ -797,10 +797,15 @@ port_eeprom_display(portid_t port_id) @@ -43,2 +44,2 @@ -@@ -933,10 +938,12 @@ port_eeprom_display(portid_t port_id) - fprintf(stderr, "Unable to get EEPROM: %d\n", ret); +@@ -818,10 +823,12 @@ port_eeprom_display(portid_t port_id) + printf("Unable to get EEPROM: %d\n", ret); @@ -56 +57 @@ -@@ -972,10 +979,15 @@ port_module_eeprom_display(portid_t port_id) +@@ -856,10 +863,15 @@ port_module_eeprom_display(portid_t port_id) @@ -74,2 +75,2 @@ -@@ -994,11 +1006,13 @@ port_module_eeprom_display(portid_t port_id) - ret); +@@ -877,11 +889,13 @@ port_module_eeprom_display(portid_t port_id) + printf("Unable to get module EEPROM: %d\n", ret); @@ -87 +88 @@ - int + void