* [dpdk-dev] [PATCH 1/3] net/i40e: fix memory overflow for 32 bit vPMD
2017-04-30 5:26 [dpdk-dev] [PATCH 0/3] fix memory overflow for 32 bit vPMD Qi Zhang
@ 2017-04-30 5:26 ` Qi Zhang
2017-04-30 5:26 ` [dpdk-dev] [PATCH 2/3] net/ixgbe: " Qi Zhang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Qi Zhang @ 2017-04-30 5:26 UTC (permalink / raw)
To: ferruh.yigit, jingjing.wu, helin.zhang, wenzhuo.lu,
bruce.richardson, jing.d.chen
Cc: dev, Qi Zhang, stable
Return mbuf points of _recv_raw_pkts_vec are modified out of bound.
Fixes: 8e109464c022 ("i40e: allow vector Rx and Tx usage")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/i40e/i40e_rxtx_vec_sse.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c
index 8bc3399..3b4a352 100644
--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c
+++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c
@@ -316,20 +316,26 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
__m128i descs[RTE_I40E_DESCS_PER_LOOP];
__m128i pkt_mb1, pkt_mb2, pkt_mb3, pkt_mb4;
__m128i zero, staterr, sterr_tmp1, sterr_tmp2;
- __m128i mbp1, mbp2; /* two mbuf pointer in one XMM reg. */
+ /* 2 64 bit or 4 32 bit mbuf pointers in one XMM reg. */
+ __m128i mbp1;
+#if defined(RTE_ARCH_X86_64)
+ __m128i mbp2;
+#endif
- /* B.1 load 1 mbuf point */
+ /* B.1 load 2 (64 bit) or 4 (32 bit) mbuf points */
mbp1 = _mm_loadu_si128((__m128i *)&sw_ring[pos]);
/* Read desc statuses backwards to avoid race condition */
/* A.1 load 4 pkts desc */
descs[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
rte_compiler_barrier();
- /* B.2 copy 2 mbuf point into rx_pkts */
+ /* B.2 copy 2 64 bit or 4 32 bit mbuf point into rx_pkts */
_mm_storeu_si128((__m128i *)&rx_pkts[pos], mbp1);
- /* B.1 load 1 mbuf point */
+#if defined(RTE_ARCH_X86_64)
+ /* B.1 load 2 64 bit mbuf points */
mbp2 = _mm_loadu_si128((__m128i *)&sw_ring[pos+2]);
+#endif
descs[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
rte_compiler_barrier();
@@ -338,8 +344,10 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts,
rte_compiler_barrier();
descs[0] = _mm_loadu_si128((__m128i *)(rxdp));
+#if defined(RTE_ARCH_X86_64)
/* B.2 copy 2 mbuf point into rx_pkts */
_mm_storeu_si128((__m128i *)&rx_pkts[pos+2], mbp2);
+#endif
if (split_packet) {
rte_mbuf_prefetch_part2(rx_pkts[pos]);
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH 2/3] net/ixgbe: fix memory overflow for 32 bit vPMD
2017-04-30 5:26 [dpdk-dev] [PATCH 0/3] fix memory overflow for 32 bit vPMD Qi Zhang
2017-04-30 5:26 ` [dpdk-dev] [PATCH 1/3] net/i40e: " Qi Zhang
@ 2017-04-30 5:26 ` Qi Zhang
2017-04-30 5:26 ` [dpdk-dev] [PATCH 3/3] net/fm10k: " Qi Zhang
2017-05-05 15:36 ` [dpdk-dev] [PATCH 0/3] " Thomas Monjalon
3 siblings, 0 replies; 5+ messages in thread
From: Qi Zhang @ 2017-04-30 5:26 UTC (permalink / raw)
To: ferruh.yigit, jingjing.wu, helin.zhang, wenzhuo.lu,
bruce.richardson, jing.d.chen
Cc: dev, Qi Zhang, stable
Return mbuf points of _recv_raw_pkts_vec are modified out of bound.
Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
index 795ee33..a7bc199 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c
@@ -337,9 +337,13 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
__m128i descs[RTE_IXGBE_DESCS_PER_LOOP];
__m128i pkt_mb1, pkt_mb2, pkt_mb3, pkt_mb4;
__m128i zero, staterr, sterr_tmp1, sterr_tmp2;
- __m128i mbp1, mbp2; /* two mbuf pointer in one XMM reg. */
+ /* 2 64 bit or 4 32 bit mbuf pointers in one XMM reg. */
+ __m128i mbp1;
+#if defined(RTE_ARCH_X86_64)
+ __m128i mbp2;
+#endif
- /* B.1 load 1 mbuf point */
+ /* B.1 load 2 (64 bit) or 4 (32 bit) mbuf points */
mbp1 = _mm_loadu_si128((__m128i *)&sw_ring[pos]);
/* Read desc statuses backwards to avoid race condition */
@@ -347,11 +351,13 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
descs[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
rte_compiler_barrier();
- /* B.2 copy 2 mbuf point into rx_pkts */
+ /* B.2 copy 2 64 bit or 4 32 bit mbuf point into rx_pkts */
_mm_storeu_si128((__m128i *)&rx_pkts[pos], mbp1);
- /* B.1 load 1 mbuf point */
+#if defined(RTE_ARCH_X86_64)
+ /* B.1 load 2 64 bit mbuf points */
mbp2 = _mm_loadu_si128((__m128i *)&sw_ring[pos+2]);
+#endif
descs[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
rte_compiler_barrier();
@@ -360,8 +366,10 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts,
rte_compiler_barrier();
descs[0] = _mm_loadu_si128((__m128i *)(rxdp));
+#if defined(RTE_ARCH_X86_64)
/* B.2 copy 2 mbuf point into rx_pkts */
_mm_storeu_si128((__m128i *)&rx_pkts[pos+2], mbp2);
+#endif
if (split_packet) {
rte_mbuf_prefetch_part2(rx_pkts[pos]);
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH 3/3] net/fm10k: fix memory overflow for 32 bit vPMD
2017-04-30 5:26 [dpdk-dev] [PATCH 0/3] fix memory overflow for 32 bit vPMD Qi Zhang
2017-04-30 5:26 ` [dpdk-dev] [PATCH 1/3] net/i40e: " Qi Zhang
2017-04-30 5:26 ` [dpdk-dev] [PATCH 2/3] net/ixgbe: " Qi Zhang
@ 2017-04-30 5:26 ` Qi Zhang
2017-05-05 15:36 ` [dpdk-dev] [PATCH 0/3] " Thomas Monjalon
3 siblings, 0 replies; 5+ messages in thread
From: Qi Zhang @ 2017-04-30 5:26 UTC (permalink / raw)
To: ferruh.yigit, jingjing.wu, helin.zhang, wenzhuo.lu,
bruce.richardson, jing.d.chen
Cc: dev, Qi Zhang, stable
Return mbuf points of _recv_raw_pkts_vec are modified out of bound.
Fixes: a6ce64a97520 ("fm10k: introduce vector driver")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/fm10k/fm10k_rxtx_vec.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 89cd958..c762b43 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -467,9 +467,13 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
__m128i descs0[RTE_FM10K_DESCS_PER_LOOP];
__m128i pkt_mb1, pkt_mb2, pkt_mb3, pkt_mb4;
__m128i zero, staterr, sterr_tmp1, sterr_tmp2;
- __m128i mbp1, mbp2; /* two mbuf pointer in one XMM reg. */
+ __m128i mbp1;
+ /* 2 64 bit or 4 32 bit mbuf pointers in one XMM reg. */
+#if defined(RTE_ARCH_X86_64)
+ __m128i mbp2;
+#endif
- /* B.1 load 1 mbuf point */
+ /* B.1 load 2 (64 bit) or 4 (32 bit) mbuf points */
mbp1 = _mm_loadu_si128((__m128i *)&mbufp[pos]);
/* Read desc statuses backwards to avoid race condition */
@@ -477,11 +481,13 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
descs0[3] = _mm_loadu_si128((__m128i *)(rxdp + 3));
rte_compiler_barrier();
- /* B.2 copy 2 mbuf point into rx_pkts */
+ /* B.2 copy 2 64 bit or 4 32 bit mbuf point into rx_pkts */
_mm_storeu_si128((__m128i *)&rx_pkts[pos], mbp1);
- /* B.1 load 1 mbuf point */
+#if defined(RTE_ARCH_X86_64)
+ /* B.1 load 2 64 bit mbuf poitns */
mbp2 = _mm_loadu_si128((__m128i *)&mbufp[pos+2]);
+#endif
descs0[2] = _mm_loadu_si128((__m128i *)(rxdp + 2));
rte_compiler_barrier();
@@ -490,8 +496,10 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts,
rte_compiler_barrier();
descs0[0] = _mm_loadu_si128((__m128i *)(rxdp));
+#if defined(RTE_ARCH_X86_64)
/* B.2 copy 2 mbuf point into rx_pkts */
_mm_storeu_si128((__m128i *)&rx_pkts[pos+2], mbp2);
+#endif
/* avoid compiler reorder optimization */
rte_compiler_barrier();
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH 0/3] fix memory overflow for 32 bit vPMD
2017-04-30 5:26 [dpdk-dev] [PATCH 0/3] fix memory overflow for 32 bit vPMD Qi Zhang
` (2 preceding siblings ...)
2017-04-30 5:26 ` [dpdk-dev] [PATCH 3/3] net/fm10k: " Qi Zhang
@ 2017-05-05 15:36 ` Thomas Monjalon
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2017-05-05 15:36 UTC (permalink / raw)
To: Qi Zhang
Cc: dev, ferruh.yigit, jingjing.wu, helin.zhang, wenzhuo.lu,
bruce.richardson, jing.d.chen
30/04/2017 07:26, Qi Zhang:
> The return mbuf points of RX path is possible be modified out of bound
> with 32 bit vPMD.
> The patch set fix for related drivers.
>
> Qi Zhang (3):
> net/i40e: fix memory overflow for 32 bit vPMD
> net/ixgbe: fix memory overflow for 32 bit vPMD
> net/fm10k: fix memory overflow for 32 bit vPMD
No comment on these patches, assuming they are OK.
Applied, thanks
^ permalink raw reply [flat|nested] 5+ messages in thread