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 59D1F436CB; Tue, 12 Dec 2023 05:26:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2164442DFE; Tue, 12 Dec 2023 05:25:48 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id 0F04C42DF1; Tue, 12 Dec 2023 05:25:47 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FkUFvuIxrYnZKxXLaQpvOc2kDO/5j1aUnielFZzOyFWd+AFeKAOHwuuKE2Wzzj4m+nKGmMx47E5knSIWmLQZh3IkfTbO4WSv33InHLRw8BOmCIPfzsvIiDne0yN2foqlw9otWfUUw/qsLCNb0lrtO9MgH1Ai2ISJ82kUXXasRtm/rf7mZRR6dVcsb8GjdiSJywnGMKF/EhP4l5qWXeVFcP92iQcJbjiWp4PskEg9SQHBTxqzEvi4TWBpeBrO1EO1h1k3nnmnS/2hg/63Ru8NEap5lKF81t0M20ohxhfF/spsLmlkFHD6aAk8PAesdf1oGbcMvhP4eIOlN7njP8yyPA== 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=McAaobECjm1uFfz8/WLn+tMVOnMUulSXIN9IU+Kpz8wjuEiXVNKJKRe5z1kMvsQPqZ3pwS8dHVyvmEXcXiO//XWdW2rbPojR1LBtAGhA8ySR/mElBxJ98ODpXzNVUKcZq7tqocohn2q5IHMThcVoW0ncq5Lq1CircJIRz/xqAKj7ASSxh1jpi+JI38MLUX4G64Ju2vSS/lyAbTycDJiS49yATjUd22yF2jhDU6Qc62vGqjywAlz4zcWWL7YlhztY5I5Ky7abZEV+zhYQ+n7XI/x+k5j4Ly4Mtk7xC/ur0aBl+a2l6nF1Jf6UbDSprNt1Q+v8j5tQ2+fy5t0qrl73Dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=h2D3Qt1v1J6CgLtYxx52VItwasOsv8Dgdx3+n1u8hKTubOXdpUkAn+4Ld8e22xKsXepASipTtpD4WJ4rdYD4oyYbHd9XViVRMY5yJ/RhAkyw7no5h0wAWVOQ0DucwAdvzZC4z2pENAUAZaVYMK5ieryTujO4uanDcRGBJJ5M9orsVq8kO/cf+NUzXjB+Sg8o2UlmNyrU4lxVD7NeKrpvIDTdx3Ikbx0MoK11KxKkfDe7AaSsq916O+N1nVAZcgIdlIH7LlqRZc6XIy32llOf3Qprbru0KTomgNLVuOrDrp1BBUQBVmW7XsKx6JVv4ASkepbPMK88VywZwtUtEPbVIA== Received: from SN7PR18CA0026.namprd18.prod.outlook.com (2603:10b6:806:f3::18) by CH3PR12MB9341.namprd12.prod.outlook.com (2603:10b6:610:1cd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Tue, 12 Dec 2023 04:25:43 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:806:f3:cafe::e0) by SN7PR18CA0026.outlook.office365.com (2603:10b6:806:f3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32 via Frontend Transport; Tue, 12 Dec 2023 04:25:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.18 via Frontend Transport; Tue, 12 Dec 2023 04:25:43 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 11 Dec 2023 20:25:33 -0800 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 11 Dec 2023 20:25:32 -0800 Received: from nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41 via Frontend Transport; Mon, 11 Dec 2023 20:25:31 -0800 From: Artemy Kovalyov To: CC: Thomas Monjalon , Subject: [PATCH 4/5] eal: fix first time primary autodetect Date: Tue, 12 Dec 2023 06:25:15 +0200 Message-ID: <20231212042517.164353-5-artemyko@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212042517.164353-1-artemyko@nvidia.com> References: <20231212042517.164353-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: SA2PEPF000015C6:EE_|CH3PR12MB9341:EE_ X-MS-Office365-Filtering-Correlation-Id: 1eb852e5-80fa-47b6-34b5-08dbfaca67d9 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: z9FIQ1zQsCJO5rvAhImzAaFiZVMSMKIyIS4p+ONtcY90ogfCIWHGTxvKHo8WY8m2Ic++OIXMAzLcxvC1YI9pLBCGXl53TVGxi0BV9+wVuY5rGDKndpzoB1ad4DPnXR9TqN7TFAElTBWpcpTUspJfyVU3bFZDRpi4mx9s4iBDie6MMlOpIz0sKXC8EjpEBsGkUph5d8BJp4CdY2Cw3odmJTk8FJjCRgUnZPbrhegqUqpnj0R4blMsftQdhYXEV8XNDSDj2Rcawzj3F1kWf6aSKGOeJ65DshJEus2tpK424HimHzOOrKTbvTkur73hQMK/yJHm5KE6sGC3DLk9j+Lq6cIUEGwqhYLkSbooeYRBSKKlZkok9VaLff0HVCp+8iGGVZ2nudFhgCuvSunBZXDDzpe8h6I/3RTuI5i3jn+dnRE+WivyraRgUvjKqee7jdSmQJ1IGUoUJZ4P5l+84HelL8Fz11NiYgcCsAB96+X4/becGXOAR51Q/U2TY5Ncw2gz8aUJG+KAa+QxLocxBZ6EKCW7uTLIgQvnxRKY46FAiFcAtfhYNjy30POQkPjlPQbdTPuw1a/hFT8QPlgYzliWQD0gdOTSPDVm8U/XvQP8qp7zgICPalho31+avMhMm5NvkZM9O6XYKxdwt0WWzHwoZb7hK3gzUzrhK3JXNyhPq3nsSuNdstgxa/geHS7TMrCX50gok/rkYLlA7JQFShRwWPx8Aqp6+EflG9zANk6y1+K94tw7i+/+btrAl9h94TQ/ X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(136003)(396003)(39860400002)(376002)(346002)(230922051799003)(82310400011)(451199024)(186009)(64100799003)(1800799012)(40470700004)(46966006)(36840700001)(40460700003)(26005)(336012)(6286002)(426003)(83380400001)(7696005)(2616005)(1076003)(47076005)(36860700001)(5660300002)(4326008)(8936002)(41300700001)(8676002)(4744005)(2906002)(6666004)(478600001)(316002)(6916009)(54906003)(70206006)(70586007)(36756003)(86362001)(7636003)(82740400003)(356005)(40480700001)(55016003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2023 04:25:43.4432 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1eb852e5-80fa-47b6-34b5-08dbfaca67d9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9341 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