From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 13AB2A0569;
	Thu, 12 Mar 2020 10:00:11 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 8D3E21C020;
	Thu, 12 Mar 2020 10:00:10 +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 5B9DA1C01B
 for <dev@dpdk.org>; Thu, 12 Mar 2020 10:00:08 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1584003607;
 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=aAk2kHnI/RbCI8Rb186CG9bVR9e/mnapT6y1aMtG7jE=;
 b=gMMYWlwVUoU8X7iK4vHj422F3KG+swzfFERtWXuUTQyuczgB7XgMnpiFP/bfxbqg22Ntty
 utCurlWpz8c9DtPtmg0m4536e/EugU0oy9NkdgHBS/0pP2WDThaij6BQQBwQKPcsu1Pv1/
 xzabU3Z7NSpCocC7k251qUOg8DbTYIs=
Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com
 [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-125-7YSIlOdMPyq_PMFNx9uQOQ-1; Thu, 12 Mar 2020 05:00:05 -0400
X-MC-Unique: 7YSIlOdMPyq_PMFNx9uQOQ-1
Received: by mail-vs1-f70.google.com with SMTP id u5so531465vsg.21
 for <dev@dpdk.org>; Thu, 12 Mar 2020 02:00:05 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=5VYmBTPsuKkIdxGH3CSqOJHtHjQtO9QjGBig22ly8XQ=;
 b=MdOPy1HDDSX371JS9FmIvTODgRA/B3hd++NycsK90Rii6lP8lavC/mYEFL6ENKnrkC
 SoACyubNXdgLNfxVRbbP36+iXxupQsO5XUbwh1wyLtAZYOgxaB6mBwtEiyjgc1yHAJ3Q
 7w4l2OdXwyxklVnKmp9FAksRGS2sGXf0WV73Md/c+Ai8HK3RlJzm39LYZci7V7TlnNe0
 2pdYJjF93bYIo9nfR/pUxUuHebYGSXha/0b1B9h9hAviHJD9D6TpSIiHrotQr4VDrah2
 xW+3phF1V4BOS52pPNe4F0G66SDkGNNK88Ij5iHw5dZGoWNEa3jl3DtpcXjwxCS2yZMU
 6X9g==
X-Gm-Message-State: ANhLgQ0/hd4QQ5lAGWKexKpBc4KFpYZaOpgpioI+PHFSQNAANceDGDnW
 TLwfgzCJO0J4T0ySJM5zNyEsvVSZjtHj4m9w52ST2HpTDMuXkeLnwgg9ZCDGUjOUemfnVk4oUGT
 +PNArrZ8cV/c3ZJeUhX8=
X-Received: by 2002:a1f:2f4c:: with SMTP id v73mr4518875vkv.12.1584003604870; 
 Thu, 12 Mar 2020 02:00:04 -0700 (PDT)
X-Google-Smtp-Source: ADFU+vvE2VU1Xh021JyMuIrr+9nrUSU8fMauuAx/e25ElBdG6ba6dMEaiNISGKFHu1cXEJyGU4ZRwkaPsKrzd91eGnY=
X-Received: by 2002:a1f:2f4c:: with SMTP id v73mr4518863vkv.12.1584003604563; 
 Thu, 12 Mar 2020 02:00:04 -0700 (PDT)
MIME-Version: 1.0
References: <20200310133304.39951-1-harry.van.haaren@intel.com>
 <20200311143927.76021-1-harry.van.haaren@intel.com>
 <CAJFAV8zTcyE8Swm-s8R3jQ3pajLV6+HXPHRmwUhqw6KktCm1MQ@mail.gmail.com>
 <MWHPR1101MB21575ECFB47831F8DE513465D7FC0@MWHPR1101MB2157.namprd11.prod.outlook.com>
In-Reply-To: <MWHPR1101MB21575ECFB47831F8DE513465D7FC0@MWHPR1101MB2157.namprd11.prod.outlook.com>
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 12 Mar 2020 09:59:53 +0100
Message-ID: <CAJFAV8xJNB2KVjTfE_OnesNyk=S9hnPa6hz6hEd-hTH1TkTKJQ@mail.gmail.com>
To: "Van Haaren, Harry" <harry.van.haaren@intel.com>
Cc: dev <dev@dpdk.org>, Aaron Conole <aconole@redhat.com>,
 dpdk stable <stable@dpdk.org>
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Subject: Re: [dpdk-dev] [PATCH v2] eal/service: fix exit by resetting
	service lcores
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Hello,

On Wed, Mar 11, 2020 at 5:21 PM Van Haaren, Harry
<harry.van.haaren@intel.com> wrote:
> Issue was that service cores can remain running while main thread
> has freed service-core memory, later racy return of service lcore
> then causes use-after-free.
>
> This commit fixes it by
> A) resetting all service cores to return
> B) waiting for them to return
> C) freeing memory
>
> I am confident in the fix.

Ok.

> > > a race-condition on eal_cleanup(), where the service core
> > > could still be executing while the main thread has already
> > > free-d the service memory, leading to a segfault.
> > >
> > > Fixes: 21698354c832 ("service: introduce service cores concept")

The race per se was introduced with:
da23f0aa87d8 ("service: fix memory leak with new function")


--=20
David Marchand