From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 5AE091B49C for ; Fri, 4 Jan 2019 14:27:13 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B834A80494; Fri, 4 Jan 2019 13:27:12 +0000 (UTC) Received: from ktraynor.remote.csb (ovpn-117-13.ams2.redhat.com [10.36.117.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5F045C1A1; Fri, 4 Jan 2019 13:27:11 +0000 (UTC) From: Kevin Traynor To: Yongseok Koh Cc: Anatoly Burakov , dpdk stable Date: Fri, 4 Jan 2019 13:24:12 +0000 Message-Id: <20190104132455.15170-30-ktraynor@redhat.com> In-Reply-To: <20190104132455.15170-1-ktraynor@redhat.com> References: <20190104132455.15170-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 04 Jan 2019 13:27:12 +0000 (UTC) Subject: [dpdk-stable] patch 'malloc: fix finding maximum contiguous IOVA size' has been queued to LTS release 18.11.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: Fri, 04 Jan 2019 13:27:13 -0000 Hi, FYI, your patch has been queued to LTS release 18.11.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 01/11/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. Kevin Traynor --- >>From db9e14e7975a908aaedfd0313a6441fd37492f30 Mon Sep 17 00:00:00 2001 From: Yongseok Koh Date: Wed, 12 Dec 2018 03:10:54 -0800 Subject: [PATCH] malloc: fix finding maximum contiguous IOVA size [ upstream commit 6d09256148567807b772347ec4ac363c4bcb6b5a ] malloc_elem_find_max_iova_contig() could return invalid size due to a missing sanity check. The following gdb output shows how 'cur_size' can be invalid in find_biggest_element(). (gdb) p/x cur_size $4 = 0xffffffffffe42900 (gdb) p elem $1 = (struct malloc_elem *) 0x12e842000 (gdb) p *elem $2 = {heap = 0x7ffff7ff387c, prev = 0x12e831fc0, next = 0x12e842900, free_list = {le_next = 0x109538000, le_prev = 0x7ffff7ff3894}, msl = 0x7ffff7ff107c, state = ELEM_FREE, pad = 0, size = 2304} (gdb) p *elem->msl $5 = {{base_va = 0x100200000, addr_64 = 4297064448}, page_sz = 2097152, socket_id = 0, version = 790, len = 17179869184, external = 0, memseg_arr = {name = "memseg-2048k-0-0", '\000' , count = 493, len = 8192, elt_sz = 48, data = 0x10002e000, rwlock = {cnt = 0}}} Fixes: 9fe6bceafd51 ("malloc: add finding biggest free IOVA-contiguous element") Signed-off-by: Yongseok Koh Acked-by: Anatoly Burakov --- lib/librte_eal/common/malloc_elem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c index 9d3dcb6a9..052aeeb7b 100644 --- a/lib/librte_eal/common/malloc_elem.c +++ b/lib/librte_eal/common/malloc_elem.c @@ -39,4 +39,8 @@ malloc_elem_find_max_iova_contig(struct malloc_elem *elem, size_t align) contig_seg_start = RTE_PTR_ALIGN_CEIL(data_start, align); + /* return if aligned address is already out of malloc element */ + if (contig_seg_start > data_end) + return 0; + /* if we're in IOVA as VA mode, or if we're in legacy mode with * hugepages, all elements are IOVA-contiguous. however, we can only -- 2.19.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-04 13:23:08.164413037 +0000 +++ 0030-malloc-fix-finding-maximum-contiguous-IOVA-size.patch 2019-01-04 13:23:07.000000000 +0000 @@ -1,8 +1,10 @@ -From 6d09256148567807b772347ec4ac363c4bcb6b5a Mon Sep 17 00:00:00 2001 +From db9e14e7975a908aaedfd0313a6441fd37492f30 Mon Sep 17 00:00:00 2001 From: Yongseok Koh Date: Wed, 12 Dec 2018 03:10:54 -0800 Subject: [PATCH] malloc: fix finding maximum contiguous IOVA size +[ upstream commit 6d09256148567807b772347ec4ac363c4bcb6b5a ] + malloc_elem_find_max_iova_contig() could return invalid size due to a missing sanity check. The following gdb output shows how 'cur_size' can be invalid in find_biggest_element(). @@ -24,7 +26,6 @@ = 48, data = 0x10002e000, rwlock = {cnt = 0}}} Fixes: 9fe6bceafd51 ("malloc: add finding biggest free IOVA-contiguous element") -Cc: stable@dpdk.org Signed-off-by: Yongseok Koh Acked-by: Anatoly Burakov @@ -33,7 +34,7 @@ 1 file changed, 4 insertions(+) diff --git a/lib/librte_eal/common/malloc_elem.c b/lib/librte_eal/common/malloc_elem.c -index fcdb18120..d54a528ed 100644 +index 9d3dcb6a9..052aeeb7b 100644 --- a/lib/librte_eal/common/malloc_elem.c +++ b/lib/librte_eal/common/malloc_elem.c @@ -39,4 +39,8 @@ malloc_elem_find_max_iova_contig(struct malloc_elem *elem, size_t align)