From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 33D5C235 for ; Tue, 21 Nov 2017 14:24:35 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id CD89120A5F; Tue, 21 Nov 2017 08:24:33 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 21 Nov 2017 08:24:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=rie3TQTpW9rJiPHfK 8s6dbPbEaDeefUjhUAWQncC8BA=; b=PcgHQx8NL5ljQs2xBLDS0Gm4yOslultjW 5qBBzubTCraSUgna7uR9qmeEVnIkglIx1Pf0iBWEB4Dmud8ogCavnhZFmNdCVnff u0I4GJq3Op5wvDsZ6g5b/rsAgtwKXXQ/d0AYePSWPKPAUVhNHeXLQRucND6LThOl 01DbLvmMlkYCEa2WcCrTvxe6WiuKKHykUZhpKFFEPvoSspr8aB3f31kR1zCN1pxO sRfDpqv+pTLOE9KNZHzYIJSDAa4poICacy9ZWq+UJ5dlZe5mXDkal9XxlTcBOUpH 6twsfnpbXmZ0Uq0UmasE9D9Ce0KmoQkUULtaQq0u8fybHrYZUmu0g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=rie3TQTpW9rJiPHfK8s6dbPbEaDeefUjhUAWQncC8BA=; b=h1Eroqx5 tksiaEqcCxA81DiogvTj1Vjysss3CVnhbpfGJjC126pFwwcfwPvoCFBlD7efLLAZ HA++E3MrXcnzoDsy+jf5pEgWpNfVkNf/LBpKkMIbiTbqXwpvp3nKWUjbHg575ahr 97A+KgE8tPxZRKB72FG0Hf50vwiOZX2zx7sFUqV8TpmwQ2/FuWTljqQgqwuQCLKW Ogmr3QRu2fwmGu30jg1j1nNFmMs1SV7hdQ6Rv14QbbWBA3rFKh0TOXMr6YAD56Y4 DYNNdOFjH8dAGt8A6V3NZ+CMCfl5pnJamYUH+UGgg3keYjHf7PMd7EnAVF06qsYY /KuHgMN8ncS6cg== X-ME-Sender: Received: from localhost.localdomain (unknown [180.158.62.0]) by mail.messagingengine.com (Postfix) with ESMTPA id 72B2D24810; Tue, 21 Nov 2017 08:24:31 -0500 (EST) From: Yuanhan Liu To: Xueming Li Cc: Sergio Gonzalez Monroy , dpdk stable Date: Tue, 21 Nov 2017 21:17:03 +0800 Message-Id: <1511270333-31002-81-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> References: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'mem: fix malloc element free in debug mode' has been queued to stable release 17.08.1 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: Tue, 21 Nov 2017 13:24:35 -0000 Hi, FYI, your patch has been queued to stable release 17.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/24/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 3f0357d07cf365f5406df0cc236b08a4060498cb Mon Sep 17 00:00:00 2001 From: Xueming Li Date: Sat, 9 Sep 2017 15:33:19 +0800 Subject: [PATCH] mem: fix malloc element free in debug mode [ upstream commit 41baec55a81467d7733217cd6f81a94e2916348c ] malloc_elem_free() is clearing(setting to 0) the trailer cookie when RTE_MALLOC_DEBUG is enabled. In case of joining free neighbor element, part of joined memory is not getting cleared due to missing the length of trailer cookie in the middle. This patch fixes calculation of free memory length to be cleared in malloc_elem_free() by including trailer cookie. Fixes: af75078fece3 ("first public release") Signed-off-by: Xueming Li Acked-by: Sergio Gonzalez Monroy --- lib/librte_eal/common/malloc_elem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c index 1507690..889dffd 100644 --- a/lib/librte_eal/common/malloc_elem.c +++ b/lib/librte_eal/common/malloc_elem.c @@ -275,14 +275,14 @@ malloc_elem_free(struct malloc_elem *elem) return -1; rte_spinlock_lock(&(elem->heap->lock)); - size_t sz = elem->size - sizeof(*elem); + size_t sz = elem->size - sizeof(*elem) - MALLOC_ELEM_TRAILER_LEN; uint8_t *ptr = (uint8_t *)&elem[1]; struct malloc_elem *next = RTE_PTR_ADD(elem, elem->size); if (next->state == ELEM_FREE){ /* remove from free list, join to this one */ elem_free_list_remove(next); join_elem(elem, next); - sz += sizeof(*elem); + sz += (sizeof(*elem) + MALLOC_ELEM_TRAILER_LEN); } /* check if previous element is free, if so join with it and return, @@ -291,8 +291,8 @@ malloc_elem_free(struct malloc_elem *elem) if (elem->prev != NULL && elem->prev->state == ELEM_FREE) { elem_free_list_remove(elem->prev); join_elem(elem->prev, elem); - sz += sizeof(*elem); - ptr -= sizeof(*elem); + sz += (sizeof(*elem) + MALLOC_ELEM_TRAILER_LEN); + ptr -= (sizeof(*elem) + MALLOC_ELEM_TRAILER_LEN); elem = elem->prev; } malloc_elem_free_list_insert(elem); -- 2.7.4