From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C9669457A1
	for <public@inbox.dpdk.org>; Mon, 12 Aug 2024 14:56:00 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C1699402C3;
	Mon, 12 Aug 2024 14:56:00 +0200 (CEST)
Received: from NAM12-MW2-obe.outbound.protection.outlook.com
 (mail-mw2nam12on2065.outbound.protection.outlook.com [40.107.244.65])
 by mails.dpdk.org (Postfix) with ESMTP id 728194029C
 for <stable@dpdk.org>; Mon, 12 Aug 2024 14:55:58 +0200 (CEST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=B4AJriIkuAvBlJlDKJXxesmSRqjhz83hNva+AV/0Zv81CvMjujJBLcciCcKVoShsAle9Urcg3MAak6F/TUXi6GMhzM7AkZqW8e7vsRKVm0wRZTRWr+z8TsTOrjBwI7zHsaaBoaJ3/TKlet6XRedSOehTSiGMgTZi7QLKq7cU7DW846JhBvjQ9JGG71sb5VwZRjv5DjE7Svt8dJ/5Zf/SBQ2TN72n3wQzv6u0fE09EQaZnXZBZeUMXUPx+f+ovBhYUADrH9Y4KmEGtOvFeDbTOuJ2Mihs4jU0xtL7WOAnvr+FTS9ejpb7Ykshdz4rX3zF6HVIu7djqQVTySrmuMSHkA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector10001;
 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=/8PFHzbHE1Vd9EOT1gUk5XEXazuVf8XopPrk6ZZRuYA=;
 b=ixdxU2rFkbl6aAJ69okcyUYZbVXiHQRP9/8Lsq4GoysvSGDOmQWHhLMy1G44m3aCpWjf9Cqsaxk34O67r3/u6A4evKNJxBi/ya4lpWQauiAQB3Z1/jqgTg1/tQfG765fR9NVVY8cp5qKOWgAqVoJv1auOa00seug1d4lK5VbgYlIbajnRwuzq8b/bV5Z4rq37Txgamkl1okyyGs+tpeFlB7LF4s5cJnQHh4jkSOxrXbp4I6PTfEJaC3XkX2kXdByl2KDYKqpw79sWKZrQdF/ZdOGcUWJRN7I9cRSyMUQ/YY9rrYCtaZVtSFTXre+P3z2hpcINSaJq6QfcpK1gA0flw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is
 216.228.117.160) smtp.rcpttodomain=redhat.com 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=/8PFHzbHE1Vd9EOT1gUk5XEXazuVf8XopPrk6ZZRuYA=;
 b=t/9NsLPpPQiqETFcZfrXH8v/gSs7+xmfXIN8ucFR+KURwWwLNZbHuRFNH56nCeHny4Boyks8BXbrk0qpsKzfovGbSY7LrnqgYp2zpk/AmHCqaJ6G/uClAhEFepylLzkGE1Fa9itqrqgxwefttC+p4ur8sKpjN+RESHxRA1yvIhup1NGCIILIkC4ba6dDyrdw1vGX3JUG3yWIT6Yn0RHTdiy274UFbmS3KSoIbE62g98k/SG+7JTfpAvfp0NzihIF9BP0cxnzkSXewP7JF63iow5qvf5OcevqXh7BYz91V2FM/ZntqU+5lTvCtKl/mlPvTqm/pRyOHQRE33LqhFbucg==
Received: from DM6PR08CA0056.namprd08.prod.outlook.com (2603:10b6:5:1e0::30)
 by SJ2PR12MB9007.namprd12.prod.outlook.com (2603:10b6:a03:541::18) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Mon, 12 Aug
 2024 12:55:55 +0000
Received: from DS1PEPF00017094.namprd03.prod.outlook.com
 (2603:10b6:5:1e0:cafe::c7) by DM6PR08CA0056.outlook.office365.com
 (2603:10b6:5:1e0::30) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22 via Frontend
 Transport; Mon, 12 Aug 2024 12:55:55 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160)
 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.160 as permitted sender) receiver=protection.outlook.com;
 client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C
Received: from mail.nvidia.com (216.228.117.160) by
 DS1PEPF00017094.mail.protection.outlook.com (10.167.17.137) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.7828.19 via Frontend Transport; Mon, 12 Aug 2024 12:55:54 +0000
Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com
 (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 12 Aug
 2024 05:55:40 -0700
Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com
 (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 12 Aug
 2024 05:55:38 -0700
From: Xueming Li <xuemingl@nvidia.com>
To: David Marchand <david.marchand@redhat.com>
CC: <xuemingl@nvidia.com>, Ali Alnubani <alialnu@nvidia.com>, Song Jiale
 <songx.jiale@intel.com>, dpdk stable <stable@dpdk.org>
Subject: patch 'buildtools: fix build with clang 17 and ASan' has been queued
 to stable release 23.11.2
Date: Mon, 12 Aug 2024 20:48:47 +0800
Message-ID: <20240812125035.389667-51-xuemingl@nvidia.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20240812125035.389667-1-xuemingl@nvidia.com>
References: <20240712110153.309690-23-xuemingl@nvidia.com>
 <20240812125035.389667-1-xuemingl@nvidia.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Originating-IP: [10.126.230.35]
X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To
 rnnvmail201.nvidia.com (10.129.68.8)
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DS1PEPF00017094:EE_|SJ2PR12MB9007:EE_
X-MS-Office365-Filtering-Correlation-Id: b2601e6f-9a68-4345-33d5-08dcbace1a80
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
 ARA:13230040|36860700013|1800799024|376014|82310400026; 
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?uFkGzmqvbPd9ecGWLTZy4Wi+jbOmQAFWnZP169zAETy69C6ytBqvczJllIoO?=
 =?us-ascii?Q?A32QBfqRqlGJRChP6DJZIzlE7IfDTurFLINm8JXbqjLf9BuN00U/HLQbgYOq?=
 =?us-ascii?Q?jgGCN+n00g1sQzwUQt5vhUEyDQaJrbSx69gIfUkX3qXRQfVS0BZJ6BRdsNd1?=
 =?us-ascii?Q?gzLHb2TFxKqbibDku4zJ6sn5ZS5OPwRFgGPGuIAcahp5Zm8yhXg3tR0b0Xg7?=
 =?us-ascii?Q?qwdus8C1M3bilNUQ0qLT+ej3mJnMqb+Mz2xNBLCO2ygsmfxGa38QxWI5z5o0?=
 =?us-ascii?Q?TjFtm+pHC+ml2Xkq9G760B/ihvwEhsGGhyX+rlrX+xfosD6xCwVAWmyKOIJd?=
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6DCiD1KNgsNezz/rZCNUjXxLczhJYvpgF+KbyLnfMvRq3J2?=
 =?us-ascii?Q?D5UYSgHOmx7GVVtO2WMnP9ylOoRP7/K2Z3TOapfl+F3VeeMSTAGrK/+t91lK?=
 =?us-ascii?Q?cBJnPs+ZaZ4bSs2Ypdc2sL5JnEpByTz1lbtyfYpERbq063zZ6MuXKJysNqhy?=
 =?us-ascii?Q?FkYJe57wJtibKCQ4gzzVIGClkuINroFhaMBIFc55FwapH8RLHpHDGrY3+SlY?=
 =?us-ascii?Q?Wmu4gH2XePi6Ss500RY2rkH+Kjog7NoO?=
X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE;
 SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT;
 SFP:1101; 
X-OriginatorOrg: Nvidia.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2024 12:55:54.8844 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: b2601e6f-9a68-4345-33d5-08dcbace1a80
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.160];
 Helo=[mail.nvidia.com]
X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017094.namprd03.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9007
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Hi,

FYI, your patch has been queued to stable release 23.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/14/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=aafeb830bc49268349189d0b0b6d76559e8358ca

Thanks.

Xueming Li <xuemingl@nvidia.com>

---
>From aafeb830bc49268349189d0b0b6d76559e8358ca Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 11 Jul 2024 11:35:36 +0200
Subject: [PATCH] buildtools: fix build with clang 17 and ASan
Cc: Xueming Li <xuemingl@nvidia.com>

[ upstream commit e1d8a879abac499a66801bb8238d59ba52f4fc6b ]

ASan included in clang 17 and later suffixes symbols.
$ nm build/drivers/libtmp_rte_net_null.a | grep this_pmd
0000000000000000 r this_pmd_name3
0000000000000000 n this_pmd_name3.f2cd16678ab09dba8fd23405d8d11fce

This breaks the detection of driver symbols in pmdinfogen which then
creates duplicate symbols "_pmd_info" in many drivers. Such duplicate
symbols trigger a link error.

$ grep -w _pmd_info build/drivers/rte_net_*.pmd.c
build/drivers/rte_net_af_packet.pmd.c:const char _pmd_info[]
	__attribute__((used)) =
	"PMD_INFO_STRING= {\"name\": \"\", \"pci_ids\": []}";
build/drivers/rte_net_null.pmd.c:const char _pmd_info[]
	__attribute__((used)) =
	"PMD_INFO_STRING= {\"name\": \"\", \"pci_ids\": []}";

A simple reproducer:
$ CC=clang meson setup build -Denable_apps=test-pmd -Ddisable_libs=* \
  -Denable_drivers=net/null,net/af_packet -Dtests=false \
  -Db_lundef=false -Db_sanitize=address

$ ninja -C build

Before this patch, the pmdinfogen script was relying on a symbol name
starting with this_pmd_name.
On the other hand, what this script needs is symbols whose names are
this_pmd_name ## __COUNTER__, see below an example for PCI driver
symbols (the same applies to other buses).

$ git grep -w RTE_PMD_EXPORT_NAME drivers/bus/pci/bus_pci_driver.h
drivers/bus/pci/bus_pci_driver.h:RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
$ git grep -B1 this_pmd_name lib/eal/
lib/eal/include/rte_dev.h-#define RTE_PMD_EXPORT_NAME(name, idx) \
lib/eal/include/rte_dev.h:static const char
	RTE_PMD_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
$ git grep define.RTE_PMD_EXPORT_NAME_ARRAY lib/eal/include/rte_dev.h
lib/eal/include/rte_dev.h:#define
	RTE_PMD_EXPORT_NAME_ARRAY(n, idx) n##idx[]

Adjust the symbol filter for both ELF and COFF implementations.

Bugzilla ID: 1466

Reported-by: Ali Alnubani <alialnu@nvidia.com>
Reported-by: Song Jiale <songx.jiale@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Tested-by: Song Jiale <songx.jiale@intel.com>
---
 buildtools/pmdinfogen.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/buildtools/pmdinfogen.py b/buildtools/pmdinfogen.py
index 2a44f17bda..dfb89500c0 100755
--- a/buildtools/pmdinfogen.py
+++ b/buildtools/pmdinfogen.py
@@ -6,6 +6,7 @@
 import argparse
 import ctypes
 import json
+import re
 import sys
 import tempfile
 
@@ -66,11 +67,11 @@ class ELFImage:
                 return [symbol]
         return None
 
-    def find_by_prefix(self, prefix):
-        prefix = prefix.encode("utf-8") if self._legacy_elftools else prefix
+    def find_by_pattern(self, pattern):
+        pattern = pattern.encode("utf-8") if self._legacy_elftools else pattern
         for i in range(self._symtab.num_symbols()):
             symbol = self._symtab.get_symbol(i)
-            if symbol.name.startswith(prefix):
+            if re.match(pattern, symbol.name):
                 yield ELFSymbol(self._image, symbol)
 
 
@@ -97,9 +98,9 @@ class COFFImage:
     def is_big_endian(self):
         return False
 
-    def find_by_prefix(self, prefix):
+    def find_by_pattern(self, pattern):
         for symbol in self._image.symbols:
-            if symbol.name.startswith(prefix):
+            if re.match(pattern, symbol.name):
                 yield COFFSymbol(self._image, symbol)
 
     def find_by_name(self, name):
@@ -199,7 +200,7 @@ class Driver:
 
 def load_drivers(image):
     drivers = []
-    for symbol in image.find_by_prefix("this_pmd_name"):
+    for symbol in image.find_by_pattern("^this_pmd_name[0-9]+$"):
         drivers.append(Driver.load(image, symbol))
     return drivers
 
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-08-12 20:44:04.201813065 +0800
+++ 0050-buildtools-fix-build-with-clang-17-and-ASan.patch	2024-08-12 20:44:02.055069287 +0800
@@ -1 +1 @@
-From e1d8a879abac499a66801bb8238d59ba52f4fc6b Mon Sep 17 00:00:00 2001
+From aafeb830bc49268349189d0b0b6d76559e8358ca Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl@nvidia.com>
+
+[ upstream commit e1d8a879abac499a66801bb8238d59ba52f4fc6b ]
@@ -49 +51,0 @@
-Cc: stable@dpdk.org