DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] eal: unmap undesired address upon config reattach failure
@ 2019-08-18  6:47 Arnon Warshavsky
  2019-08-19  8:27 ` David Marchand
  2019-08-19 13:57 ` [dpdk-dev] [PATCH v2] " Arnon Warshavsky
  0 siblings, 2 replies; 5+ messages in thread
From: Arnon Warshavsky @ 2019-08-18  6:47 UTC (permalink / raw)
  To: dev; +Cc: arnonw, john.mcnamara, Arnon Warshavsky

Have rte_eal_config_reattach clean up the mapped address
which is a valid address but not the one intended.

Coverity issue: 343439
Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
---
 lib/librte_eal/linux/eal/eal.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 946222c..fac69b9 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -438,6 +438,7 @@ enum rte_iova_mode
 			RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
 				" - please use '--base-virtaddr' option\n",
 				rte_mem_cfg_addr, mem_config);
+			munmap(mem_config, sizeof(struct rte_mem_config));
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: unmap undesired address upon config reattach failure
  2019-08-18  6:47 [dpdk-dev] [PATCH] eal: unmap undesired address upon config reattach failure Arnon Warshavsky
@ 2019-08-19  8:27 ` David Marchand
  2019-08-19 13:57 ` [dpdk-dev] [PATCH v2] " Arnon Warshavsky
  1 sibling, 0 replies; 5+ messages in thread
From: David Marchand @ 2019-08-19  8:27 UTC (permalink / raw)
  To: Arnon Warshavsky; +Cc: dev, Mcnamara, John

On Sun, Aug 18, 2019 at 8:47 AM Arnon Warshavsky <arnon@qwilt.com> wrote:
>
> Have rte_eal_config_reattach clean up the mapped address
> which is a valid address but not the one intended.
>
> Coverity issue: 343439

Fixes: 4e8854ae89fa ("eal: do not panic on shared memory init")
Since the issue was hidden before that.

> Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>

FreeBSD has the same issue since:
b149a7064261 ("eal/freebsd: add config reattach in secondary process")


> ---
>  lib/librte_eal/linux/eal/eal.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
> index 946222c..fac69b9 100644
> --- a/lib/librte_eal/linux/eal/eal.c
> +++ b/lib/librte_eal/linux/eal/eal.c
> @@ -438,6 +438,7 @@ enum rte_iova_mode
>                         RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
>                                 " - please use '--base-virtaddr' option\n",
>                                 rte_mem_cfg_addr, mem_config);
> +                       munmap(mem_config, sizeof(struct rte_mem_config));
>                         return -1;
>                 }
>                 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
> --
> 1.8.3.1
>

Thanks.

Reviewed-by: David Marchand <david.marchand@redhat.com>

-- 
David Marchand

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] eal: unmap undesired address upon config reattach failure
  2019-08-18  6:47 [dpdk-dev] [PATCH] eal: unmap undesired address upon config reattach failure Arnon Warshavsky
  2019-08-19  8:27 ` David Marchand
@ 2019-08-19 13:57 ` " Arnon Warshavsky
  2019-08-19 14:48   ` Burakov, Anatoly
  2019-08-19 15:29   ` David Marchand
  1 sibling, 2 replies; 5+ messages in thread
From: Arnon Warshavsky @ 2019-08-19 13:57 UTC (permalink / raw)
  To: dev, david.marchand, john.mcnamara; +Cc: arnon

Have rte_eal_config_reattach clean up the mapped address
which is a valid address but not the one intended.

Coverity issue: 343439
Fixes: 4e8854ae89fa ("eal: do not panic on shared memory init")
Fixes: b149a7064261 ("eal/freebsd: add config reattach in secondary")
Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
---

-v2 added fixes messages and applied also to freebsd

 lib/librte_eal/freebsd/eal/eal.c | 1 +
 lib/librte_eal/linux/eal/eal.c   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
index d53f0fe..963db76 100644
--- a/lib/librte_eal/freebsd/eal/eal.c
+++ b/lib/librte_eal/freebsd/eal/eal.c
@@ -341,6 +341,7 @@ enum rte_iova_mode
 		/* errno is stale, don't use */
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]\n",
 			  rte_mem_cfg_addr, mem_config);
+		munmap(mem_config, sizeof(struct rte_mem_config));
 		return -1;
 	}
 
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 946222c..fac69b9 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -438,6 +438,7 @@ enum rte_iova_mode
 			RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
 				" - please use '--base-virtaddr' option\n",
 				rte_mem_cfg_addr, mem_config);
+			munmap(mem_config, sizeof(struct rte_mem_config));
 			return -1;
 		}
 		RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] eal: unmap undesired address upon config reattach failure
  2019-08-19 13:57 ` [dpdk-dev] [PATCH v2] " Arnon Warshavsky
@ 2019-08-19 14:48   ` Burakov, Anatoly
  2019-08-19 15:29   ` David Marchand
  1 sibling, 0 replies; 5+ messages in thread
From: Burakov, Anatoly @ 2019-08-19 14:48 UTC (permalink / raw)
  To: Arnon Warshavsky, dev, david.marchand, john.mcnamara

On 19-Aug-19 2:57 PM, Arnon Warshavsky wrote:
> Have rte_eal_config_reattach clean up the mapped address
> which is a valid address but not the one intended.
> 
> Coverity issue: 343439
> Fixes: 4e8854ae89fa ("eal: do not panic on shared memory init")
> Fixes: b149a7064261 ("eal/freebsd: add config reattach in secondary")
> Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] eal: unmap undesired address upon config reattach failure
  2019-08-19 13:57 ` [dpdk-dev] [PATCH v2] " Arnon Warshavsky
  2019-08-19 14:48   ` Burakov, Anatoly
@ 2019-08-19 15:29   ` David Marchand
  1 sibling, 0 replies; 5+ messages in thread
From: David Marchand @ 2019-08-19 15:29 UTC (permalink / raw)
  To: Arnon Warshavsky; +Cc: dev, Mcnamara, John

On Mon, Aug 19, 2019 at 3:58 PM Arnon Warshavsky <arnon@qwilt.com> wrote:
>
> Have rte_eal_config_reattach clean up the mapped address
> which is a valid address but not the one intended.
>
> Coverity issue: 343439
> Fixes: 4e8854ae89fa ("eal: do not panic on shared memory init")
> Fixes: b149a7064261 ("eal/freebsd: add config reattach in secondary")
> Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
> ---
>
> -v2 added fixes messages and applied also to freebsd
>
>  lib/librte_eal/freebsd/eal/eal.c | 1 +
>  lib/librte_eal/linux/eal/eal.c   | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
> index d53f0fe..963db76 100644
> --- a/lib/librte_eal/freebsd/eal/eal.c
> +++ b/lib/librte_eal/freebsd/eal/eal.c
> @@ -341,6 +341,7 @@ enum rte_iova_mode
>                 /* errno is stale, don't use */
>                 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]\n",
>                           rte_mem_cfg_addr, mem_config);
> +               munmap(mem_config, sizeof(struct rte_mem_config));
>                 return -1;
>         }
>
> diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
> index 946222c..fac69b9 100644
> --- a/lib/librte_eal/linux/eal/eal.c
> +++ b/lib/librte_eal/linux/eal/eal.c
> @@ -438,6 +438,7 @@ enum rte_iova_mode
>                         RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
>                                 " - please use '--base-virtaddr' option\n",
>                                 rte_mem_cfg_addr, mem_config);
> +                       munmap(mem_config, sizeof(struct rte_mem_config));
>                         return -1;
>                 }
>                 RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",
> --
> 1.8.3.1
>

Thanks Arnon.
Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-18  6:47 [dpdk-dev] [PATCH] eal: unmap undesired address upon config reattach failure Arnon Warshavsky
2019-08-19  8:27 ` David Marchand
2019-08-19 13:57 ` [dpdk-dev] [PATCH v2] " Arnon Warshavsky
2019-08-19 14:48   ` Burakov, Anatoly
2019-08-19 15:29   ` David Marchand

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox