From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D311CA04F0 for ; Thu, 19 Dec 2019 15:41:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 41BBA1C026; Thu, 19 Dec 2019 15:41:51 +0100 (CET) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by dpdk.org (Postfix) with ESMTP id 664471BF74 for ; Thu, 19 Dec 2019 15:41:50 +0100 (CET) Received: by mail-wr1-f47.google.com with SMTP id y11so6229998wrt.6 for ; Thu, 19 Dec 2019 06:41:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=THI8HUWEmVsKX9yfvLt5jaTbbmOl6V6OBaDfpputYs4=; b=FAnGsr9FBYdTq8coWOqV6Nk5cmEKaKRFb/svmx5pUqG9DiLlwKKfGglCGJnEphwm/p UKR2sqLjvVhSl5gXPHx07u0LOXguoTjm5kMoFNY+JUO7poJuYu2SUEsgBjyogkYVlUpp JipcJkPptBuFauI8Pi0njWS0ir3OV6VxETS20yRJWU3OuwHBwdw7pkSHpFD2FV2egDXz 3hV1AmcVkqC3BYbGx+TCpE+UkfELvdRImI4NhivHn7bRBL5BplIO+NQgWzoutHmBiIap dS8c05g2uvPd7KQs1Jry4NuvN1NVrkijZgSL/leKKbyYoDXRZNq8iDqT5xdx6Z/yeCMa JK6g== 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=THI8HUWEmVsKX9yfvLt5jaTbbmOl6V6OBaDfpputYs4=; b=e0LsAOXL6DOAwVJW+yYEaQdpRx3ItYh7dy3V7b+fZhjtR0amf1bI566P04bpd2GZ98 2Bkl+z+hDaFxUAHZLO9gLnZjimmWPhEEfuvpBfx3BCwveDWAFamOpwLHXJbiWJkL2vIn 3k9aqxNbjJErlT8FDJSJ5fb2iQy0T7hwf0CILKJ0o8I8914lHEGI74K0l0qarb9DFe3G MxeybIacBx+LwqMgbpAb5y/sXr31uqJADHQWR/PxXHwEYnVDh04cgibWq4AxqUZBAd2s J4gf5B4dbz3XXMp/hIOpBQuieAhrFeimHzyG9lXAsVqs34RzzCi3AKpFVmGMjmPVQgJs k6lA== X-Gm-Message-State: APjAAAUEJqAYmdAWOhASRUKM+zeYaDczOnO/gNUdCSW9fiY8XuDshrEl NrQEz/V5TznAJ0Q2PpudHCw= X-Google-Smtp-Source: APXvYqzuOgB4IvW2njrc3uFkysxBhvvWMVHNgRoPCpsXrRT/tZeMCruREX81hHMXi7LOL8HraiB4zQ== X-Received: by 2002:a5d:494b:: with SMTP id r11mr9897336wrs.184.1576766510129; Thu, 19 Dec 2019 06:41:50 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id z21sm6444755wml.5.2019.12.19.06.41.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:41:48 -0800 (PST) From: luca.boccassi@gmail.com To: Xueming Li Cc: Anatoly Burakov , dpdk stable Date: Thu, 19 Dec 2019 14:34:30 +0000 Message-Id: <20191219143447.21506-123-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219143447.21506-1-luca.boccassi@gmail.com> References: <20191219143447.21506-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'malloc: fix realloc copy size' has been queued to LTS release 17.11.10 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: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 17.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/21/19. 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. Thanks. Luca Boccassi --- >From 096199bcb05bb09fb180f71649968395a7c85509 Mon Sep 17 00:00:00 2001 From: Xueming Li Date: Tue, 12 Nov 2019 14:50:27 +0000 Subject: [PATCH] malloc: fix realloc copy size [ upstream commit a029a060369f74f42394301f87489aeb391220ef ] In rte_realloc, if the old element has pad and need to allocate a new memory, the padding size was not deducted, so more data was copied to new data area. Fixes: af75078fece3 ("first public release") Signed-off-by: Xueming Li Reviewed-by: Anatoly Burakov --- lib/librte_eal/common/rte_malloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c index fe2278bcd7..1d3ab5ad73 100644 --- a/lib/librte_eal/common/rte_malloc.c +++ b/lib/librte_eal/common/rte_malloc.c @@ -177,7 +177,8 @@ rte_realloc(void *ptr, size_t size, unsigned align) void *new_ptr = rte_malloc(NULL, size, align); if (new_ptr == NULL) return NULL; - const unsigned old_size = elem->size - MALLOC_ELEM_OVERHEAD; + /* elem: |pad|data_elem|data|trailer| */ + const size_t old_size = elem->size - elem->pad - MALLOC_ELEM_OVERHEAD; rte_memcpy(new_ptr, ptr, old_size < size ? old_size : size); rte_free(ptr); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-12-19 14:32:31.235523709 +0000 +++ 0123-malloc-fix-realloc-copy-size.patch 2019-12-19 14:32:26.325302188 +0000 @@ -1,14 +1,15 @@ -From a029a060369f74f42394301f87489aeb391220ef Mon Sep 17 00:00:00 2001 +From 096199bcb05bb09fb180f71649968395a7c85509 Mon Sep 17 00:00:00 2001 From: Xueming Li Date: Tue, 12 Nov 2019 14:50:27 +0000 Subject: [PATCH] malloc: fix realloc copy size +[ upstream commit a029a060369f74f42394301f87489aeb391220ef ] + In rte_realloc, if the old element has pad and need to allocate a new memory, the padding size was not deducted, so more data was copied to new data area. Fixes: af75078fece3 ("first public release") -Cc: stable@dpdk.org Signed-off-by: Xueming Li Reviewed-by: Anatoly Burakov @@ -17,11 +18,11 @@ 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c -index 413e4aa004..d6026a2b17 100644 +index fe2278bcd7..1d3ab5ad73 100644 --- a/lib/librte_eal/common/rte_malloc.c +++ b/lib/librte_eal/common/rte_malloc.c -@@ -150,7 +150,8 @@ rte_realloc_socket(void *ptr, size_t size, unsigned int align, int socket) - void *new_ptr = rte_malloc_socket(NULL, size, align, socket); +@@ -177,7 +177,8 @@ rte_realloc(void *ptr, size_t size, unsigned align) + void *new_ptr = rte_malloc(NULL, size, align); if (new_ptr == NULL) return NULL; - const unsigned old_size = elem->size - MALLOC_ELEM_OVERHEAD;