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 ACDDFA0579 for ; Tue, 6 Apr 2021 23:11:06 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 99D43140FA1; Tue, 6 Apr 2021 23:11:06 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2078.outbound.protection.outlook.com [40.107.20.78]) by mails.dpdk.org (Postfix) with ESMTP id A87E54067C; Tue, 6 Apr 2021 23:11:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2GRxmh1gu5rOkP+p5B1KpPO2DNR3/c09uPG4CmFVMb8=; b=oxSuXEy5zdkSnQns5u0qWPH/6Jh1x4E4zkm3cv9qRf5Xzw8LP7n2OMxjG653TxcqoMYwGqRMfL4/eJRMevzEGwvw4xQq8sQw94x50fa+ElD4WQUMDrqvNOebyCXfTORZ92LSSgeYgxKiJK6cKsu9EfxNH4PW7ogt0mi8j96bAkQ= Received: from DB6PR07CA0088.eurprd07.prod.outlook.com (2603:10a6:6:2b::26) by AM6PR08MB3320.eurprd08.prod.outlook.com (2603:10a6:209:48::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Tue, 6 Apr 2021 21:11:01 +0000 Received: from DB5EUR03FT030.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2b:cafe::8d) by DB6PR07CA0088.outlook.office365.com (2603:10a6:6:2b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.9 via Frontend Transport; Tue, 6 Apr 2021 21:11:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT030.mail.protection.outlook.com (10.152.20.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29 via Frontend Transport; Tue, 6 Apr 2021 21:11:01 +0000 Received: ("Tessian outbound b610e7b4d771:v90"); Tue, 06 Apr 2021 21:11:01 +0000 X-CR-MTA-TID: 64aa7808 Received: from fe4a82b13778.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EFEC16D5-2967-4E44-A657-B2D60D467619.1; Tue, 06 Apr 2021 21:10:51 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id fe4a82b13778.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 06 Apr 2021 21:10:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PL/CxHJijuKGJmYduJjUUQaMUwiNcF9mHlzvTEc4zdr5uUcxVEKbGUVVwp8KC6EVX1+/LwY8m77400WYLKMYTFjvQ2LuiyyhSZp/I1MUZydmDbLCiZpnV5UtLm29BPSm9hsrBuNh1OTWmNfCX0Wuom8axbAsb0ZCZw53gfGkg0rKJAyqzfDSMZNFnqvbEmoV+LaczqeUmyMa92XrOlsqMPeLo/mmwd0f81A5li+7izkcmC0kzwqvuX1lBwVaS/VCIRUIKA9oqp5CoMpMXORF2utGujhz4Yh/Ke+wBMCbg7E5A1vRryFEXq7oECBhufEpDjlWk5Fmnz47vn3V8PFk1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2GRxmh1gu5rOkP+p5B1KpPO2DNR3/c09uPG4CmFVMb8=; b=C1MT8bNQm3s0+LC8+cA85A5rmJbNl6Krj1I/p+EaK3r8YdwtO1vpFOLfuhpU3RvUsjrmF4cr0g4cUqjdnZzEIl802s4gVfEv5J3XHFSnDObrF8EnTNWnMvp1ZMhamKuOQY/M+0/HtOLelwe7p6vBX/ANX21BNVhso+o60HC461vU41RPYXdpPBKw6cFQP/Mkww4ScVJbN0gLl2Vs68D7GpYxVF3sWg/tv2fFNRIRlygG/r1U44gE2EofQs0AFclJDmbHp0FgnuGfgZcN+wO1Lqx1jB8mRngmlJv7p3huPPyE1HwPFex9SNi14SDwxBNSu9Kn5XiqxwnCK3qMqkrz3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2GRxmh1gu5rOkP+p5B1KpPO2DNR3/c09uPG4CmFVMb8=; b=oxSuXEy5zdkSnQns5u0qWPH/6Jh1x4E4zkm3cv9qRf5Xzw8LP7n2OMxjG653TxcqoMYwGqRMfL4/eJRMevzEGwvw4xQq8sQw94x50fa+ElD4WQUMDrqvNOebyCXfTORZ92LSSgeYgxKiJK6cKsu9EfxNH4PW7ogt0mi8j96bAkQ= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DBBPR08MB4869.eurprd08.prod.outlook.com (2603:10a6:10:de::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.29; Tue, 6 Apr 2021 21:10:49 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::2994:a01e:2de:f94e]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::2994:a01e:2de:f94e%7]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 21:10:49 +0000 From: Honnappa Nagarahalli To: Luc Pelletier , "olivier.matz@6wind.com" , "jianfeng.tan@intel.com" CC: "dev@dpdk.org" , "stable@dpdk.org" , nd , Honnappa Nagarahalli , nd Thread-Topic: [PATCH v3] eal: fix race in ctrl thread creation Thread-Index: AQHXKwBrceAxTlj7AEWrSn0WEv+OJaqn4gAQ Date: Tue, 6 Apr 2021 21:10:48 +0000 Message-ID: References: <20210324130422.92357-1-lucp.at.work@gmail.com> <20210406161534.103272-1-lucp.at.work@gmail.com> In-Reply-To: <20210406161534.103272-1-lucp.at.work@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: E4770B8672BC1348B9A35A65C96A9BEB.0 x-checkrecipientchecked: true Authentication-Results-Original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [70.113.13.105] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 1158ac5c-cf26-4b65-518f-08d8f9407b7c x-ms-traffictypediagnostic: DBBPR08MB4869:|AM6PR08MB3320: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:8882;OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: dozaz+kAmGC1lDFbaUExqaoCfkJfhpsmbU7vM/f5msh7/uSNvlOeJhooOh4hw/cj8XnBuivUBg0kOIE9k1JGo9HPkqTfcxwJntVO9fsyrxclnQB+V/D71HKvAgH72GSNrXNYGOfst3X3GwBDZUbTirsfbf9dyQNaqsI7xHr6gWWcbrnRUscQCN/2I+J/kCgH8xM+wypKN4MQRRpPQB2zheXE8VkOX7GB3VBO+oav5RS1aF1EOeKms240UwG+M5aWT5/wjY4Nsi2s+9jH6Up9/ljNBP1djJRiB1iNGdmoF3JX5jxjeWtHAJqbBPhPYXQqHF4Xq7dB6a76WgKmjoBTS0g3PHLR4t+mGnmL7zhY31E4Rce7yS5lApJhANe9O2R/YRJi3oEUsDpKtacAy03oU+RVI1vikttaL5+cuFfUr9lrjVNljJvf4yGzlJZGemVtNpjZdHKQF+8hiYoLnjk1x10wg+qjDP5xcDL0F1hWctCEy05RQSHWL3aWvMY1U6W4DGGPFEHe5sXYdFkBoXrvV5NqlvE9zlfFf48m9L56pLEdyjRX9r5u/2M+4gusDobytKy+Q7TJzwbOPFWzO0PqyGyrDDFzBSLdRPxRswxb5U+J68y+Vzke/InbJygVSWrGE3BSsKle/9y1oCXkk9AedyZpYcz6r5I+m6nGNC2NJjg= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(366004)(39860400002)(136003)(376002)(346002)(26005)(6506007)(8936002)(478600001)(186003)(66446008)(110136005)(5660300002)(316002)(55016002)(9686003)(38100700001)(83380400001)(66476007)(66556008)(64756008)(2906002)(7696005)(71200400001)(76116006)(66946007)(52536014)(54906003)(33656002)(4326008)(8676002)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?M4/aQrgmO6On2eyBEMFZ8TteQ2GPV+N2jpNWuA3Q7NjJahjoowZ7gYzVzSZ7?= =?us-ascii?Q?awbHxhs1n0F2j33RMlXHm89eyY94gp3zuF+7D8At4nRT+64Y5pndz7h/4MPt?= =?us-ascii?Q?oMLjpCaq1x+bWLAoyDkTa9MzFqFZdRbzLndXr39l3vXv09IKZDkHIhQ6/44E?= =?us-ascii?Q?HeLFiBr8JGRL4CoeKJV7sQhCqiy7I7EW2bT5hvDh/opR5d5rB66mDyFNDz4s?= =?us-ascii?Q?45Jm9aNml4QcaH3FA8DyrGMhvCNCthF/q0I6G6Wx+57kD//VDHByCcS0kqtd?= =?us-ascii?Q?aG/nIF7p3UWnvEsrXmy1TGzDkwm/ptNK2H53K5Y1ZfsdwAAZ6/gNIQFDSSaw?= =?us-ascii?Q?FlSbWKS9zcHS/dlhETmsFwp+agvNByCOK+Ypjil2ZhOaVUx0XEBrUbGZt83h?= =?us-ascii?Q?glXgB4qlCHoPwDRBxZUDy5Fl8I7/sBu+dK+2TZ0IIpwdESbOBAFfzwiuOPHC?= =?us-ascii?Q?s38zOZ6h5RZZxlnA2bAg4nZn6n/faJoXbSfLnOnhVV5Csob/Cigwk4ayPnQW?= =?us-ascii?Q?OYBiLklBIP6FJ5XjDEiIxglS2PkvjpYbhmqPGPnKVih5A5quwoKUgbVkwwpL?= =?us-ascii?Q?Dlo6q5tTPskc2gSWla2e7Kmi+6iTfCv1EurlM/I/h/btrAM/R88QAbDnEmJz?= =?us-ascii?Q?6/MkDV5OYaLntD8/CpZIoHZ/D30HHASf2k5Z+J43gdRlo+V1WExUAYY5Z7z2?= =?us-ascii?Q?kviJ5+o0knw2j04HzvCiFR6tFH9xx9c56yPbfS8dr5U/lMDxjWexSkuHo7dH?= =?us-ascii?Q?BaUvnPmTf1GxzGViT6IKF8V3UlkJjhQ09uNDnbHRcmb3TqmKj4k431hzF4CY?= =?us-ascii?Q?MWbswOVOWRNRrnT/xA18xgJlw6gs22NJQK4oYo3bwvHP8YuAr2/kuxDPb0Qv?= =?us-ascii?Q?3aWksuI47BT1bVdf6l0+4ZqXd3k8ghjdnE3G/8hObT7Gi0ezgWvyn1r+Q+wG?= =?us-ascii?Q?FXJuK+BF+Ka22WSQckiICKmBllDQbUZ8akmBd4EvIMxouMJ7Q8oNPQAAT85C?= =?us-ascii?Q?osb3WWknJ343entU2Eon+SZRpTjM+y2Zuyfcw2zrc8Enait/vbD+fawJ/LFt?= =?us-ascii?Q?Tbz8bL6t8g+kRjeeWJuLjSsntLnfNWg1H8ofdj76a9ij8ezORlgqx4cplXKS?= =?us-ascii?Q?5B8HuddMVILPqf/PJ1R4QF102nTpZoH3zmcmaVPo3yFrgcJ7JzJxgQpppyAO?= =?us-ascii?Q?f8G6SjR7piTXnjrO9+1RhUXXjKqxo0duwZsE8Mi32zESeici0ol/hyinqdqV?= =?us-ascii?Q?TWvQMnco9okq23LBW/XyngqGSoPwTahqQ0+Oa1Va7DOA4Sfjm8jvd77EXm56?= =?us-ascii?Q?G5ZN16imXipH9A/lOCB9m54l?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB4869 Original-Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT030.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: e3c63064-f76b-461b-5db1-08d8f9407403 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: txiLYEvewSBFf3RkzxKae6Orf7nXPBEp34215SysXJ/5AhRojABgX7x/Kb+AnPt4mqYhi1V1Tf0/VmrTRBoueltaGLnKpuCklPf+njL+ooluz3h6p8/jv4h5EHrs98DDSp+bUx71BGz4D/fJV4DXEA7oAILfSZVV/wGsUplYSbV72XJCXfpsgxUo3LOK/2wkhYEB0+EFgknwODtKZUHaw/iR0wd3XkF4uVEFKsgQz2832CyvhMPrOoKg6Eai3nWbWZA64VditjWdfuhXk5jhrkc1qB77FeIO/ZOFyDE7cq7bu+fH3DUE2SRwGpUIfAg+W7aiDTolDyDNDQ7L7T/LYxvHaY9gDUXg2wmemCQoNyIs6E7kmLtqMdWuUl8JqGs/BVmK4DWNPC5GUl9okTMkWph0QMzw4UVLcAG1a2tPsHz/nZyvPXvWXW6zHL6NjPMYsSLLIO+zYq5cXlr0W3lSS25Lofa1Tst4duqtgjckunOfX1hSuZhIKhRSqGMqV9ICNZo3afyhdYg+w+BEZIwjXpbWnw1Qc0msg6h0R8u7NevdMuBCWiTl3lWg1uGl/A9fkDRzXVrxuiiQ9nNJ2bq9rfeZfqO9wlekN9Z5jWpgGIQo4s935zWQlkH7p5MAQwQcmUdwVFZQsQC7sFXBCcmPeQ== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(136003)(346002)(36840700001)(46966006)(110136005)(36860700001)(2906002)(81166007)(7696005)(83380400001)(5660300002)(26005)(9686003)(4326008)(52536014)(186003)(86362001)(70586007)(356005)(33656002)(8676002)(6506007)(82740400003)(54906003)(70206006)(336012)(8936002)(82310400003)(478600001)(450100002)(55016002)(316002)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 21:11:01.7788 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1158ac5c-cf26-4b65-518f-08d8f9407b7c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT030.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3320 Subject: Re: [dpdk-stable] [PATCH v3] eal: fix race in ctrl thread creation 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 Sender: "stable" >=20 > The creation of control threads used a pthread barrier for synchronizatio= n. > This patch fixes a race condition where the pthread barrier could get > destroyed while one of the threads has not yet returned from the > pthread_barrier_wait function, which could result in undefined behaviour. > The barrier has been completely removed in favour of a reference count on > the control thread parameters struct. >=20 > Fixes: 3a0d465d4c53 ("eal: fix use-after-free on control thread creation"= ) > Cc: jianfeng.tan@intel.com > Cc: stable@dpdk.org >=20 > Signed-off-by: Luc Pelletier > --- >=20 > Hi Olivier, > Hi Honnappa, >=20 > Thanks for your input Honnappa. I've made the changes to completely > remove the barrier. However, I didn't move the call to pthread_setaffinit= y_np I looked at the rte_ctrl_thread_create API definition. I am not sure if we = have much leavy here as the API definition bakes in calling pthread_setaffi= nity_np. With the barrier, the control thread did not execute its function till it w= as moved to the assigned core. If we remove the barrier and not move the pt= hread_setaffinity_np to ctrl_thread_init, the behavior might change. One more comment below on how we are handling the setaffinity failure. > to the control thread; I think we want to report the result of that funct= ion to > the caller of rte_ctrl_thread_create and doing so from ctrl_thread_init w= ould > be a lot trickier. >=20 > Olivier, what do you think of these changes? >=20 > lib/librte_eal/common/eal_common_thread.c | 35 ++++++++--------------- > 1 file changed, 12 insertions(+), 23 deletions(-) >=20 > diff --git a/lib/librte_eal/common/eal_common_thread.c > b/lib/librte_eal/common/eal_common_thread.c > index 73a055902..2421066f9 100644 > --- a/lib/librte_eal/common/eal_common_thread.c > +++ b/lib/librte_eal/common/eal_common_thread.c > @@ -169,12 +169,11 @@ __rte_thread_uninit(void) struct > rte_thread_ctrl_params { > void *(*start_routine)(void *); > void *arg; > - pthread_barrier_t configured; > + unsigned int refcnt; > }; >=20 > static void *ctrl_thread_init(void *arg) { > - int ret; > struct internal_config *internal_conf =3D > eal_get_internal_configuration(); > rte_cpuset_t *cpuset =3D &internal_conf->ctrl_cpuset; @@ -184,11 > +183,8 @@ static void *ctrl_thread_init(void *arg) >=20 > __rte_thread_init(rte_lcore_id(), cpuset); >=20 > - ret =3D pthread_barrier_wait(¶ms->configured); > - if (ret =3D=3D PTHREAD_BARRIER_SERIAL_THREAD) { > - pthread_barrier_destroy(¶ms->configured); > + if (__atomic_sub_fetch(¶ms->refcnt, 1, __ATOMIC_ACQ_REL) =3D=3D > 0) > free(params); > - } >=20 > return start_routine(routine_arg); > } > @@ -210,14 +206,11 @@ rte_ctrl_thread_create(pthread_t *thread, const > char *name, >=20 > params->start_routine =3D start_routine; > params->arg =3D arg; > - > - pthread_barrier_init(¶ms->configured, NULL, 2); > + params->refcnt =3D 2; >=20 > ret =3D pthread_create(thread, attr, ctrl_thread_init, (void *)params); > - if (ret !=3D 0) { > - free(params); > - return -ret; > - } > + if (ret !=3D 0) > + goto fail; >=20 > if (name !=3D NULL) { > ret =3D rte_thread_setname(*thread, name); @@ -228,24 > +221,20 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name, >=20 > ret =3D pthread_setaffinity_np(*thread, sizeof(*cpuset), cpuset); > if (ret) > - goto fail; > + goto fail_cancel; >=20 > - ret =3D pthread_barrier_wait(¶ms->configured); > - if (ret =3D=3D PTHREAD_BARRIER_SERIAL_THREAD) { > - pthread_barrier_destroy(¶ms->configured); > + if (__atomic_sub_fetch(¶ms->refcnt, 1, __ATOMIC_ACQ_REL) =3D=3D > 0) > free(params); > - } >=20 > return 0; >=20 > -fail: > - if (PTHREAD_BARRIER_SERIAL_THREAD =3D=3D > - pthread_barrier_wait(¶ms->configured)) { > - pthread_barrier_destroy(¶ms->configured); > - free(params); > - } > +fail_cancel: > pthread_cancel(*thread); For the control thread to be able to respond to pthread_cancel, it needs to= call one of the library functions that is considered a cancellation point.= I do not see such requirements in the API definition. > pthread_join(*thread, NULL); > + > +fail: > + free(params); > + > return -ret; > } >=20 > -- > 2.25.1