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 4F61D45E41 for ; Sat, 7 Dec 2024 09:03:57 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4438340281; Sat, 7 Dec 2024 09:03:57 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2081.outbound.protection.outlook.com [40.107.243.81]) by mails.dpdk.org (Postfix) with ESMTP id 3A07640678 for ; Sat, 7 Dec 2024 09:03:55 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mHGeaNhCTfQa9MNkL1O3w+LIYxQ2GI2QzqdFXRolBEQcCSC0BtGYU+s1QwDt0qc11EDeIqkTuu8FKRlGhHOD2xyYqae0aml2zRLIZCWq1LhAXzQnwMhWfOos4P0gxNDK9Az2x80BkKXC7WIU5yIdV1EmZxwlQw8lTdqcsK5FGXC8upnsnOa45knRqTKrwbQVcNVkp0IsaUHJ+zrx3GtF9IARGXQqIMV6ggWU0rePP9gtLCt0YpO7E8Y3JnTTWJwuNd4ZhZepkaFAiJ7IoVNrTSdwZxrLLFB6pBkJYnTa7GQYTBwSYPyfh00m/WX1oOxU1MENJ/EQdFp5hkHYmI4cLA== 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=Bt9T3O5QNYmE58SrI0ToeLBKHxSUcAMCNeJo47soyAQ=; b=ciPyktQRCo2tQ21JpBRajfvvUa7viHT512nD7naR397u2FFzG/K5kMkRkBqcgNzLRIU3Yn4QfG1R2O24s9ah0Z/4uTp8l61mPREYixR4cTEUoQP+AayH5ouWx9KjytLdA79s+uEboCel3enggzruGhpJXB/+l98A1iHAgvhOkKVnFJCvpksQTLKsUjT29jBpWJoBMF7Bh2ZxQTOMCQJoLgRRuuNVLJWX0opzQ3Kw0+A378Q4M6i7jG9qlzsBqkAxUzMBm4bYLQzbtdkIkFmrOhV8GbNuLAj7Xjv0mJmSUn+mYTznmKkN44Z0u1zcb8TUOFguOvIJUNy8bwYuSfV8IA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=huawei.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=Bt9T3O5QNYmE58SrI0ToeLBKHxSUcAMCNeJo47soyAQ=; b=Df/2zYL5pwgcZqut6OiC2KUxY7f5sIoyupfeFjIYyzyZ3jpPuenETTeoN9DqazPxe2tQhcmKLfJlZfun7vqNtFkkwNfK2E311neuYOOpQmKH+PlWu54+BntU24BR0yx4CMgehwmXoXj5TS7MtwL52ezAOyPCSYr6gWSTbiuRL3nkq89VDuX0GSdWtPtPhfiF2VINYWo/v1f64ZlKSYuh61Y17HNuSeD6sX8CseXdc5yrThDM6ZRXUnqH0NWH/roEgx9wHVdmzGsvnc6YlnW59DQvyUE6aGa8UPjwUzDGItly2+EmedRQTRShhnIf4eQP8EvDXYo6g6s5DgUqXUyP+w== Received: from PH8PR20CA0007.namprd20.prod.outlook.com (2603:10b6:510:23c::9) by PH8PR12MB6916.namprd12.prod.outlook.com (2603:10b6:510:1bd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Sat, 7 Dec 2024 08:03:48 +0000 Received: from CY4PEPF0000E9DA.namprd05.prod.outlook.com (2603:10b6:510:23c:cafe::3f) by PH8PR20CA0007.outlook.office365.com (2603:10b6:510:23c::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.13 via Frontend Transport; Sat, 7 Dec 2024 08:03:48 +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 CY4PEPF0000E9DA.mail.protection.outlook.com (10.167.241.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Sat, 7 Dec 2024 08:03:46 +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; Sat, 7 Dec 2024 00:03:34 -0800 Received: from nvidia.com (10.126.231.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; Sat, 7 Dec 2024 00:03:32 -0800 From: Xueming Li To: Konstantin Ananyev CC: Xueming Li , Stephen Hemminger , dpdk stable Subject: patch 'examples/l3fwd: fix read beyond boundaries' has been queued to stable release 23.11.3 Date: Sat, 7 Dec 2024 15:59:43 +0800 Message-ID: <20241207080055.488538-26-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241207080055.488538-1-xuemingl@nvidia.com> References: <20241111062847.216344-122-xuemingl@nvidia.com> <20241207080055.488538-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: CY4PEPF0000E9DA:EE_|PH8PR12MB6916:EE_ X-MS-Office365-Filtering-Correlation-Id: 889affc7-9c56-48cb-2df4-08dd1695ad00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?k28ClGRehXHprHSagG4KGCNZcLm4My2YK4CJjQy3rrIAKu71WuqJckETFB9a?= =?us-ascii?Q?Hn4E6E0btWKjilqMOHcjF4JD0KcGma+0aLRUcXpV7S1ABI/zX4sXIhjDfdV3?= =?us-ascii?Q?H5EQUVdLzh+V6garWIKQ0LZW/IH1y/i5FOmqEjqmSlJHtb7QRkW+PzHP3ZLP?= =?us-ascii?Q?kVeUFO69ZGjmhzmAv6IEhU2rPzLnxaOX8uKyj7yfxyfgmIZFrY6nte9RtccR?= =?us-ascii?Q?MzIuzco+HYHxVX3yZjTF7SNH0h9UjNVLDFA68Xvp+owBYDjHek5l1afUzYKN?= =?us-ascii?Q?TG+QMrXB2mrX5cwmJKwIqVL41HNMQf3Yb4/xm/mGV5fnB+aOVdaTf6jJbw2d?= =?us-ascii?Q?Alz/NQej38eGt39VczaiWDlP+spUPqW5zOh46LuF5lxVH1x1lxBzW/uz1FpQ?= =?us-ascii?Q?54aS8OpEwLuqxW4Uk+cQ3CJGblYy+BY6GyXGB7ToX3FgX1bwzRHv+/Aw4joz?= =?us-ascii?Q?le3rwCG/kB3UlbfkD/dyfqJL045w9MmvYPrKIFx854s91iQUhQrAZgzhQBJo?= =?us-ascii?Q?B1j2XbUTdsZ7iybpYUM2wbaIYgp6rnwdE2rVYxULc79l0mUjZGSWqg9vipJq?= =?us-ascii?Q?fkweSWaqK9h7pKakCqfKQXRPkHoP/JHE8n03B6hjc5vIBTbPnU+cL23VCnkO?= =?us-ascii?Q?p/W/hT4kaUmjMjc0GoO0rAmBhj8Bc9CSIHK0Y4NpNVLt+8TFQelewWFi5TXu?= =?us-ascii?Q?sfjzK5AyC1z0xIedvATfFZ1k48Y3m1wI4fkP+SsG3ufDIQ3e5lHMk3GWFgZV?= =?us-ascii?Q?4h+1UeVa9WUJLs8TMC9teeDciErzKV9Y1ZDedlhSDsGN/TGHbfKT6p3lUH1P?= =?us-ascii?Q?SEO3WdNaFe4yMXKRZCtUYnoTR7hITD0Vhrx3tb3f7UY+DAg8ipuk9eKi5DbC?= =?us-ascii?Q?zb8ZH5xuC0wBT1hNqCcOf/1LrP+wT4V7KX8mAtyvoUy2Vcu4UwVaIIaJeBjx?= =?us-ascii?Q?eKZmRTlES+UQUuav/a6Hk5Q4CS/w/EvKYArwX4ua5fyUOedUID7qCEWPt2wu?= =?us-ascii?Q?+NrU/SZiUPXBJv/tdflVETnAxtxet7rBC+bna4g8j8jQd1qAMX07vaKwLI86?= =?us-ascii?Q?WlwCgBjhPkKi+0Laggh6OEiwfUq0A0GChr1nfxkPAX/j5o+753nzcAPa1/fd?= =?us-ascii?Q?HNfPryTPlfeEdeYXRBq6FB24HMEiTx85LXBJW1xk1Xetj7EVX1Eyl8DHjOkP?= =?us-ascii?Q?lUjhxOEiBcv5NYbGviQ0TfJnA1XXJFkoq2O5fMSbMM5e1SKB/YYEgwZ6dL2Y?= =?us-ascii?Q?Nu76KBmO/gy0XZCyJEycocbTx6hjqvbmUBKeixMJ5pk8NyWpwmC5MDF/py1f?= =?us-ascii?Q?LGHtRlwS4/Sa9gZQQAAfGMUqNsbeKuWhY3Ul9xp4+Yp7zx7qE1drGFGBRBbC?= =?us-ascii?Q?ooE38CGxH7SfA59FW75KnuIO7ejk33jw5FD84Kr45yZx5199l4UEoKynjiBv?= =?us-ascii?Q?gaCKGtzXyrlIYU91dG9OHueUoL13XnlA?= 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)(376014)(1800799024)(82310400026)(36860700013)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2024 08:03:46.2074 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 889affc7-9c56-48cb-2df4-08dd1695ad00 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: CY4PEPF0000E9DA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6916 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/10/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=66749b0785fc75a28a32fbbcfbf1085f0dabbb53 Thanks. Xueming Li --- >From 66749b0785fc75a28a32fbbcfbf1085f0dabbb53 Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Thu, 7 Nov 2024 13:50:51 -0500 Subject: [PATCH] examples/l3fwd: fix read beyond boundaries Cc: Xueming Li [ upstream commit ebab0e8b2257aa049dd35dedc7efd230b0f45b88 ] ASAN report: ERROR: AddressSanitizer: unknown-crash on address 0x7ffffef92e32 at pc 0x00000053d1e9 bp 0x7ffffef92c00 sp 0x7ffffef92bf8 READ of size 16 at 0x7ffffef92e32 thread T0 #0 0x53d1e8 in _mm_loadu_si128 /usr/lib64/gcc/x86_64-suse-linux/11/include/emmintrin.h:703 #1 0x53d1e8 in send_packets_multi ../examples/l3fwd/l3fwd_sse.h:125 #2 0x53d1e8 in acl_send_packets ../examples/l3fwd/l3fwd_acl.c:1048 #3 0x53ec18 in acl_main_loop ../examples/l3fwd/l3fwd_acl.c:1127 #4 0x12151eb in rte_eal_mp_remote_launch ../lib/eal/common/eal_common_launch.c:83 #5 0x5bf2df in main ../examples/l3fwd/main.c:1647 #6 0x7f6d42a0d2bc in __libc_start_main (/lib64/libc.so.6+0x352bc) #7 0x527499 in _start (/home/kananyev/dpdk-l3fwd-acl/x86_64-native-linuxapp-gcc-dbg-b1/examples/dpdk-l3fwd+0x527499) Reason for that is that send_packets_multi() uses 16B loads to access input dst_port[]and might read beyond array boundaries. Right now, it doesn't cause any real issue - junk values are ignored, also inside l3fwd we always allocate dst_port[] array on the stack, so memory beyond it is always available. Anyway, it probably need to be fixed. The patch below simply allocates extra space for dst_port[], so send_packets_multi() will never read beyond its boundaries. Probably a better fix would be to change send_packets_multi() itself to avoid access beyond 'nb_rx' entries. Bugzilla ID: 1502 Fixes: 94c54b4158d5 ("examples/l3fwd: rework exact-match") Signed-off-by: Konstantin Ananyev Acked-by: Stephen Hemminger --- .mailmap | 2 +- examples/l3fwd/l3fwd_altivec.h | 6 +++++- examples/l3fwd/l3fwd_common.h | 7 +++++++ examples/l3fwd/l3fwd_em_hlm.h | 2 +- examples/l3fwd/l3fwd_em_sequential.h | 2 +- examples/l3fwd/l3fwd_fib.c | 2 +- examples/l3fwd/l3fwd_lpm_altivec.h | 2 +- examples/l3fwd/l3fwd_lpm_neon.h | 2 +- examples/l3fwd/l3fwd_lpm_sse.h | 2 +- examples/l3fwd/l3fwd_neon.h | 6 +++++- examples/l3fwd/l3fwd_sse.h | 6 +++++- 11 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.mailmap b/.mailmap index 7990edf2d0..879d0fd81c 100644 --- a/.mailmap +++ b/.mailmap @@ -770,7 +770,7 @@ Kirill Rybalchenko Kishore Padmanabha Klaus Degner Kommula Shiva Shankar -Konstantin Ananyev +Konstantin Ananyev Krishna Murthy Krzysztof Galazka Krzysztof Kanas diff --git a/examples/l3fwd/l3fwd_altivec.h b/examples/l3fwd/l3fwd_altivec.h index e45e138e59..b91a6b5587 100644 --- a/examples/l3fwd/l3fwd_altivec.h +++ b/examples/l3fwd/l3fwd_altivec.h @@ -11,6 +11,9 @@ #include "altivec/port_group.h" #include "l3fwd_common.h" +#undef SENDM_PORT_OVERHEAD +#define SENDM_PORT_OVERHEAD(x) ((x) + 2 * FWDSTEP) + /* * Update source and destination MAC addresses in the ethernet header. * Perform RFC1812 checks and updates for IPV4 packets. @@ -117,7 +120,8 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) */ static __rte_always_inline void send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst, - uint16_t dst_port[MAX_PKT_BURST], int nb_rx) + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)], + int nb_rx) { int32_t k; int j = 0; diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h index 224b1c08e8..d94e5f1357 100644 --- a/examples/l3fwd/l3fwd_common.h +++ b/examples/l3fwd/l3fwd_common.h @@ -18,6 +18,13 @@ /* Minimum value of IPV4 total length (20B) in network byte order. */ #define IPV4_MIN_LEN_BE (sizeof(struct rte_ipv4_hdr) << 8) +/* + * send_packet_multi() specific number of dest ports + * due to implementation we need to allocate array bigger then + * actual max number of elements in the array. + */ +#define SENDM_PORT_OVERHEAD(x) (x) + /* * From http://www.rfc-editor.org/rfc/rfc1812.txt section 5.2.2: * - The IP version number must be 4. diff --git a/examples/l3fwd/l3fwd_em_hlm.h b/examples/l3fwd/l3fwd_em_hlm.h index 31cda9ddc1..c1d819997a 100644 --- a/examples/l3fwd/l3fwd_em_hlm.h +++ b/examples/l3fwd/l3fwd_em_hlm.h @@ -249,7 +249,7 @@ static inline void l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, uint16_t portid, struct lcore_conf *qconf) { - uint16_t dst_port[MAX_PKT_BURST]; + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)]; l3fwd_em_process_packets(nb_rx, pkts_burst, dst_port, portid, qconf, 0); send_packets_multi(qconf, pkts_burst, dst_port, nb_rx); diff --git a/examples/l3fwd/l3fwd_em_sequential.h b/examples/l3fwd/l3fwd_em_sequential.h index 067f23889a..3a40b2e434 100644 --- a/examples/l3fwd/l3fwd_em_sequential.h +++ b/examples/l3fwd/l3fwd_em_sequential.h @@ -79,7 +79,7 @@ l3fwd_em_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, uint16_t portid, struct lcore_conf *qconf) { int32_t i, j; - uint16_t dst_port[MAX_PKT_BURST]; + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)]; if (nb_rx > 0) { rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[0], diff --git a/examples/l3fwd/l3fwd_fib.c b/examples/l3fwd/l3fwd_fib.c index f38b19af3f..a36330119a 100644 --- a/examples/l3fwd/l3fwd_fib.c +++ b/examples/l3fwd/l3fwd_fib.c @@ -121,7 +121,7 @@ fib_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, { uint32_t ipv4_arr[nb_rx]; uint8_t ipv6_arr[nb_rx][RTE_FIB6_IPV6_ADDR_SIZE]; - uint16_t hops[nb_rx]; + uint16_t hops[SENDM_PORT_OVERHEAD(nb_rx)]; uint64_t hopsv4[nb_rx], hopsv6[nb_rx]; uint8_t type_arr[nb_rx]; uint32_t ipv4_cnt = 0, ipv6_cnt = 0; diff --git a/examples/l3fwd/l3fwd_lpm_altivec.h b/examples/l3fwd/l3fwd_lpm_altivec.h index adb82f1478..91aad5c313 100644 --- a/examples/l3fwd/l3fwd_lpm_altivec.h +++ b/examples/l3fwd/l3fwd_lpm_altivec.h @@ -145,7 +145,7 @@ static inline void l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, uint8_t portid, struct lcore_conf *qconf) { - uint16_t dst_port[MAX_PKT_BURST]; + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)]; l3fwd_lpm_process_packets(nb_rx, pkts_burst, portid, dst_port, qconf, 0); diff --git a/examples/l3fwd/l3fwd_lpm_neon.h b/examples/l3fwd/l3fwd_lpm_neon.h index 2a68c4c15e..3c1f827424 100644 --- a/examples/l3fwd/l3fwd_lpm_neon.h +++ b/examples/l3fwd/l3fwd_lpm_neon.h @@ -171,7 +171,7 @@ static inline void l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, uint16_t portid, struct lcore_conf *qconf) { - uint16_t dst_port[MAX_PKT_BURST]; + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)]; l3fwd_lpm_process_packets(nb_rx, pkts_burst, portid, dst_port, qconf, 0); diff --git a/examples/l3fwd/l3fwd_lpm_sse.h b/examples/l3fwd/l3fwd_lpm_sse.h index db15030320..50f1abbd8a 100644 --- a/examples/l3fwd/l3fwd_lpm_sse.h +++ b/examples/l3fwd/l3fwd_lpm_sse.h @@ -129,7 +129,7 @@ static inline void l3fwd_lpm_send_packets(int nb_rx, struct rte_mbuf **pkts_burst, uint16_t portid, struct lcore_conf *qconf) { - uint16_t dst_port[MAX_PKT_BURST]; + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)]; l3fwd_lpm_process_packets(nb_rx, pkts_burst, portid, dst_port, qconf, 0); diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h index 40807d5965..bc2bab8265 100644 --- a/examples/l3fwd/l3fwd_neon.h +++ b/examples/l3fwd/l3fwd_neon.h @@ -10,6 +10,9 @@ #include "neon/port_group.h" #include "l3fwd_common.h" +#undef SENDM_PORT_OVERHEAD +#define SENDM_PORT_OVERHEAD(x) ((x) + 2 * FWDSTEP) + /* * Update source and destination MAC addresses in the ethernet header. * Perform RFC1812 checks and updates for IPV4 packets. @@ -92,7 +95,8 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) */ static __rte_always_inline void send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst, - uint16_t dst_port[MAX_PKT_BURST], int nb_rx) + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)], + int nb_rx) { int32_t k; int j = 0; diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h index 083729cdef..6236b7873c 100644 --- a/examples/l3fwd/l3fwd_sse.h +++ b/examples/l3fwd/l3fwd_sse.h @@ -10,6 +10,9 @@ #include "sse/port_group.h" #include "l3fwd_common.h" +#undef SENDM_PORT_OVERHEAD +#define SENDM_PORT_OVERHEAD(x) ((x) + 2 * FWDSTEP) + /* * Update source and destination MAC addresses in the ethernet header. * Perform RFC1812 checks and updates for IPV4 packets. @@ -91,7 +94,8 @@ process_packet(struct rte_mbuf *pkt, uint16_t *dst_port) */ static __rte_always_inline void send_packets_multi(struct lcore_conf *qconf, struct rte_mbuf **pkts_burst, - uint16_t dst_port[MAX_PKT_BURST], int nb_rx) + uint16_t dst_port[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)], + int nb_rx) { int32_t k; int j = 0; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-12-06 23:26:44.967228916 +0800 +++ 0025-examples-l3fwd-fix-read-beyond-boundaries.patch 2024-12-06 23:26:43.903044828 +0800 @@ -1 +1 @@ -From ebab0e8b2257aa049dd35dedc7efd230b0f45b88 Mon Sep 17 00:00:00 2001 +From 66749b0785fc75a28a32fbbcfbf1085f0dabbb53 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit ebab0e8b2257aa049dd35dedc7efd230b0f45b88 ] @@ -32 +34,0 @@ -Cc: stable@dpdk.org @@ -38 +39,0 @@ - examples/l3fwd/l3fwd_acl.c | 2 +- @@ -49 +50 @@ - 12 files changed, 30 insertions(+), 11 deletions(-) + 11 files changed, 29 insertions(+), 10 deletions(-) @@ -52 +53 @@ -index 4894219f2f..4eef08df30 100644 +index 7990edf2d0..879d0fd81c 100644 @@ -55 +56 @@ -@@ -804,7 +804,7 @@ Kirill Rybalchenko +@@ -770,7 +770,7 @@ Kirill Rybalchenko @@ -64,13 +64,0 @@ -diff --git a/examples/l3fwd/l3fwd_acl.c b/examples/l3fwd/l3fwd_acl.c -index b635011ef7..baa01e6dde 100644 ---- a/examples/l3fwd/l3fwd_acl.c -+++ b/examples/l3fwd/l3fwd_acl.c -@@ -1056,7 +1056,7 @@ int - acl_main_loop(__rte_unused void *dummy) - { - struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; -- uint16_t hops[MAX_PKT_BURST]; -+ uint16_t hops[SENDM_PORT_OVERHEAD(MAX_PKT_BURST)]; - unsigned int lcore_id; - uint64_t prev_tsc, diff_tsc, cur_tsc; - int i, nb_rx; @@ -146 +134 @@ -index a0eef05a5d..e1eb8c61c8 100644 +index f38b19af3f..a36330119a 100644 @@ -152 +140 @@ - struct rte_ipv6_addr ipv6_arr[nb_rx]; + uint8_t ipv6_arr[nb_rx][RTE_FIB6_IPV6_ADDR_SIZE];