[v1] lib/distributor: fix unaligned 128-bit write

Message ID 20210716133237.31464-1-david.hunt@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] lib/distributor: fix unaligned 128-bit write |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/iol-abi-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance fail Performance Testing issues

Commit Message

Hunt, David July 16, 2021, 1:32 p.m. UTC
  When the distributor sample app is built as a 32-bit app,
the data buffer passed to find_match_vec can be unaligned,
causing a segmentation fault due to writing a 128-bit value
using _mm_store_si128().  128-bit align the data being
passed in so this does not happen.

Fixes: 775003ad2f96 ("distributor: add new burst-capable library")

Cc: stable@dpdk.org

Signed-off-by: David Hunt <david.hunt@intel.com>
---
 lib/distributor/rte_distributor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Thomas Monjalon July 20, 2021, noon UTC | #1
16/07/2021 15:32, David Hunt:
> When the distributor sample app is built as a 32-bit app,
> the data buffer passed to find_match_vec can be unaligned,
> causing a segmentation fault due to writing a 128-bit value
> using _mm_store_si128().  128-bit align the data being
> passed in so this does not happen.
> 
> Fixes: 775003ad2f96 ("distributor: add new burst-capable library")
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

Applied, thanks
  
Thomas Monjalon July 20, 2021, 12:31 p.m. UTC | #2
16/07/2021 15:32, David Hunt:
> When the distributor sample app is built as a 32-bit app,
> the data buffer passed to find_match_vec can be unaligned,
> causing a segmentation fault due to writing a 128-bit value
> using _mm_store_si128().  128-bit align the data being
> passed in so this does not happen.
> 
> Fixes: 775003ad2f96 ("distributor: add new burst-capable library")
> 
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Hunt <david.hunt@intel.com>

Applied, thanks
  

Patch

diff --git a/lib/distributor/rte_distributor.c b/lib/distributor/rte_distributor.c
index 07e385a259..c210cf86bd 100644
--- a/lib/distributor/rte_distributor.c
+++ b/lib/distributor/rte_distributor.c
@@ -478,7 +478,7 @@  rte_distributor_process(struct rte_distributor *d,
 		return 0;
 
 	while (next_idx < num_mbufs) {
-		uint16_t matches[RTE_DIST_BURST_SIZE];
+		uint16_t matches[RTE_DIST_BURST_SIZE] __rte_aligned(128);
 		unsigned int pkts;
 
 		if ((num_mbufs - next_idx) < RTE_DIST_BURST_SIZE)