From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 8EAE0A3 for ; Fri, 8 Mar 2019 18:49:17 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 8 Mar 2019 19:49:12 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x28HloB5002625; Fri, 8 Mar 2019 19:49:11 +0200 From: Yongseok Koh To: Anatoly Burakov Cc: dpdk stable Date: Fri, 8 Mar 2019 09:47:27 -0800 Message-Id: <20190308174749.30771-49-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190308174749.30771-1-yskoh@mellanox.com> References: <20190308174749.30771-1-yskoh@mellanox.com> Subject: [dpdk-stable] patch 'eal: check string parameter lengths' has been queued to LTS release 17.11.6 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Mar 2019 17:49:17 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objection by 03/13/19. So please shout if anyone has objection. 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. Yongseok --- >>From 11dabc416169e52ee79731bd6ab920036df0e2f3 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Wed, 16 Jan 2019 12:12:53 +0000 Subject: [PATCH] eal: check string parameter lengths [ backported from upstream commit 2383d8e909275b072145c7addf826e9c8edb6232 ] When specifying parameters such as hugefile prefix from the command-line, it is possibly to supply an empty string. This may lead to various problems: for example, if hugefile prefix is empty, the runtime config path construction may end up looking like "/var/run/dpdk//_config", which will technically work, but is wrong and places files in the wrong place. To fix it, check lengths of such user-specified parameters for hugefile prefix, as well as hugepage dir and user-specified mbuf pool ops string. Signed-off-by: Anatoly Burakov --- lib/librte_eal/common/eal_common_options.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index d91104dc0..a3d4d346b 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -1242,6 +1242,16 @@ eal_check_common_options(struct internal_config *internal_cfg) RTE_LOG(ERR, EAL, "Invalid process type specified\n"); return -1; } + if (internal_cfg->hugefile_prefix != NULL && + strlen(internal_cfg->hugefile_prefix) < 1) { + RTE_LOG(ERR, EAL, "Invalid length of --" OPT_FILE_PREFIX " option\n"); + return -1; + } + if (internal_cfg->hugepage_dir != NULL && + strlen(internal_cfg->hugepage_dir) < 1) { + RTE_LOG(ERR, EAL, "Invalid length of --" OPT_HUGE_DIR" option\n"); + return -1; + } if (index(internal_cfg->hugefile_prefix, '%') != NULL) { RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" " "option\n"); -- 2.11.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-03-08 09:46:42.650470157 -0800 +++ 0049-eal-check-string-parameter-lengths.patch 2019-03-08 09:46:40.242402000 -0800 @@ -1,8 +1,10 @@ -From 2383d8e909275b072145c7addf826e9c8edb6232 Mon Sep 17 00:00:00 2001 +From 11dabc416169e52ee79731bd6ab920036df0e2f3 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Wed, 16 Jan 2019 12:12:53 +0000 Subject: [PATCH] eal: check string parameter lengths +[ backported from upstream commit 2383d8e909275b072145c7addf826e9c8edb6232 ] + When specifying parameters such as hugefile prefix from the command-line, it is possibly to supply an empty string. This may lead to various problems: for example, if hugefile prefix is @@ -14,18 +16,16 @@ hugefile prefix, as well as hugepage dir and user-specified mbuf pool ops string. -Cc: stable@dpdk.org - Signed-off-by: Anatoly Burakov --- - lib/librte_eal/common/eal_common_options.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) + lib/librte_eal/common/eal_common_options.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c -index 80d790292..6c96f459c 100644 +index d91104dc0..a3d4d346b 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c -@@ -1415,6 +1415,21 @@ eal_check_common_options(struct internal_config *internal_cfg) +@@ -1242,6 +1242,16 @@ eal_check_common_options(struct internal_config *internal_cfg) RTE_LOG(ERR, EAL, "Invalid process type specified\n"); return -1; } @@ -39,12 +39,7 @@ + RTE_LOG(ERR, EAL, "Invalid length of --" OPT_HUGE_DIR" option\n"); + return -1; + } -+ if (internal_cfg->user_mbuf_pool_ops_name != NULL && -+ strlen(internal_cfg->user_mbuf_pool_ops_name) < 1) { -+ RTE_LOG(ERR, EAL, "Invalid length of --" OPT_MBUF_POOL_OPS_NAME" option\n"); -+ return -1; -+ } - if (index(eal_get_hugefile_prefix(), '%') != NULL) { + if (index(internal_cfg->hugefile_prefix, '%') != NULL) { RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" " "option\n"); --