Skip to contentSkip to conversation

common/qat: fix qat_dev_cmd_param corruption

PATCH Superseded Vikash Poddar 2 participants 4 messages May 23, 2023 – Jun 16, 2023

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/qat: fix qat_dev_cmd_param corruption

Adding fix to address the memory corruption issue for qat_dev_cmd_param structure on QAT GEN3.

This fix aligns the storage where it stores the value on 4 byte unsigned integer data type after reading slice configuration of QAT capabilities.

Fixes b3cbbcdffa4f ("common/qat: read HW slice configuration")
---
 drivers/common/qat/dev/qat_dev_gen1.c | 2 +-
 drivers/common/qat/dev/qat_dev_gen2.c | 2 +-
 drivers/common/qat/dev/qat_dev_gen3.c | 2 +-
 drivers/common/qat/dev/qat_dev_gen4.c | 2 +-
 drivers/common/qat/qat_device.c       | 2 +-
 drivers/common/qat/qat_device.h       | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/common/qat/dev/qat_dev_gen1.c +1 -1
index cf480dcba8..dd2e878e90 100644
@@ -242,7 +242,7 @@ qat_dev_get_extra_size_gen1(void)
 }
 
 static int
-qat_get_dev_slice_map_gen1(uint16_t *map __rte_unused,
+qat_get_dev_slice_map_gen1(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)
 {
 	return 0;
drivers/common/qat/dev/qat_dev_gen2.c +1 -1
index f51be46eb0..061dfdb698 100644
@@ -22,7 +22,7 @@ static struct qat_qp_hw_spec_funcs qat_qp_hw_spec_gen2 = {
 };
 
 static int
-qat_dev_get_slice_map_gen2(uint16_t *map __rte_unused,
+qat_dev_get_slice_map_gen2(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)
 {
 	return 0;
drivers/common/qat/dev/qat_dev_gen3.c +1 -1
index e4197f3c0f..f01b98ff86 100644
@@ -68,7 +68,7 @@ static struct qat_qp_hw_spec_funcs qat_qp_hw_spec_gen3 = {
 };
 
 static int
-qat_dev_get_slice_map_gen3(uint16_t *map,
+qat_dev_get_slice_map_gen3(uint32_t *map,
 	const struct rte_pci_device *pci_dev)
 {
 	if (rte_pci_read_config(pci_dev, map,
drivers/common/qat/dev/qat_dev_gen4.c +1 -1
index 1b3a5deabf..1ce262f715 100644
@@ -283,7 +283,7 @@ qat_dev_get_misc_bar_gen4(struct rte_mem_resource **mem_resource,
 }
 
 static int
-qat_dev_get_slice_map_gen4(uint16_t *map __rte_unused,
+qat_dev_get_slice_map_gen4(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)
 {
 	return 0;
drivers/common/qat/qat_device.c +1 -1
index 8bce2ac073..ed75b66041 100644
@@ -361,7 +361,7 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 {
 	int sym_ret = 0, asym_ret = 0, comp_ret = 0;
 	int num_pmds_created = 0;
-	uint16_t capa = 0;
+	uint32_t capa = 0;
 	struct qat_pci_device *qat_pci_dev;
 	struct qat_dev_hw_spec_funcs *ops_hw;
 	struct qat_dev_cmd_param qat_dev_cmd_param[] = {
drivers/common/qat/qat_device.h +1 -1
index bc3da04238..4a79cdded3 100644
@@ -37,7 +37,7 @@ typedef int (*qat_dev_get_misc_bar_t)
 typedef int (*qat_dev_read_config_t)
 		(struct qat_pci_device *);
 typedef int (*qat_dev_get_extra_size_t)(void);
-typedef int (*qat_dev_get_slice_map_t)(uint16_t *map,
+typedef int (*qat_dev_get_slice_map_t)(uint32_t *map,
 		const struct rte_pci_device *pci_dev);
 
 struct qat_dev_hw_spec_funcs {
Signature · 13 lines
2.25.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
#1 lore raw

PATCH v2 1/1 common/qat: fix qat_dev_cmd_param corruption

Adding fix to address the memory corruption issue for qat_dev_cmd_param structure on QAT GEN3.

This fix aligns the storage where it stores the value on 4 byte unsigned integer data type after reading slice configuration of QAT capabilities.

Fixes b3cbbcdffa4f ("common/qat: read HW slice configuration")

---
v2:
Updated the commit message

---
 drivers/common/qat/dev/qat_dev_gen1.c | 2 +-
 drivers/common/qat/dev/qat_dev_gen2.c | 2 +-
 drivers/common/qat/dev/qat_dev_gen3.c | 2 +-
 drivers/common/qat/dev/qat_dev_gen4.c | 2 +-
 drivers/common/qat/qat_device.c       | 2 +-
 drivers/common/qat/qat_device.h       | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/common/qat/dev/qat_dev_gen1.c +1 -1
index cf480dcba8..dd2e878e90 100644
@@ -242,7 +242,7 @@ qat_dev_get_extra_size_gen1(void)
 }
 
 static int
-qat_get_dev_slice_map_gen1(uint16_t *map __rte_unused,
+qat_get_dev_slice_map_gen1(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)
 {
 	return 0;
drivers/common/qat/dev/qat_dev_gen2.c +1 -1
index f51be46eb0..061dfdb698 100644
@@ -22,7 +22,7 @@ static struct qat_qp_hw_spec_funcs qat_qp_hw_spec_gen2 = {
 };
 
 static int
-qat_dev_get_slice_map_gen2(uint16_t *map __rte_unused,
+qat_dev_get_slice_map_gen2(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)
 {
 	return 0;
drivers/common/qat/dev/qat_dev_gen3.c +1 -1
index e4197f3c0f..f01b98ff86 100644
@@ -68,7 +68,7 @@ static struct qat_qp_hw_spec_funcs qat_qp_hw_spec_gen3 = {
 };
 
 static int
-qat_dev_get_slice_map_gen3(uint16_t *map,
+qat_dev_get_slice_map_gen3(uint32_t *map,
 	const struct rte_pci_device *pci_dev)
 {
 	if (rte_pci_read_config(pci_dev, map,
drivers/common/qat/dev/qat_dev_gen4.c +1 -1
index 1b3a5deabf..1ce262f715 100644
@@ -283,7 +283,7 @@ qat_dev_get_misc_bar_gen4(struct rte_mem_resource **mem_resource,
 }
 
 static int
-qat_dev_get_slice_map_gen4(uint16_t *map __rte_unused,
+qat_dev_get_slice_map_gen4(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)
 {
 	return 0;
drivers/common/qat/qat_device.c +1 -1
index 8bce2ac073..ed75b66041 100644
@@ -361,7 +361,7 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 {
 	int sym_ret = 0, asym_ret = 0, comp_ret = 0;
 	int num_pmds_created = 0;
-	uint16_t capa = 0;
+	uint32_t capa = 0;
 	struct qat_pci_device *qat_pci_dev;
 	struct qat_dev_hw_spec_funcs *ops_hw;
 	struct qat_dev_cmd_param qat_dev_cmd_param[] = {
drivers/common/qat/qat_device.h +1 -1
index bc3da04238..4a79cdded3 100644
@@ -37,7 +37,7 @@ typedef int (*qat_dev_get_misc_bar_t)
 typedef int (*qat_dev_read_config_t)
 		(struct qat_pci_device *);
 typedef int (*qat_dev_get_extra_size_t)(void);
-typedef int (*qat_dev_get_slice_map_t)(uint16_t *map,
+typedef int (*qat_dev_get_slice_map_t)(uint32_t *map,
 		const struct rte_pci_device *pci_dev);
 
 struct qat_dev_hw_spec_funcs {
Signature · 13 lines
2.25.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.
#2 lore raw

This patch can be abandon.
Since these changes are linked with "crypto/qat: support to enable insecure algorithms" commit. New patch series is https://patchwork.dpdk.org/project/dpdk/list/?series=28560

-----Original Message-----
From: Poddar, Vikash ChandraX <[email protected]>
Sent: Thursday, May 25, 2023 9:09 PM
To: Ji, Kai <[email protected]>
Cc: [email protected]; Poddar, Vikash ChandraX <[email protected]>; [email protected]; Kusztal, ArkadiuszX <[email protected]>
Subject: [PATCH v2] common/qat: fix qat_dev_cmd_param corruption

Adding fix to address the memory corruption issue for qat_dev_cmd_param structure on QAT GEN3.

This fix aligns the storage where it stores the value on 4 byte unsigned integer data type after reading slice configuration of QAT capabilities.

Fixes b3cbbcdffa4f ("common/qat: read HW slice configuration")

---
v2:
Updated the commit message

---
 drivers/common/qat/dev/qat_dev_gen1.c | 2 +-  drivers/common/qat/dev/qat_dev_gen2.c | 2 +-  drivers/common/qat/dev/qat_dev_gen3.c | 2 +-  drivers/common/qat/dev/qat_dev_gen4.c | 2 +-
 drivers/common/qat/qat_device.c       | 2 +-
 drivers/common/qat/qat_device.h       | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
drivers/common/qat/dev/qat_dev_gen1.c +1 -1
index cf480dcba8..dd2e878e90 100644
@@ -242,7 +242,7 @@ qat_dev_get_extra_size_gen1(void)  }
 
 static int
-qat_get_dev_slice_map_gen1(uint16_t *map __rte_unused,
+qat_get_dev_slice_map_gen1(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)  {
 	return 0;
drivers/common/qat/dev/qat_dev_gen2.c +1 -1
index f51be46eb0..061dfdb698 100644
@@ -22,7 +22,7 @@ static struct qat_qp_hw_spec_funcs qat_qp_hw_spec_gen2 = {  };
 
 static int
-qat_dev_get_slice_map_gen2(uint16_t *map __rte_unused,
+qat_dev_get_slice_map_gen2(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)  {
 	return 0;
drivers/common/qat/dev/qat_dev_gen3.c +1 -1
index e4197f3c0f..f01b98ff86 100644
@@ -68,7 +68,7 @@ static struct qat_qp_hw_spec_funcs qat_qp_hw_spec_gen3 = {  };
 
 static int
-qat_dev_get_slice_map_gen3(uint16_t *map,
+qat_dev_get_slice_map_gen3(uint32_t *map,
 	const struct rte_pci_device *pci_dev)
 {
 	if (rte_pci_read_config(pci_dev, map,
drivers/common/qat/dev/qat_dev_gen4.c +1 -1
index 1b3a5deabf..1ce262f715 100644
@@ -283,7 +283,7 @@ qat_dev_get_misc_bar_gen4(struct rte_mem_resource **mem_resource,  }
 
 static int
-qat_dev_get_slice_map_gen4(uint16_t *map __rte_unused,
+qat_dev_get_slice_map_gen4(uint32_t *map __rte_unused,
 	const struct rte_pci_device *pci_dev __rte_unused)  {
 	return 0;
drivers/common/qat/qat_device.c +3 -4
@@ -361,7 +361,7 @@ static int qat_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,  {
 	int sym_ret = 0, asym_ret = 0, comp_ret = 0;
 	int num_pmds_created = 0;
-	uint16_t capa = 0;
+	uint32_t capa = 0;
 	struct qat_pci_device *qat_pci_dev;
 	struct qat_dev_hw_spec_funcs *ops_hw;
 	struct qat_dev_cmd_param qat_dev_cmd_param[] = { diff --git a/drivers/common/qat/qat_device.h b/drivers/common/qat/qat_device.h index bc3da04238..4a79cdded3 100644
--- a/drivers/common/qat/qat_device.h
+++ b/drivers/common/qat/qat_device.h
@@ -37,7 +37,7 @@ typedef int (*qat_dev_get_misc_bar_t)  typedef int (*qat_dev_read_config_t)
 		(struct qat_pci_device *);
 typedef int (*qat_dev_get_extra_size_t)(void);
-typedef int (*qat_dev_get_slice_map_t)(uint16_t *map,
+typedef int (*qat_dev_get_slice_map_t)(uint32_t *map,
 		const struct rte_pci_device *pci_dev);
 
 struct qat_dev_hw_spec_funcs {
--

2.25.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

Acked-by on v1 1/1
#3 lore raw
In reply to Vikash Poddar
Quoted 22 lines

-----Original Message-----
From: Vikash Poddar <[email protected]>
Sent: Tuesday 23 May 2023 10:07
To: Ji, Kai <[email protected]>
Cc: [email protected]; Poddar, Vikash ChandraX <[email protected]>; Kusztal, ArkadiuszX <[email protected]>
Subject: [PATCH v1] common/qat: fix qat_dev_cmd_param corruption

Adding fix to address the memory corruption issue for qat_dev_cmd_param structure on QAT GEN3.

This fix aligns the storage where it stores the value on 4 byte unsigned integer data type after reading slice configuration of QAT capabilities.

Fixes b3cbbcdffa4f ("common/qat: read HW slice configuration")

---

<snip>