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 492D143894; Thu, 11 Jan 2024 16:13:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 381504067B; Thu, 11 Jan 2024 16:13:16 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2083.outbound.protection.outlook.com [40.107.237.83]) by mails.dpdk.org (Postfix) with ESMTP id 8A7784025E; Thu, 11 Jan 2024 16:13:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q+9eGFeWvxrb+q0qrOpzM7RPcqAwXEQfbCZbRT+9MXBZLP0G+HsTtRz7rkEQVb2LOcabIv8Z7KyUunib/66C2+hPpue81O9RGcK3TvXLSvtkMYiAqLYTeT9cApalx/Sy/VxPVFkPh3VI7K1gvaYGT3BJI2BAfVJVwhj5DrfgOARTpIJWW7SEkV8CComHFSn+Dx7bIP0OneXAW8a+DL52bDOIhwiZufkPhHOD0+m/43p+hdFDB7GB3kEuZTQpggKlIKcAQ7+4P9e4VCmkLVlca+uejTXmclzdo2zicQVz60M04OlnifATQhU8pxALvQqR8GIU2Iw0QWJYyoHxTK39Ww== 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=o5w/2RGGXNjm+HbIXapleh+4zHjI9t535JK3J9Ah7KI=; b=oEaZtuIDHrKEn+75IQ/sNBEWbTexHA78mPhgKaMGgUkMFyd/3b322uJgYJlp9gQ4zezAVNGtJPUGHeAib1cE7BODOSVmnWvio4lbmf8Gwrzs46mWGJJS7ks70PRpzihc2dFVQQc+Z8hBg/TBJW+2SgzqhUHoJDW6APfYjbUtC1CENVzXsvv6EePMaPrHi3wWKEMDLbao+r8qljJkaJ4a8C7J/nbkbtOgBhjOg/kscvaeoAEGPaJc7vlpzO3dQHVCfM0xa0aq6kwVnRU+BHtqaqWeiaOdFCxac3I9JiXFadTV4Aew78V4bzk9kBBi4Avag7jCna7BkHvXxef2h6S+LA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o5w/2RGGXNjm+HbIXapleh+4zHjI9t535JK3J9Ah7KI=; b=cW+Fm92oNjfJUaV9U/UPp5grSUY7YogLn6zc3G+Kc71zsEfkj8p6d9MmQ7l+dB7hq6MbVZlWuIjfX4nX37u2FqgfC2fixUOWDTndkFWlXvCs6YjsFUN02sWV8As35XCgObj3PDdqPsLmPYYTBfPN3LN8PHnfoJx0fm1MhRuZpSg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by SJ2PR12MB8009.namprd12.prod.outlook.com (2603:10b6:a03:4c7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.17; Thu, 11 Jan 2024 15:13:09 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::815a:45e6:cf5e:479f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::815a:45e6:cf5e:479f%4]) with mapi id 15.20.7181.018; Thu, 11 Jan 2024 15:13:09 +0000 Message-ID: <790591da-ccae-4716-9149-722d22973f69@amd.com> Date: Thu, 11 Jan 2024 15:12:59 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [dpdk-dev v4 2/2] net/tap: fix buffer overflow for ptypes list through driver API update Content-Language: en-US To: Sivaramakrishnan Venkat , Igor Russkikh , Selwin Sebastian , Ajit Khaparde , Somnath Kotur , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Yuying Zhang , Beilei Xing , Rahul Lakkireddy , Hemant Agrawal , Sachin Saxena , Simei Su , Wenjun Wu , Gagandeep Singh , John Daley , Hyong Youb Kim , Gaetan Rivet , Qi Zhang , Xiao Wang , Jie Hai , Yisen Zhuang , Jingjing Wu , Qiming Yang , Junfeng Guo , Andrew Boyer , Long Li , Matan Azrad , Viacheslav Ovsiienko , Dariusz Sosnowski , Ori Kam , Suanming Mou , Zyta Szpak , Liron Himi , Chaoyong He , Jiawen Wu , Harman Kalra , Devendra Singh Rawat , Alok Prasad , Andrew Rybchenko , Jerin Jacob , Maciej Czekaj , Jian Wang , Jochen Behrens , Thomas Monjalon Cc: dev@dpdk.org, stable@dpdk.org, ferruh.yigit@intel.com References: <20231221184001.928922-1-venkatx.sivaramakrishnan@intel.com> <20240104175111.2190075-1-venkatx.sivaramakrishnan@intel.com> <20240104175111.2190075-3-venkatx.sivaramakrishnan@intel.com> From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iAR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+YPekbrsKp1maZArGeu+6FuW honeosIrWS98QJmscEhP8ooyJkLDCCOgEk+mJ/JBjzcJGuYn6+Iy/ApMw/vqiLGL1UWekcTA g18mREHqIR+A3ZvypIufSFB52oIs1zD/uh/MgmL62bY/Cw6M2SxiVxLRsav9TNkF6ZaNQCgn GqifliCEMvEuLZRBOZSYH2A/PfwjYW0Ss0Gyfywmb2IA990gcQsXxuCLG7pAbWaeYazoYYEQ NYmWatZNMAs68ERI2zvrVxdJ/fBWAllIEd0uQ4P05GtAHPdTIDQYp545+TPV7oyF0LfXcsQs SFVZE6igdvkjfYmh+QOrHGZvpWXLTmffVf/AQ81wspzbfxJ7sYM4P8Mg5kKOsaoUdyA/2qVe cMh1CLUHXF1GlofpGbe1lj4KUJVse5g3qwV7i9VrseA8c4VIZewdIjkzAhmmbxl+8rM/LKBH dZUMTzME5PFCXJIZ83qkZQ795MTe2YScp9dIV7fsS5tpDwIs7BZNVM1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: <20240104175111.2190075-3-venkatx.sivaramakrishnan@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR0P281CA0192.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:ab::11) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SJ2PR12MB8009:EE_ X-MS-Office365-Filtering-Correlation-Id: 318fc3a0-7bca-4102-cf9f-08dc12b7d1c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 64CUurDtKQGamBggcT5pHL05uKm1GAB1HZ/+HXHLeM6uwz1oCuLQrjBfZY9Hqx0jR4gFDWu4RIO8H7UfJysEPMZ/Ba2+ysJ4JVGZHG+sVpeJu+RQL6ETnLH2CNDZXYk9DqdhOQYjcZ+CQgBfff+EtZnlW5KxZKSADrX/LzmGvYakfQiEAQ99HWUAvv1gqFfVUf5TImw3YDwZdu1Zfy2HpXOVP5pmgHGI7qTV9fBRUU4Qdp+AbcQ8JntTYCIVhRXhEmyNNN0SiDMpCBfxb7cBbyYAq3Fbz+UEQkF/ytDfTigsygbe6mkSSJY/yhz9sc1db0kJ+WvPjMYomkMxrMeVIyAXyWr5fXyeKPBdYs9a2i+kds0jKjGnNh7tz0/Up/KSSJyDfzUc4g31VLMpKcDRLYtTmfoamU3rA20U/BIWTtCzBpqGzEleVH0SbsjAYw0pr3WK9nie3NiI+mc7/73m/MhAd5yq3nSQf8zMn+EBoGMrSmUX0q/CzFVIzl83muj4kKsnp3LVPPBzVHkmzHOpXy23zJ/7JDXZ3QMITKkT/Ffho6K0MLhSjbUXsYoqSiX6mM7cRnqPaO9rYTEHhZpF7bYc5JIvf40go/MFpg+EeQ5zipEEjHCYfWQ8T/9yNufD0QdQa3E4DLPXr7UOknHk9pZK1t7GTkjDy0xBUKvd8Tk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(136003)(346002)(366004)(396003)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(38100700002)(86362001)(36756003)(921011)(31696002)(41300700001)(2616005)(44832011)(4326008)(26005)(53546011)(6506007)(6666004)(66476007)(110136005)(66556008)(66946007)(316002)(478600001)(31686004)(6512007)(8936002)(8676002)(7406005)(7416002)(2906002)(6486002)(83380400001)(15650500001)(5660300002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?UlQ4L2Z3Qk50UDZUemNoV2xYUndVK1JnaFdrK3c5WDZGa0VzeGpPUEV4TnE0?= =?utf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wLzRoWkNX?= =?utf-8?B?Y3NRYkJ1aE0reVcreXM1RVRqcjJUSlRlMHBpdk9GdnEwQ2R0L1NVV3NRbUhU?= =?utf-8?B?NCs4OUgrMjhvaWtoU3dzMHBhQWhCdjlqZFN0MFd3QklaUGVnOGdHZTBGTi9w?= =?utf-8?B?NnM4QzhhMW53b3FBWG0zUkZjcjZVaW1SdFN4SGpmTG5lTXdXZk5ETTlwM3FN?= =?utf-8?B?bHV6aEVFbFJhR1g1M2FPQ09NNFBxMEVadkdOemo0MW9LWklLMGhUQVR2OTNz?= =?utf-8?Q?zV90=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 318fc3a0-7bca-4102-cf9f-08dc12b7d1c6 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2024 15:13:09.0031 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9pDBB/1zLlLuQX1krM5OiucY5yQjkN8un0er9JCDigW/VBNQ94Wscsu+2ZhpAf4f X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8009 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 On 1/4/2024 5:51 PM, Sivaramakrishnan Venkat wrote: > Incorrect ptypes list causes buffer overflow for Address Sanitizer > run. Previously, the last element in the ptypes lists to be > "RTE_PTYPE_UNKNOWN" for rte_eth_dev_get_supported_ptypes(), but this was > not clearly documented and many PMDs did not follow this implementation. > Instead, the dev_supported_ptypes_get() function pointer now returns the > number of elements to eliminate the need for "RTE_PTYPE_UNKNOWN" > as the last item. > > Fixes: 47909357a069 ("ethdev: make device operations struct private") > Cc: ferruh.yigit@intel.com > Cc: stable@dpdk.org > I think this is not fix, your previous patch fixes mentioned issue, but this patch improved code to make sure it will be correct in the future. Can you please update the commit log accordingly, remove fixes and stable tag and patch title can be something like: "drivers/net: return number of types in get supported ptypes" > Signed-off-by: Sivaramakrishnan Venkat > --- > <...> > > diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c > index 3a028f4290..bc087738e4 100644 > --- a/drivers/net/atlantic/atl_ethdev.c > +++ b/drivers/net/atlantic/atl_ethdev.c > @@ -43,7 +43,8 @@ static int atl_dev_stats_reset(struct rte_eth_dev *dev); > static int atl_fw_version_get(struct rte_eth_dev *dev, char *fw_version, > size_t fw_size); > > -static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev); > +static const uint32_t *atl_dev_supported_ptypes_get(struct rte_eth_dev *dev, > + size_t *no_of_elements); > > static int atl_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); > > @@ -1132,7 +1133,8 @@ atl_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > } > > static const uint32_t * > -atl_dev_supported_ptypes_get(struct rte_eth_dev *dev) > +atl_dev_supported_ptypes_get(struct rte_eth_dev *dev, > + size_t *no_of_elements) > Can be single line, no need to break the line. Same for some other drivers, can you please check all. > { > static const uint32_t ptypes[] = { > RTE_PTYPE_L2_ETHER, > @@ -1143,12 +1145,13 @@ atl_dev_supported_ptypes_get(struct rte_eth_dev *dev) > RTE_PTYPE_L4_TCP, > RTE_PTYPE_L4_UDP, > RTE_PTYPE_L4_SCTP, > - RTE_PTYPE_L4_ICMP, > - RTE_PTYPE_UNKNOWN > + RTE_PTYPE_L4_ICMP > Better to keep trailing ',' to reduce change when new ptypes appended in the future, like: "RTE_PTYPE_L4_ICMP," <...> > @@ -348,7 +348,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) > } > > static const uint32_t * > -dpaa_supported_ptypes_get(struct rte_eth_dev *dev) > +dpaa_supported_ptypes_get(struct rte_eth_dev *dev, > + size_t *no_of_elements) > { > static const uint32_t ptypes[] = { > RTE_PTYPE_L2_ETHER, > @@ -363,14 +364,16 @@ dpaa_supported_ptypes_get(struct rte_eth_dev *dev) > RTE_PTYPE_L4_TCP, > RTE_PTYPE_L4_UDP, > RTE_PTYPE_L4_SCTP, > - RTE_PTYPE_TUNNEL_ESP, > - RTE_PTYPE_UNKNOWN > + RTE_PTYPE_TUNNEL_ESP > }; > > PMD_INIT_FUNC_TRACE(); > > - if (dev->rx_pkt_burst == dpaa_eth_queue_rx) > + if (dev->rx_pkt_burst == dpaa_eth_queue_rx) { > + *no_of_elements = RTE_DIM(ptypes); > return ptypes; > + } > + *no_of_elements = 0; No need to set it to '0' when NULL returned, it is already 0 by default. There are other drivers doing this, can you please check all? <...> > @@ -2261,19 +2261,22 @@ ice_dev_supported_ptypes_get(struct rte_eth_dev *dev) > RTE_PTYPE_INNER_L4_UDP, > RTE_PTYPE_TUNNEL_GTPC, > RTE_PTYPE_TUNNEL_GTPU, > - RTE_PTYPE_L2_ETHER_PPPOE, > - RTE_PTYPE_UNKNOWN > + RTE_PTYPE_L2_ETHER_PPPOE > }; > > - if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) > + if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS) { > + *no_of_elements = RTE_DIM(ptypes_comms); > ptypes = ptypes_comms; > - else > + } else { > + *no_of_elements = RTE_DIM(ptypes_os); > ptypes = ptypes_os; > + } > > if (dev->rx_pkt_burst == ice_recv_pkts || > dev->rx_pkt_burst == ice_recv_pkts_bulk_alloc || > - dev->rx_pkt_burst == ice_recv_scattered_pkts) > + dev->rx_pkt_burst == ice_recv_scattered_pkts) { > return ptypes; > + } > No need to add { }, same below. <...> > @@ -3978,7 +3979,8 @@ ixgbe_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) > } > > static const uint32_t * > -ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev) > +ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev, > + size_t *no_of_elements) > { > static const uint32_t ptypes[] = { > /* For non-vec functions, > @@ -3998,21 +4000,25 @@ ixgbe_dev_supported_ptypes_get(struct rte_eth_dev *dev) > RTE_PTYPE_INNER_L3_IPV6, > RTE_PTYPE_INNER_L3_IPV6_EXT, > RTE_PTYPE_INNER_L4_TCP, > - RTE_PTYPE_INNER_L4_UDP, > - RTE_PTYPE_UNKNOWN > + RTE_PTYPE_INNER_L4_UDP > }; > > if (dev->rx_pkt_burst == ixgbe_recv_pkts || > dev->rx_pkt_burst == ixgbe_recv_pkts_lro_single_alloc || > dev->rx_pkt_burst == ixgbe_recv_pkts_lro_bulk_alloc || > - dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc) > + dev->rx_pkt_burst == ixgbe_recv_pkts_bulk_alloc) { > + *no_of_elements = RTE_DIM(ptypes); > return ptypes; > + } > > #if defined(RTE_ARCH_X86) || defined(__ARM_NEON) > if (dev->rx_pkt_burst == ixgbe_recv_pkts_vec || > - dev->rx_pkt_burst == ixgbe_recv_scattered_pkts_vec) > + dev->rx_pkt_burst == ixgbe_recv_scattered_pkts_vec) { > + *no_of_elements = (sizeof(ptypes) / sizeof(uint32_t)); > Why not use 'RTE_DIM()' here? <...> > diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h > index b482cd12bb..9b03d27e62 100644 > --- a/lib/ethdev/ethdev_driver.h > +++ b/lib/ethdev/ethdev_driver.h > @@ -448,7 +448,8 @@ typedef int (*eth_dev_infos_get_t)(struct rte_eth_dev *dev, > struct rte_eth_dev_info *dev_info); > > /** @internal Get supported ptypes of an Ethernet device. */ > -typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev); > +typedef const uint32_t *(*eth_dev_supported_ptypes_get_t)(struct rte_eth_dev *dev, > + size_t *no_of_elements); > Can you please add doxygen comments, and document new paramter there. There are samples in same file, like 'eth_promiscuous_enable_t' one. Thanks, Ferruh