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 AD1AD43B6C; Thu, 7 Mar 2024 08:02:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3247A42E82; Thu, 7 Mar 2024 08:01:57 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.61]) by mails.dpdk.org (Postfix) with ESMTP id 7C39742E94; Thu, 7 Mar 2024 08:01:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jswb97msk91n+08AMUA54UbD84OuegpJQH2XOSnp+p4IbX+823On8jQxA8pKSiwoPJ0rv4kyJrxjkGk4OPUsqP/UTzyd4GD+PJ4plhh+2N6pDS6C3eySNhDkUEew7haJkenzay6QoxROI71gkcepyWnQxRst7FDFLDvx6tLi4S2NVi2YZlx+htStdKjaqtnaFGIkAgF8bB4RW6F0lkQirl4ejzLFTMqNnq4RVVFOqa3WbSUrtjxRwqmd4DvzWhK+IGkwe8pcmFKsA0YC6DEphsTH9z0nFNkiPyPTz3UQkyfEdUxzD4IZ4eJTvlxMPRLs1slkYkm1MZiQFb/GeL8sBg== 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=BRe2Bi1f/4Zz0mqYB/6kBl84T8JJ/Ma2hR8DDRJGVow=; b=F7hzuxJSAUygsGFFpbuIqyi4eUrUL2vxW/y3D255uB1HSFFSrZqdZur5L3cg6Bm9oQXNFZaWmZecutCKDASTm8obBPLey7tY45TuzCGmxQ69Gt/bGb+htqtgS3RXsSOTZDMQbx+hJXNDRXXqjg9vg8yyANWqVNQUct4FXeeV+H/VQqJqlzcxgVLoMynsZAn/AG74RkOy4In4+zLhrEaXbHs0+p7Yws6u6ebKKWmxOl3ITJpAekA3/NfNyicKiSHnvpQVZBDCR8BaWk9+KrnlCHedQ7/3/kNms5Ia1BhuiW3FKii2CFQ/fQwaxEcwJaDTy1kREDednr1p/9R6o96YTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BRe2Bi1f/4Zz0mqYB/6kBl84T8JJ/Ma2hR8DDRJGVow=; b=X0tYslezMYXhTkXSkY0AAm73UeDwkwvqvicG8kPN1jrZvWTGTDFZ/+8+jEY/GlSVfsELE43a62pD18v7XZwRi30w93bB5JYAIGrPEESy1PAHtefiqbrJtX8pHNp5me3DUMuI/xK2gofjfHYAqXkfsNuFFIoswBSBlMKwQmsoJgxS28lEWBQzxoegqnokvMO/syserB89PbhUKxT7N/ePC5XkMdgfZtkCPf3XIsjMptIRYrwiTh1pqmjWkcIkjBzcACwykjrSoGC1Oi+JiXqY2mMmOTWGhdpuKBqT5qlPANmXrfcnPmydyCZYNWwAi/6hxJ89xp9K5u5izIQ40sv1IQ== Received: from CH0PR04CA0026.namprd04.prod.outlook.com (2603:10b6:610:76::31) by DS7PR12MB8419.namprd12.prod.outlook.com (2603:10b6:8:e9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Thu, 7 Mar 2024 07:01:51 +0000 Received: from CH1PEPF0000AD7F.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::55) by CH0PR04CA0026.outlook.office365.com (2603:10b6:610:76::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24 via Frontend Transport; Thu, 7 Mar 2024 07:01:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CH1PEPF0000AD7F.mail.protection.outlook.com (10.167.244.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Thu, 7 Mar 2024 07:01:50 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Wed, 6 Mar 2024 23:01:32 -0800 Received: from rnnvmail203.nvidia.com (10.129.68.9) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Wed, 6 Mar 2024 23:01:31 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12 via Frontend Transport; Wed, 6 Mar 2024 23:01:30 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , Subject: [PATCH v2 4/5] eal: fix first time primary autodetect Date: Thu, 7 Mar 2024 07:01:12 +0000 Message-ID: <20240307070113.29580-5-artemyko@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240307070113.29580-1-artemyko@nvidia.com> References: <20231212042517.164353-2-artemyko@nvidia.com> <20240307070113.29580-1-artemyko@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD7F:EE_|DS7PR12MB8419:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bb95190-8625-43c0-7f91-08dc3e7476bf X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2QbuQy4mC6VhQtkoYAkFKNQDBWpP1JqKJwKBzEsuXlQi0ILar710+9IEYM+4X0lh7auuIOz/MiGo1ojNvnKHa7+pBP8wqrlfo/41o9XwMpuJ8ARQqcl8AeVdxaXT0S6O6k5whZ5gJo8Nw6SAJ28cTTsQ/f1+AhUWA6p2kQUKs3pYcKIApfO920GpQVioGOrDZa51ZQaUs9DwpTE81BTBWTQtKLT/1CexNdyVSEl89o0V50rQ/9Xyonj64MfYpYT7HvkGO+WqUt0FrGMOkUbYB4owG5AktsFQECxX31z0ZClCEREgEC/uY47WHOspkRxQaUOcC6oal1uV6h62AJTO3Jeh2EHi+VqrsIPMU1GkqW55vKd+RpX8VB0+U7gGSdHLvADztO6VGUWYZWnQkh1xZ802klGNAzCwSfq+riWv/qrBLV7DYkTnPEsHy5xWmRL7bhqcnsDgJ1R14kt5BZT0JAmLtl5w95T4y7sojwVpIsrYXtE7K8dV33Y9xxcPmbhbjDgfviQnB1ITRfkt3tvQRsE8Xe9kmCG/qKXjdiv30LDcqOjAodB7OKRBxK05m0oPGzuu3swh5gV8jNzhCk6F3PZTKqCppSlrP7PEHF8YkrNQLfS4zu99F98buklX4FemffZE52H4o09maM0s3L+57P8qMxvuUlO+NZc290dklS5W0cCtm0FwYKQ1FQR8Jz3DguFxsS4vHdNs0fBNUleV7w4/JLaa9C7jrd/YHy1pEk2dsRcaf1NeBA8xqJsAKF9l X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 07:01:50.7439 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bb95190-8625-43c0-7f91-08dc3e7476bf X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD7F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8419 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 If the configuration file is absent, the autodetection function should generate and secure it. Otherwise, multiple simultaneous openings could erroneously identify themselves as primary instances. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Artemy Kovalyov --- lib/eal/linux/eal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 57da058..9b59cec 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -360,7 +360,7 @@ enum rte_proc_type_t * keep that open and don't close it to prevent a race condition * between multiple opens. */ - if (((mem_cfg_fd = open(pathname, O_RDWR)) >= 0) && + if (((mem_cfg_fd = open(pathname, O_RDWR | O_CREAT, 0600)) >= 0) && (fcntl(mem_cfg_fd, F_SETLK, &wr_lock) < 0)) ptype = RTE_PROC_SECONDARY; } -- 1.8.3.1