patch 'pcapng: avoid potential unaligned data' has been queued to stable release 23.11.3
Xueming Li
xuemingl at nvidia.com
Sat Dec 7 09:00:45 CET 2024
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=939b471310e29c5b7f9640f53e9ba22ce32e6441
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 939b471310e29c5b7f9640f53e9ba22ce32e6441 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Wed, 20 Nov 2024 15:06:35 -0800
Subject: [PATCH] pcapng: avoid potential unaligned data
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit 0cbf27521b0d6e7cb79f41a5e699d82562b09c03 ]
The buffer used to construct headers (which contain 32 bit values)
was declared as uint8_t which can lead to unaligned access.
Change to declare buffer as uint32_t.
Fixes: dc2d6d20047e ("pcapng: avoid using alloca")
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/pcapng/rte_pcapng.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index e5326c1d38..16485b27cb 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -33,8 +33,8 @@
/* conversion from DPDK speed to PCAPNG */
#define PCAPNG_MBPS_SPEED 1000000ull
-/* upper bound for section, stats and interface blocks */
-#define PCAPNG_BLKSIZ 2048
+/* upper bound for section, stats and interface blocks (in uint32_t) */
+#define PCAPNG_BLKSIZ (2048 / sizeof(uint32_t))
/* Format of the capture file handle */
struct rte_pcapng {
@@ -144,7 +144,7 @@ pcapng_section_block(rte_pcapng_t *self,
{
struct pcapng_section_header *hdr;
struct pcapng_option *opt;
- uint8_t buf[PCAPNG_BLKSIZ];
+ uint32_t buf[PCAPNG_BLKSIZ];
uint32_t len;
len = sizeof(*hdr);
@@ -212,7 +212,7 @@ rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t port,
struct pcapng_option *opt;
const uint8_t tsresol = 9; /* nanosecond resolution */
uint32_t len;
- uint8_t buf[PCAPNG_BLKSIZ];
+ uint32_t buf[PCAPNG_BLKSIZ];
char ifname_buf[IF_NAMESIZE];
char ifhw[256];
uint64_t speed = 0;
@@ -330,7 +330,7 @@ rte_pcapng_write_stats(rte_pcapng_t *self, uint16_t port_id,
uint64_t start_time = self->offset_ns;
uint64_t sample_time;
uint32_t optlen, len;
- uint8_t buf[PCAPNG_BLKSIZ];
+ uint32_t buf[PCAPNG_BLKSIZ];
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL);
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-12-06 23:26:46.992965606 +0800
+++ 0087-pcapng-avoid-potential-unaligned-data.patch 2024-12-06 23:26:44.103044826 +0800
@@ -1 +1 @@
-From 0cbf27521b0d6e7cb79f41a5e699d82562b09c03 Mon Sep 17 00:00:00 2001
+From 939b471310e29c5b7f9640f53e9ba22ce32e6441 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 0cbf27521b0d6e7cb79f41a5e699d82562b09c03 ]
@@ -11 +13,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list