From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id DC5B31E2F for ; Mon, 29 Oct 2018 13:54:18 +0100 (CET) Received: by mail-wm1-f68.google.com with SMTP id l26-v6so8108648wmh.3 for ; Mon, 29 Oct 2018 05:54:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pmab7ogjaIWwa7CEP9eA9PTytAJUE2e3RDyQ5Mt1jzI=; b=bTA9MeAAZwFqGy10Z/wBP5yBgVUCJWZd/UfMEtB7gaQBFvmXSBpmkPvocjfVS2oU5e vgMT31Nmf0zy6FnHJSWqw6Z3PGVnQMyP9HaowjRwBSivxVwWxxkIbsfN91nhJimYYb0/ qOpoc1+wP+ltzzKez4S9Mf9tuPL8xkH7ay1Uk9gowf1p31yPVJhnQoBt7GvsShIkl4OU IWxzpqeEryAMcLlqP6DHrLJLfXIaSrrvmzJMLL5yUNET8P5pKVmYqaiFfYu6Jj7q+yQ6 1nOZucelLjR+na2hYniP9Xq0MYPiPMFl9f6hVR7UiE4Ztmq+A/Itnm+0n0PgbK1UkKRx 2gNg== X-Gm-Message-State: AGRZ1gJ2SWxRZiCv6tyUkTaAP3toSgduTPl03WdJYfPx3I0NluxCB19w 5H6tNmCdE4C/Dy9kMTvUhAY= X-Google-Smtp-Source: AJdET5eIgW6EdrQRxBVceWm1F4O0QPMIwcgrHjR09kGNq3DAw5S6JDpkvFgweteo3vdyK6pKGad3xA== X-Received: by 2002:a1c:8cd2:: with SMTP id o201-v6mr12869419wmd.65.1540817658461; Mon, 29 Oct 2018 05:54:18 -0700 (PDT) Received: from localhost ([2a01:4b00:f419:6f00:8361:8946:ba2b:d556]) by smtp.gmail.com with ESMTPSA id 65-v6sm13805200wmm.36.2018.10.29.05.54.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Oct 2018 05:54:17 -0700 (PDT) From: Luca Boccassi To: Ziye Yang Cc: Ferruh Yigit , dpdk stable Date: Mon, 29 Oct 2018 12:53:28 +0000 Message-Id: <20181029125329.17729-19-bluca@debian.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181029125329.17729-1-bluca@debian.org> References: <20181015115144.27626-1-bluca@debian.org> <20181029125329.17729-1-bluca@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'eal/linux: fix memory leak of logid' has been queued to LTS release 16.11.9 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: Mon, 29 Oct 2018 12:54:19 -0000 Hi, FYI, your patch has been queued to LTS release 16.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 10/31/18. 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. 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. Luca Boccassi --- >>From 51c1aeccc92da6948d496ff1fc486581dfcd0eb0 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Wed, 12 Sep 2018 09:31:50 +0800 Subject: [PATCH] eal/linux: fix memory leak of logid [ upstream commit e4f2c1421d8036a4778c43bf25201ef5fb37ad6f ] This patch is used to fix the memory leak issue of logid. We use the ASAN test in SPDK when integrating DPDK and find this memory leak issue. Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id") Signed-off-by: Ziye Yang Reviewed-by: Ferruh Yigit --- lib/librte_eal/linuxapp/eal/eal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 59ed78823..bbd6284e7 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -746,7 +746,8 @@ rte_eal_init(int argc, char **argv) int i, fctret, ret; pthread_t thread_id; static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0); - const char *logid; + const char *p; + static char logid[PATH_MAX]; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; char thread_name[RTE_MAX_THREAD_NAME_LEN]; @@ -756,9 +757,8 @@ rte_eal_init(int argc, char **argv) if (!rte_atomic32_test_and_set(&run_once)) return -1; - logid = strrchr(argv[0], '/'); - logid = strdup(logid ? logid + 1: argv[0]); - + p = strrchr(argv[0], '/'); + strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid)); thread_id = pthread_self(); eal_log_level_parse(argc, argv); -- 2.19.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2018-10-29 12:48:14.841749286 +0000 +++ 0019-eal-linux-fix-memory-leak-of-logid.patch 2018-10-29 12:48:14.474417981 +0000 @@ -1,14 +1,15 @@ -From e4f2c1421d8036a4778c43bf25201ef5fb37ad6f Mon Sep 17 00:00:00 2001 +From 51c1aeccc92da6948d496ff1fc486581dfcd0eb0 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Wed, 12 Sep 2018 09:31:50 +0800 Subject: [PATCH] eal/linux: fix memory leak of logid +[ upstream commit e4f2c1421d8036a4778c43bf25201ef5fb37ad6f ] + This patch is used to fix the memory leak issue of logid. We use the ASAN test in SPDK when integrating DPDK and find this memory leak issue. Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id") -Cc: stable@dpdk.org Signed-off-by: Ziye Yang Reviewed-by: Ferruh Yigit @@ -17,10 +18,10 @@ 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c -index 7b11375f4..67116eee2 100644 +index 59ed78823..bbd6284e7 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c -@@ -825,7 +825,8 @@ rte_eal_init(int argc, char **argv) +@@ -746,7 +746,8 @@ rte_eal_init(int argc, char **argv) int i, fctret, ret; pthread_t thread_id; static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0); @@ -30,9 +31,9 @@ char cpuset[RTE_CPU_AFFINITY_STR_LEN]; char thread_name[RTE_MAX_THREAD_NAME_LEN]; -@@ -842,9 +843,8 @@ rte_eal_init(int argc, char **argv) +@@ -756,9 +757,8 @@ rte_eal_init(int argc, char **argv) + if (!rte_atomic32_test_and_set(&run_once)) return -1; - } - logid = strrchr(argv[0], '/'); - logid = strdup(logid ? logid + 1: argv[0]); @@ -41,7 +42,7 @@ + strlcpy(logid, p ? p + 1 : argv[0], sizeof(logid)); thread_id = pthread_self(); - eal_reset_internal_config(&internal_config); + eal_log_level_parse(argc, argv); -- 2.19.1