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 4427F45BB6 for ; Wed, 23 Oct 2024 23:18:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E90640261; Wed, 23 Oct 2024 23:18:28 +0200 (CEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mails.dpdk.org (Postfix) with ESMTP id 93AA243297 for ; Wed, 23 Oct 2024 23:18:26 +0200 (CEST) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so2140635e9.1 for ; Wed, 23 Oct 2024 14:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729718306; x=1730323106; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u7SPFqzK6xNUdtuAAcWLTtxUpMqBiaimAo+nlYaW+tU=; b=JE94L+yPxa2JxHR8WlKP17lZ3/QS2VFIYGoDHHYh4tiX4MglWuXmygJkmBBBcx+mHo 5FXR3P2Xb0t9mSAfJal9fPaVKwQvHGx248zMwZ2yu32hgbGo807XzXuEXlY5OtbUqisM 9StWOEaWy89viGn/PcpIBh+jv0LCCVG8bcV3UGIY3IIMGkYDsSdHhC+j1jKz+/TAyO82 hNv6O9Uw+wd2nsQyz3AFE1IJ3/E0Re3Su+Q82YQLWUFyBpof+Cam+mspC0r3kN0H8URc +aLKrPWe3RUsGQvn9HuiKy4OgcW+W5Ss3PopL3CnHgXpSGpCsp5tKvTZL9GEvUmO4dbC MgjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729718306; x=1730323106; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u7SPFqzK6xNUdtuAAcWLTtxUpMqBiaimAo+nlYaW+tU=; b=gXsTXjwbUaBsL8vR7h5C3C5Sn1Q7Q3ebl6qoUI8jcJVarEE4WYuArjSu/+L7E5k1wA MHBLaLNm/ZvLXMRpiMmx1RptBNudOAxGEEen+iRmpey+eRJNSr0UrUAwmToy8mloXJTO ZbN4IZo3P5VUQRFqdnX5RGpXbBIBQr4P/Z46TnSaUSdB2Nddl0PCOsqhGCNyB4UuHbwv lcjaIHMJhe/n687F0fPqtw4/znNbSAMM+9mym5JB+jdS+GJ4w6DtRACsmPLt1aBlq99u 55nk/rOKXBpRdyoYyXfS9HdQ7Vy0Rjbth0iRZyN5/628RA/59QxniSP7iy5BI+nAwD4M 28yw== X-Forwarded-Encrypted: i=1; AJvYcCV6NowUxgJzHSMX+z2cl+m2HpU3ac/E2R1YJRDFFTBxNUXpxr/YE333adsF/OpMyTqEsi6zfrQ=@dpdk.org X-Gm-Message-State: AOJu0YyNBf5aZwfZgWaANf2PGlehqwOnMlYh0NI+Vng3uqTtojApxHNm 8Fi/kdRrEoeksiii2JHDNohL8Q7jC7bWkikZHQMept5wAFMC7HCL X-Google-Smtp-Source: AGHT+IHm7KseZ3MdEbUaNVi0us9JsYVtKFAyPfP1WxKmZs708lx1OhdZ+zB0Vo/hKCl7eugxncqiyw== X-Received: by 2002:a05:600c:4e12:b0:431:5ba1:a529 with SMTP id 5b1f17b1804b1-431842115c0mr36499305e9.14.1729718306117; Wed, 23 Oct 2024 14:18:26 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:21cd:def0:a01d:d2aa]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43186c50947sm27348935e9.45.2024.10.23.14.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 14:18:25 -0700 (PDT) From: luca.boccassi@gmail.com To: Stephen Hemminger Cc: Tianli Lai , dpdk stable Subject: patch 'app/dumpcap: fix handling of jumbo frames' has been queued to stable release 22.11.7 Date: Wed, 23 Oct 2024 22:16:02 +0100 Message-ID: <20241023211704.1216956-22-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241023211704.1216956-1-luca.boccassi@gmail.com> References: <20241023211704.1216956-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 10/25/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://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/65c229defe6b3bc0843bf34cf998718e317528d9 Thanks. Luca Boccassi --- >From 65c229defe6b3bc0843bf34cf998718e317528d9 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 3 Oct 2024 15:09:03 -0700 Subject: [PATCH] app/dumpcap: fix handling of jumbo frames [ upstream commit 5c0f970c0d0e2a963a7a970a71cad4f4244414a5 ] If dumpcap (in legacy pcap mode) tried to handle a large segmented frame it would core dump because rte_pktmbuf_read() would return NULL. Fix by using same logic as in pcap PMD. Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application") Reported-by: Tianli Lai Signed-off-by: Stephen Hemminger --- app/dumpcap/main.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index 81c9d7d2f1..7e8aa5d76e 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -740,7 +740,7 @@ static ssize_t pcap_write_packets(pcap_dumper_t *dumper, struct rte_mbuf *pkts[], uint16_t n) { - uint8_t temp_data[snaplen]; + uint8_t temp_data[RTE_ETHER_MAX_JUMBO_FRAME_LEN]; struct pcap_pkthdr header; uint16_t i; size_t total = 0; @@ -749,14 +749,19 @@ pcap_write_packets(pcap_dumper_t *dumper, for (i = 0; i < n; i++) { struct rte_mbuf *m = pkts[i]; + size_t len, caplen; - header.len = rte_pktmbuf_pkt_len(m); - header.caplen = RTE_MIN(header.len, snaplen); + len = caplen = rte_pktmbuf_pkt_len(m); + if (unlikely(!rte_pktmbuf_is_contiguous(m) && len > snaplen)) + caplen = snaplen; + + header.len = len; + header.caplen = caplen; pcap_dump((u_char *)dumper, &header, - rte_pktmbuf_read(m, 0, header.caplen, temp_data)); + rte_pktmbuf_read(m, 0, caplen, temp_data)); - total += sizeof(header) + header.len; + total += sizeof(header) + caplen; } return total; -- 2.45.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-10-23 22:16:41.375045224 +0100 +++ 0022-app-dumpcap-fix-handling-of-jumbo-frames.patch 2024-10-23 22:16:40.455941029 +0100 @@ -1 +1 @@ -From 5c0f970c0d0e2a963a7a970a71cad4f4244414a5 Mon Sep 17 00:00:00 2001 +From 65c229defe6b3bc0843bf34cf998718e317528d9 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 5c0f970c0d0e2a963a7a970a71cad4f4244414a5 ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index 6feb8f5672..fcfaa19951 100644 +index 81c9d7d2f1..7e8aa5d76e 100644 @@ -23 +24 @@ -@@ -902,7 +902,7 @@ static ssize_t +@@ -740,7 +740,7 @@ static ssize_t @@ -27 +28 @@ -- uint8_t temp_data[RTE_MBUF_DEFAULT_BUF_SIZE]; +- uint8_t temp_data[snaplen]; @@ -32 +33 @@ -@@ -911,14 +911,19 @@ pcap_write_packets(pcap_dumper_t *dumper, +@@ -749,14 +749,19 @@ pcap_write_packets(pcap_dumper_t *dumper, @@ -39 +40 @@ -- header.caplen = RTE_MIN(header.len, sizeof(temp_data)); +- header.caplen = RTE_MIN(header.len, snaplen); @@ -41,2 +42,2 @@ -+ if (unlikely(!rte_pktmbuf_is_contiguous(m) && len > sizeof(temp_data))) -+ caplen = sizeof(temp_data); ++ if (unlikely(!rte_pktmbuf_is_contiguous(m) && len > snaplen)) ++ caplen = snaplen;