DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] mem: fix cleanup after incomplete initialization
@ 2021-04-09 17:16 Dmitry Kozlyuk
  2021-04-20 16:49 ` Burakov, Anatoly
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kozlyuk @ 2021-04-09 17:16 UTC (permalink / raw)
  To: dev; +Cc: Dmitry Kozlyuk, Anatoly Burakov, David Marchand

In case of EAL initialization failure rte_eal_memory_detach() may be
called before mapping memory configuration, which in this case points
to the static structure. Attempt to unmap it yields error:

    EAL: Could not unmap shared memory config: Invalid argument

Skip unmapping memory configuration if it's not yet shared.

Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup")
Cc: Anatoly Burakov <anatoly.burakov@intel.com>

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 lib/librte_eal/common/eal_common_memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c
index 2581dd5f58..f83b75092e 100644
--- a/lib/librte_eal/common/eal_common_memory.c
+++ b/lib/librte_eal/common/eal_common_memory.c
@@ -1055,7 +1055,7 @@ rte_eal_memory_detach(void)
 	 * config - we can't zero it out because it might still be referenced
 	 * by other processes.
 	 */
-	if (internal_conf->no_shconf == 0) {
+	if (internal_conf->no_shconf == 0 && mcfg->mem_cfg_addr != 0) {
 		if (rte_mem_unmap(mcfg, RTE_ALIGN(sizeof(*mcfg), page_sz)) != 0)
 			RTE_LOG(ERR, EAL, "Could not unmap shared memory config: %s\n",
 					rte_strerror(rte_errno));
-- 
2.29.3


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

* Re: [dpdk-dev] [PATCH] mem: fix cleanup after incomplete initialization
  2021-04-09 17:16 [dpdk-dev] [PATCH] mem: fix cleanup after incomplete initialization Dmitry Kozlyuk
@ 2021-04-20 16:49 ` Burakov, Anatoly
  2021-04-20 21:34   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Burakov, Anatoly @ 2021-04-20 16:49 UTC (permalink / raw)
  To: Dmitry Kozlyuk, dev; +Cc: David Marchand

On 09-Apr-21 6:16 PM, Dmitry Kozlyuk wrote:
> In case of EAL initialization failure rte_eal_memory_detach() may be
> called before mapping memory configuration, which in this case points
> to the static structure. Attempt to unmap it yields error:
> 
>      EAL: Could not unmap shared memory config: Invalid argument
> 
> Skip unmapping memory configuration if it's not yet shared.
> 
> Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup")
> Cc: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Reported-by: David Marchand <david.marchand@redhat.com>
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---

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

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] mem: fix cleanup after incomplete initialization
  2021-04-20 16:49 ` Burakov, Anatoly
@ 2021-04-20 21:34   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-04-20 21:34 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: dev, David Marchand, Burakov, Anatoly

20/04/2021 18:49, Burakov, Anatoly:
> On 09-Apr-21 6:16 PM, Dmitry Kozlyuk wrote:
> > In case of EAL initialization failure rte_eal_memory_detach() may be
> > called before mapping memory configuration, which in this case points
> > to the static structure. Attempt to unmap it yields error:
> > 
> >      EAL: Could not unmap shared memory config: Invalid argument
> > 
> > Skip unmapping memory configuration if it's not yet shared.
> > 
> > Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup")
> > Cc: Anatoly Burakov <anatoly.burakov@intel.com>
> > 
> > Reported-by: David Marchand <david.marchand@redhat.com>
> > Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> 
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks



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

end of thread, other threads:[~2021-04-20 21:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 17:16 [dpdk-dev] [PATCH] mem: fix cleanup after incomplete initialization Dmitry Kozlyuk
2021-04-20 16:49 ` Burakov, Anatoly
2021-04-20 21:34   ` Thomas Monjalon

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 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 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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