From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 80CE241E09 for ; Tue, 7 Mar 2023 15:33:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5965640EDB; Tue, 7 Mar 2023 15:33:46 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 3D56D4067B for ; Tue, 7 Mar 2023 15:33:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678199623; 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=QoUlIJ5nM6MoXB3i/CWtU49B58i+ustZHoS/rJ+ZUCU=; b=RS7E2H3gTVTfl5ocCZk+WWHPBzgx0Hd0WYiv98LqI77oT7BzIO2j2DKOd7GTTmyGMgBQnf aJkTXNKZtZ3WlRT8lpBzzJ35ySqFp2UTLQndvA9hZ5EZU54Nv7JClQ4VvFy+aM9ftbioXx j1uqsURq4DQUR4c0EP4oAh9ACkK+jvE= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142-7znVTi_mMbm3UpLJLUFa-g-1; Tue, 07 Mar 2023 09:33:42 -0500 X-MC-Unique: 7znVTi_mMbm3UpLJLUFa-g-1 Received: by mail-pj1-f69.google.com with SMTP id f1-20020a17090aa78100b00239fd9e3e17so5136710pjq.5 for ; Tue, 07 Mar 2023 06:33:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678199621; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QoUlIJ5nM6MoXB3i/CWtU49B58i+ustZHoS/rJ+ZUCU=; b=59y0v6Lo3nsIZYBchXzomYIpBOCQxsfDOayRtacolwQUepCbOZFnX0Mhz5B+HsLLyQ n2IHy4uq8W8+A0vlOmRSiHOoIbcszDqri9Jxs5u01+jzS1mE8UIuj3I7jjztFonLCz2p v818g51LA3uOhIRtj0YKKe2WOsqNCwQl2M/xiigXLnI250Eefv4mJVlb07332CHZRIC2 oufhB91BDK1IW/xS0kTcS50fKS+jb/vAaOfFcFxMOgQyuBOAlALb28kbrbiSGElgNhQg ev1X+cPCelRmBGxlFUCT2U/278zgmRXrh7UENskRAQDaqZLh2jqDzPom6eJmICjak38E FVTg== X-Gm-Message-State: AO0yUKW9GVZNJmTwZguQnO6W/ZTQwRQubVzPO9BXSjrO7p4IgbkxfI7e r63mC1qNXQqUejYCPUhsm/YSYOPyPrAkjx0CoRcUnA9UNuDYV2CUWbz0E2ihdCa1uzr7KcuQ9Xy uA9Rj8ea70CphvRGQ6jy+G8s= X-Received: by 2002:a17:90a:8a82:b0:234:b4ad:d598 with SMTP id x2-20020a17090a8a8200b00234b4add598mr5429360pjn.7.1678199621111; Tue, 07 Mar 2023 06:33:41 -0800 (PST) X-Google-Smtp-Source: AK7set9F4y4yb/gc4FMjl1nmU59cXGr3IA9qSEcOq5EdgoXFuXrHqyI1ArtrfFPQIRSaYKvrLu3frCUM8LPx12awSBg= X-Received: by 2002:a17:90a:8a82:b0:234:b4ad:d598 with SMTP id x2-20020a17090a8a8200b00234b4add598mr5429347pjn.7.1678199620749; Tue, 07 Mar 2023 06:33:40 -0800 (PST) MIME-Version: 1.0 References: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> In-Reply-To: <1677782682-27200-1-git-send-email-roretzla@linux.microsoft.com> From: David Marchand Date: Tue, 7 Mar 2023 15:33:29 +0100 Message-ID: Subject: Re: [PATCH 1/2] eal: fix failure race and behavior of thread create To: Tyler Retzlaff Cc: dev@dpdk.org, 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 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 On Thu, Mar 2, 2023 at 7:44=E2=80=AFPM Tyler Retzlaff wrote: > > In rte_thread_create setting affinity after pthread_create may fail. > Such a failure should result in the entire rte_thread_create failing > but doesn't. > > Additionally if there is a failure to set affinity a race exists where > the creating thread will free ctx and depending on scheduling of the new > thread it may also free ctx (double free). > > Resolve both of the above issues by using the pthread_setaffinity_np > prior to thread creation to set the affinity of the created thread. By > doing this no failure paths exist after pthread_create returns > successfully. > > Fixes: ce6e911d20f6 ("eal: add thread lifetime API") > Cc: stable@dpdk.org > Cc: roretzla@linux.microsoft.com > > Signed-off-by: Tyler Retzlaff Reviewed-by: David Marchand --=20 David Marchand