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 267F8A054C for ; Fri, 14 Feb 2020 18:06:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D2D711A4; Fri, 14 Feb 2020 18:06:39 +0100 (CET) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id D0F2211A4 for ; Fri, 14 Feb 2020 18:06:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581699997; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZK8EYabdkaOA2YACa4t0lzVm+U1qELRsaMjs014l544=; b=fyJEh2ioBgKZQ1khpsmjPiWJUTdT5h0O1BJ31ryfhIIufN4jScpu+uDN6WvOz02vhNwyGv UiT5Yyaa0/IpFnOLBnLJza+UHh4m77CghLqNs2G3Ev43CVAazq4py61qIxXYFGK3KxuaFu 7xAf2aMDaJzPOmR7dKaqStJcWSJdNrI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-Z93q1RPCOUi_3_L1p-laMA-1; Fri, 14 Feb 2020 12:06:34 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91C5F107B272; Fri, 14 Feb 2020 17:06:33 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id B158188854; Fri, 14 Feb 2020 17:06:30 +0000 (UTC) From: Kevin Traynor To: Stephen Hemminger Cc: Anatoly Burakov , dpdk stable Date: Fri, 14 Feb 2020 17:03:37 +0000 Message-Id: <20200214170337.25093-43-ktraynor@redhat.com> In-Reply-To: <20200214170337.25093-1-ktraynor@redhat.com> References: <20200214170337.25093-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: Z93q1RPCOUi_3_L1p-laMA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'mem: fix munmap in error unwind' has been queued to LTS release 18.11.7 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 18.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/20/20. 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 rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/6556afdb8ad245e9da= 0f1bf0ba7850675008d158 Thanks. Kevin. --- >From 6556afdb8ad245e9da0f1bf0ba7850675008d158 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 22 Jan 2020 09:06:11 -0800 Subject: [PATCH] mem: fix munmap in error unwind [ upstream commit 292f02b58c26c3bad2327a52c49ec6eff580e124 ] The loop to unwind existing mmaps was only unmapping the first segment and the error paths after mmap() were not doing munmap of the current segment. Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists") Signed-off-by: Stephen Hemminger Acked-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_memory.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linu= xapp/eal/eal_memory.c index de91c6afb0..ac0424582e 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1869,5 +1869,5 @@ eal_legacy_hugepage_attach(void) =09=09=09RTE_LOG(DEBUG, EAL, "%s(): Locking file failed: %s\n", =09=09=09=09__func__, strerror(errno)); -=09=09=09goto fd_error; +=09=09=09goto mmap_error; =09=09} =20 @@ -1877,5 +1877,5 @@ eal_legacy_hugepage_attach(void) =09=09=09RTE_LOG(DEBUG, EAL, "%s(): Cannot find memseg list\n", =09=09=09=09__func__); -=09=09=09goto fd_error; +=09=09=09goto mmap_error; =09=09} =09=09ms =3D rte_mem_virt2memseg(map_addr, msl); @@ -1883,5 +1883,5 @@ eal_legacy_hugepage_attach(void) =09=09=09RTE_LOG(DEBUG, EAL, "%s(): Cannot find memseg\n", =09=09=09=09__func__); -=09=09=09goto fd_error; +=09=09=09goto mmap_error; =09=09} =20 @@ -1891,5 +1891,5 @@ eal_legacy_hugepage_attach(void) =09=09=09RTE_LOG(DEBUG, EAL, "%s(): Cannot find memseg idx\n", =09=09=09=09__func__); -=09=09=09goto fd_error; +=09=09=09goto mmap_error; =09=09} =20 @@ -1904,16 +1904,13 @@ eal_legacy_hugepage_attach(void) =09return 0; =20 +mmap_error: +=09munmap(hp[i].final_va, hp[i].size); fd_error: =09close(fd); error: -=09/* map all segments into memory to make sure we get the addrs */ -=09cur_seg =3D 0; -=09for (cur_seg =3D 0; cur_seg < i; cur_seg++) { -=09=09struct hugepage_file *hf =3D &hp[i]; -=09=09size_t map_sz =3D hf->size; -=09=09void *map_addr =3D hf->final_va; +=09/* unwind mmap's done so far */ +=09for (cur_seg =3D 0; cur_seg < i; cur_seg++) +=09=09munmap(hp[cur_seg].final_va, hp[cur_seg].size); =20 -=09=09munmap(map_addr, map_sz); -=09} =09if (hp !=3D NULL && hp !=3D MAP_FAILED) =09=09munmap(hp, size); --=20 2.21.1 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092020-02-14 17:02:39.435233742 +0000 +++ 0043-mem-fix-munmap-in-error-unwind.patch=092020-02-14 17:02:37.0644055= 80 +0000 @@ -1 +1 @@ -From 292f02b58c26c3bad2327a52c49ec6eff580e124 Mon Sep 17 00:00:00 2001 +From 6556afdb8ad245e9da0f1bf0ba7850675008d158 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 292f02b58c26c3bad2327a52c49ec6eff580e124 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -16 +17 @@ - lib/librte_eal/linux/eal/eal_memory.c | 21 +++++++++------------ + lib/librte_eal/linuxapp/eal/eal_memory.c | 21 +++++++++------------ @@ -19,5 +20,5 @@ -diff --git a/lib/librte_eal/linux/eal/eal_memory.c b/lib/librte_eal/linux/= eal/eal_memory.c -index 43e4ffc757..5604c2a7c0 100644 ---- a/lib/librte_eal/linux/eal/eal_memory.c -+++ b/lib/librte_eal/linux/eal/eal_memory.c -@@ -1929,5 +1929,5 @@ eal_legacy_hugepage_attach(void) +diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/lin= uxapp/eal/eal_memory.c +index de91c6afb0..ac0424582e 100644 +--- a/lib/librte_eal/linuxapp/eal/eal_memory.c ++++ b/lib/librte_eal/linuxapp/eal/eal_memory.c +@@ -1869,5 +1869,5 @@ eal_legacy_hugepage_attach(void) @@ -30 +31 @@ -@@ -1937,5 +1937,5 @@ eal_legacy_hugepage_attach(void) +@@ -1877,5 +1877,5 @@ eal_legacy_hugepage_attach(void) @@ -37 +38 @@ -@@ -1943,5 +1943,5 @@ eal_legacy_hugepage_attach(void) +@@ -1883,5 +1883,5 @@ eal_legacy_hugepage_attach(void) @@ -44 +45 @@ -@@ -1951,5 +1951,5 @@ eal_legacy_hugepage_attach(void) +@@ -1891,5 +1891,5 @@ eal_legacy_hugepage_attach(void) @@ -51 +52 @@ -@@ -1964,16 +1964,13 @@ eal_legacy_hugepage_attach(void) +@@ -1904,16 +1904,13 @@ eal_legacy_hugepage_attach(void)