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 61F0CA0556; Mon, 17 Oct 2022 10:03:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4A5A94021D; Mon, 17 Oct 2022 10:03:33 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2058.outbound.protection.outlook.com [40.107.104.58]) by mails.dpdk.org (Postfix) with ESMTP id 250FE40143 for ; Mon, 17 Oct 2022 10:03:32 +0200 (CEST) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=jZ3KrvC+OmV4jOXr1rSPXBZ88z45iMfohtgNdAj4T7H0qr9+mUHBssBV7EHmHBkGq/hKfl7fINJhhRiDu7Wnsg02SB1ZpXHJjGK9Q0o+bPT4yVrKOYpn+zW4hJt7H6QdZJoH5VdoT/R8T7XSyIDU13VXOFyMBDxLt1Ka3vqtfKFXenwYNS6CV9v6Sawd6N1B0IS3btKp5jqEsW5bbfZtm2MKAsgn+Ty3j/IchDobYsT44PMrHl7rKnjMmlG8alLu7I44zpJOG3ynjBvM9tLatkmAgJX1xLk6KwUitFNRwP85EB8PStu+W9+a1HxcO/iWEOHVQfp2lCsEozRYGCHPUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=afUL0c8ouiG+6QLJE4iiiEX1XQLg3/L4Xo0+fOa5kkI=; b=NYBZe9dJGprtx2W6+oHKybLUSEvTWWMc6xGXMivAZhx1BFBFRazJ5/IjE8rjGm7CSCl6TgSQl/UV7fMB2vKOwOzPErlMZPtL/2T2SO3x1mWbUDDvCvt7W1XVVlMcno8kUptooRZoTuVE87ctzjViltzQj76jVE2nz9HLOECz4AqV3BUDrNMqekYczVaGYgfEp/G2hucoFX7lKs9tiwjW4IhlK75sZSnFmktuaC1XiFpFV/ftXuNdf+5T2C2Fva3KRaR/SGgZyKUuL19M6GbJjtTQAnwuTRdb0erDY9EQXuvPRt7TcVDnDs0A0FQ5PzbCS59+QriCypuJniyrfgXb2w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=dpdk.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) 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=afUL0c8ouiG+6QLJE4iiiEX1XQLg3/L4Xo0+fOa5kkI=; b=m4goiCRwRjZDtWas1/LPBW9gmivp/D5rJd2qGsfz90pM7NhSeRY+dOvOH7/PG6ugOCgEdeORNTi02V8q+TMnkaxP7b+oK8Pg1AE7wbH6tqLlGeCIENcPLgxJQKv3445AFwXZrL4UK/WlFVuaz55PGLamAl9KHlUMjMPOJVt2M1c= Received: from AS9PR06CA0624.eurprd06.prod.outlook.com (2603:10a6:20b:46e::27) by DU0PR08MB7663.eurprd08.prod.outlook.com (2603:10a6:10:319::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Mon, 17 Oct 2022 08:03:30 +0000 Received: from AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:46e:cafe::3d) by AS9PR06CA0624.outlook.office365.com (2603:10a6:20b:46e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.31 via Frontend Transport; Mon, 17 Oct 2022 08:03:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT034.mail.protection.outlook.com (100.127.140.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.10 via Frontend Transport; Mon, 17 Oct 2022 08:03:30 +0000 Received: ("Tessian outbound 6c699027a257:v130"); Mon, 17 Oct 2022 08:03:30 +0000 X-CR-MTA-TID: 64aa7808 Received: from 5e64920eaa23.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3087BF9B-D8B4-4179-B256-FBF0598DBA9F.1; Mon, 17 Oct 2022 08:03:23 +0000 Received: from EUR03-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5e64920eaa23.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 17 Oct 2022 08:03:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WFGICY8By6oX9jwv/YaGl9mqZbW1Air4sk7svtAKRkPJdk40ey8FWcQTrVIvTxoySexeULf1IljmRLK3twiqC55CCNYPpJaYqkxosz6srKnUbNp+TSdOS6z6qewealwU1lby8NWsDT2DxV5m78Nm32qPGFZJMeumSK5U6xz7py7msbGQxCa6foPMA5qt7tDHydCNoKxp4hX5roFu1Q4Y13MQmtkPYKk4QtjjETnB1qfwOQu2R1Jaq4DB/ukTQwURmSE3+BYFpvLoay1XMR1GJqzVSjb8dlKl8J4Tj5km6stq5UsIhbDYD/1ZqBk+Cox9bJpZj3YnH8EVBpRJ4ZN33w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=afUL0c8ouiG+6QLJE4iiiEX1XQLg3/L4Xo0+fOa5kkI=; b=ZRm4DPW7/ytc3hIdSOgx27lYNZQBn00ccxT/V7MEBEY/Sql2d2eeKKsMHfeJ1+729+LaSIAb+wRB7pXxrBgiWlf/M18mxDQU+3djwbtKOD8OJE0Eyq3wV+aCKhXw9BGt5MvV5QIlc2vWAwaNd7eT68l2OUDVOHtdZZG0cFl/4JylIWtcgK4gKHXNt51kCSj8k5bWQ8eiSz3Vi5nP2J82NFP3uAfSqwzFDO031eetsYT6pbHSc0JCJGoa928HN3pPHoH482HPnLePRKseHvxdzbK9Lz4lFogRlGIUoOkW3YLPdU4Tu5nCe8zoLYs1fCR0wwY3PChtP7/uAij1EC/dXg== 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=afUL0c8ouiG+6QLJE4iiiEX1XQLg3/L4Xo0+fOa5kkI=; b=m4goiCRwRjZDtWas1/LPBW9gmivp/D5rJd2qGsfz90pM7NhSeRY+dOvOH7/PG6ugOCgEdeORNTi02V8q+TMnkaxP7b+oK8Pg1AE7wbH6tqLlGeCIENcPLgxJQKv3445AFwXZrL4UK/WlFVuaz55PGLamAl9KHlUMjMPOJVt2M1c= Received: from AS8PR08MB7080.eurprd08.prod.outlook.com (2603:10a6:20b:401::19) by DB9PR08MB6537.eurprd08.prod.outlook.com (2603:10a6:10:250::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Mon, 17 Oct 2022 08:03:13 +0000 Received: from AS8PR08MB7080.eurprd08.prod.outlook.com ([fe80::86ce:997f:fd9b:333c]) by AS8PR08MB7080.eurprd08.prod.outlook.com ([fe80::86ce:997f:fd9b:333c%7]) with mapi id 15.20.5723.033; Mon, 17 Oct 2022 08:03:13 +0000 From: Ruifeng Wang To: Stephen Hemminger , Honnappa Nagarahalli CC: "dev@dpdk.org" , nd Subject: RE: Unsafe memory access in testpmd Thread-Topic: Unsafe memory access in testpmd Thread-Index: AQHY310RAFS55b21JUq0D0rufH3ot64SPCnA Date: Mon, 17 Oct 2022 08:03:13 +0000 Message-ID: References: <20221013163928.49930348@hermes.local> In-Reply-To: <20221013163928.49930348@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 6CD563AFCEE64145983764B0C7269FE6.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: AS8PR08MB7080:EE_|DB9PR08MB6537:EE_|AM7EUR03FT034:EE_|DU0PR08MB7663:EE_ X-MS-Office365-Filtering-Correlation-Id: d164f76f-b352-4c03-0539-08dab0161474 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: UQsuGzAL4/iUD73BPl7aY6UzjDNmgDSdFnjugLV+irR9WCDS8yHzoXe2xIaOuWU91NPLvX7yfNK2twtqpgCsc7y25XHeTk531zhdXDuNSNg/VrqLKqmGwmG2DinggwF/wLrwdOlU5P8ZcCE72m8e71232PHjYShdZgq2CH6qQzONjz++SCOL+OVLp5YFOncTo6BfDnIe7FYTEZSTNRfuCFa8DARCChDBKOiJivuaDltKxfyloVG0CYZOlAHS5tK+k1YpSO7P1WPKa192kbSCyHMHbS/JqdNXlMe7GYn9K2EC/krDMyfLuGWOUCl32aCdhl9rpS0febSEQNb5vdDcIaE8vTLRMUBFs3bhapFo5xJ+ZnHPBVAZhkvLMHX1IRZJtNd/+VlQHdJHyRcqccVOh+X5tpKveBI44iYKO0FpYA2fhbFqIs1XT7Roa3jATjk7Gut85sbGbUOx3n6cSSzRW5MGoNgBEh6AgBtDtqtC+67TZrUvOJXfKFxV3H2Xefk10+ZRdG4nZ/UbT5tPfjzhgFqOwINKBogBj2jdQDUNG9mkKMMElWaL0Hq91CCCvyM320pdg4HNxtbnbt7ZzOWhcW58g/TeOSZVl/ouE818ZFXT6AaunyFqYwcBtUHO/yMwgrqV1eTJpnl6vuj6viChzIN9jdcRwFRXAZuMEqs2DqZ10zoFQE1MwFA4qkV2t3fuVFaSPPHMTBYjNoDOW5Lg8l29EplrZVvj+D26ifjxHRaWJykFsKxu/cNXiRxDhOOHTTzBWHZQul09+Bkt6tehJw== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7080.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(136003)(396003)(366004)(346002)(376002)(451199015)(33656002)(86362001)(38100700002)(5660300002)(4744005)(2906002)(122000001)(186003)(83380400001)(38070700005)(53546011)(6506007)(7696005)(316002)(478600001)(26005)(9686003)(110136005)(71200400001)(54906003)(6636002)(66946007)(66556008)(66476007)(66446008)(76116006)(55016003)(41300700001)(52536014)(4326008)(8936002)(64756008)(8676002); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6537 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 802e9135-31fd-476c-c23c-08dab0160a4b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xx+BEPRYxB7ae0aL1y3qsFwT1gvC0xvI2pEQXBIVSSB2IxjRkfT/lv9n7emYJ8ux3JEqz6fmNXgKKJJWB+Ok0qpppeuj5wjL3/EDDS7lI7z0id4GLYrLSW4sBB3seTIyzv8D3R27qBTjV3BMs7kwSNRCvo7gtTN1oc5nHOvvJzp5xVjBwHxKyxsaa65VRvS0GtY30gQSZgKu48K+mZ80VuGQHjMihLx57W8AzvifpClmrgeSH18qlTeCHOYYXCwhbm/Wrt/VzuJV9eHk4gKy9sgkCFqTvPgHcF3Pe7Pos5QpNLptg4Bpu8ThKU5DR2KjCv3abfYYzB03l3Zh6vtHz3P1n38i3zfHgSjT62YR8+5zAceR0YLuNr5X+mPHb9HzrKXSXBSejUXETInNVkBLX57/vEDt10xrujpO4qv03Rbn3qmxDalULTt3TelLfCqO2GK6hCyu9foPvIlAZTpX+TstMgCFauze+thtaHPSdVWauNc1c2NwF2J7OsW/05X4ujzUgjGHWTFdH3MnzWSR7AGErjvDW34MswXGyzciz244+bviXy/PocnSh+RXe3NGHl7Xml7rPB3J0ViToQ0FTEUN9UO2FGybXMOuAhrBc9HkTtqmjOG8dar4Rbg+ZrGh6DOnV5zgVLnewQymdAAAoSHeSYYrZipyGRyonbisrkGrM6nCGWvAAHFGxyCQ8J8crz00b4qKQVKx+lxjNz8IPjz9oI593drpHgXC2USbFc2wzs8guegO6XKK/qAWuWs1CzoCtJAjlU+IDsfPte5VIA== 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:(13230022)(4636009)(136003)(396003)(346002)(39860400002)(376002)(451199015)(36840700001)(46966006)(40470700004)(40480700001)(55016003)(86362001)(47076005)(36860700001)(33656002)(40460700003)(82310400005)(82740400003)(356005)(81166007)(83380400001)(316002)(478600001)(54906003)(110136005)(6636002)(41300700001)(26005)(7696005)(53546011)(6506007)(8936002)(52536014)(5660300002)(9686003)(336012)(70586007)(8676002)(70206006)(186003)(4326008)(2906002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 08:03:30.4638 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d164f76f-b352-4c03-0539-08dab0161474 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: AM7EUR03FT034.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7663 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > -----Original Message----- > From: Stephen Hemminger > Sent: Friday, October 14, 2022 7:39 AM > To: Ruifeng Wang ; Honnappa Nagarahalli > > Cc: dev@dpdk.org > Subject: Unsafe memory access in testpmd >=20 > Noticed that test-pmd is using a signal handler to exit. > And that signal handle clears a flag "f_quit". > But that variable is updated without atomic and is not volatile. >=20 > Simple fix to use atomic, would fix that part. > But the signal_handler is calling a bunch of functions that are not safe = in a signal > handler. >=20 > The signal handler in testpmd should only be doing atomic update of f_qui= t. All the > cleanup logic needs to be moved to a place where thread is an safe state,= like after > exiting the forwarding loop in main thread. Agree.=20 >=20 > The problem is that testpmd has grown in complexity and not sure if this = won't break other > things. We can propose patches. Review and testing from the community are expected = to cover as many cases as possible.