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 D934D43819; Thu, 4 Jan 2024 18:51:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ABE1340608; Thu, 4 Jan 2024 18:51:23 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by mails.dpdk.org (Postfix) with ESMTP id D92FB402C7; Thu, 4 Jan 2024 18:51:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704390682; x=1735926682; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X58WXY5GWu/rJ4XNR5qw08v31vls9KxNxFM67Xy2JqQ=; b=JZtbLlRtX6NQKd2ZZTpTxN/pQUt333lxbas9joJPuqp4o6VO3mz+I0Vx N8tRHgcqOT/zARazEqGMMZz4idR+NjgBm6sTRvyfr+T5OSUJmAh+f1Qf8 JTL/sMCGijiH5bONuGjMAjIBFVYiMT/rwlMBCnySWoBZJpzRp3UgbsiT4 emcartRnZiiN+UndJsAvB3ZZ2YkKZTRwmatmtzsFjWJsU3SF/sGhwVyIl 6QS9LOJsjAFzLBSh58VOzxiAs+KHfzEMJMYw7uQimmOD6Ma+3I8rql3Eh yZdo59TGGYNluj7k1gVhhPVtbqWTv9kfrubpfFLG6gHinKHO3/cHaCYKw w==; X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="4133276" X-IronPort-AV: E=Sophos;i="6.04,331,1695711600"; d="scan'208";a="4133276" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2024 09:51:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="871000819" X-IronPort-AV: E=Sophos;i="6.04,331,1695711600"; d="scan'208";a="871000819" Received: from silpixa00400902.ir.intel.com ([10.243.23.146]) by FMSMGA003.fm.intel.com with ESMTP; 04 Jan 2024 09:51:18 -0800 From: Sivaramakrishnan Venkat To: Hemant Agrawal , Sachin Saxena , Zyta Szpak , Liron Himi , Chaoyong He , Gagandeep Singh , Jerin Jacob , Maciej Czekaj Cc: dev@dpdk.org, stable@dpdk.org, Sivaramakrishnan Venkat , pascal.mazon@6wind.com, tdu@semihalf.com, jianfeng.tan@intel.com, jerin.jacob@caviumnetworks.com Subject: [dpdk-dev v4 1/2] net/tap: fix buffer overflow for ptypes list through updation of last element. Date: Thu, 4 Jan 2024 17:51:10 +0000 Message-Id: <20240104175111.2190075-2-venkatx.sivaramakrishnan@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240104175111.2190075-1-venkatx.sivaramakrishnan@intel.com> References: <20231221184001.928922-1-venkatx.sivaramakrishnan@intel.com> <20240104175111.2190075-1-venkatx.sivaramakrishnan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Incorrect ptypes list causes buffer overflow for Address Sanitizer run. The last element in the ptypes lists to be "RTE_PTYPE_UNKNOWN" for rte_eth_dev_get_supported_ptypes(). In rte_eth_dev_get_supported_ptypes(),the loop iterates until it finds "RTE_PTYPE_UNKNOWN" to detect last element of the ptypes array. Fix the ptypes list for drivers. Fixes: 0849ac3b6122 ("net/tap: add packet type management") Fixes: a7bdc3bd4244 ("net/dpaa: support packet type parsing") Fixes: 4ccc8d770d3b ("net/mvneta: add PMD skeleton") Fixes: f3f0d77db6b0 ("net/mrvl: support packet type parsing") Fixes: 78a38edf66de ("ethdev: query supported packet types") Fixes: 659b494d3d88 ("net/pfe: add packet types and basic statistics") Fixes: 398a1be14168 ("net/thunderx: remove generic passX references") Cc: pascal.mazon@6wind.com Cc: zr@semihalf.com Cc: tdu@semihalf.com Cc: jianfeng.tan@intel.com Cc: g.singh@nxp.com Cc: jerin.jacob@caviumnetworks.com Cc: stable@dpdk.org Signed-off-by: Sivaramakrishnan Venkat --- drivers/net/dpaa/dpaa_ethdev.c | 3 ++- drivers/net/mvneta/mvneta_ethdev.c | 3 ++- drivers/net/mvpp2/mrvl_ethdev.c | 3 ++- drivers/net/nfp/nfp_net_common.c | 1 + drivers/net/pfe/pfe_ethdev.c | 3 ++- drivers/net/tap/rte_eth_tap.c | 1 + drivers/net/thunderx/nicvf_ethdev.c | 2 ++ 7 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index ef4c06db6a..779bdc5860 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -363,7 +363,8 @@ 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_TUNNEL_ESP, + RTE_PTYPE_UNKNOWN }; PMD_INIT_FUNC_TRACE(); diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c index daa69e533a..212c300c14 100644 --- a/drivers/net/mvneta/mvneta_ethdev.c +++ b/drivers/net/mvneta/mvneta_ethdev.c @@ -198,7 +198,8 @@ mvneta_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) RTE_PTYPE_L3_IPV4, RTE_PTYPE_L3_IPV6, RTE_PTYPE_L4_TCP, - RTE_PTYPE_L4_UDP + RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN }; return ptypes; diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index c12364941d..4cc64c7cad 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.c +++ b/drivers/net/mvpp2/mrvl_ethdev.c @@ -1777,7 +1777,8 @@ mrvl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) RTE_PTYPE_L3_IPV6_EXT, RTE_PTYPE_L2_ETHER_ARP, RTE_PTYPE_L4_TCP, - RTE_PTYPE_L4_UDP + RTE_PTYPE_L4_UDP, + RTE_PTYPE_UNKNOWN }; return ptypes; diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index e969b840d6..46d0e07850 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1299,6 +1299,7 @@ nfp_net_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_INNER_L4_NONFRAG, RTE_PTYPE_INNER_L4_ICMP, RTE_PTYPE_INNER_L4_SCTP, + RTE_PTYPE_UNKNOWN }; if (dev->rx_pkt_burst != nfp_net_recv_pkts) diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c index 551f3cf193..0073dd7405 100644 --- a/drivers/net/pfe/pfe_ethdev.c +++ b/drivers/net/pfe/pfe_ethdev.c @@ -520,7 +520,8 @@ pfe_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_L3_IPV6_EXT, RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, - RTE_PTYPE_L4_SCTP + RTE_PTYPE_L4_SCTP, + RTE_PTYPE_UNKNOWN }; if (dev->rx_pkt_burst == pfe_recv_pkts || diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index b41fa971cb..3fa03cdbee 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1803,6 +1803,7 @@ tap_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused) RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_SCTP, + RTE_PTYPE_UNKNOWN }; return ptypes; diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index a504d41dfe..5a0c3dc4a6 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -392,12 +392,14 @@ nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev) RTE_PTYPE_L4_TCP, RTE_PTYPE_L4_UDP, RTE_PTYPE_L4_FRAG, + RTE_PTYPE_UNKNOWN }; static const uint32_t ptypes_tunnel[] = { RTE_PTYPE_TUNNEL_GRE, RTE_PTYPE_TUNNEL_GENEVE, RTE_PTYPE_TUNNEL_VXLAN, RTE_PTYPE_TUNNEL_NVGRE, + RTE_PTYPE_UNKNOWN }; static const uint32_t ptypes_end = RTE_PTYPE_UNKNOWN; -- 2.25.1