Skip to contentSkip to conversation

crypto/qat: fix second seg fault in QAT PMD

PATCH In review Bernard Iremonger 2 participants 4 messages Apr 8, 2019 – Apr 10, 2019 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/qat: fix second seg fault in QAT PMD

While running the IPsec unit tests the following
segmentation fault is occurring:

Thread 1 "test" received signal SIGSEGV, Segmentation fault. 0x0000000000bf3b50 in qat_sym_process_response ( op=0x5355280 <unittest_params+512>, resp=0x100455100 "") at /root/dpdk/drivers/crypto/qat/qat_sym.h:161
161 if (sess->bpi_ctx)

Fixes 91614c73b67c ("crypto/qat: make response process function inline")
---
 drivers/crypto/qat/qat_sym.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_sym.h +5 -3
index bc6426c..685c6c0 100644
@@ -157,10 +157,12 @@ qat_sym_process_response(void **op, uint8_t *resp)
 						rx_op->sym->session,
 						cryptodev_qat_driver_id);
 
-
-		if (sess->bpi_ctx)
+		if (sess == NULL)
+			rx_op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
+		else if (sess->bpi_ctx) {
 			qat_bpicipher_postprocess(sess, rx_op);
-		rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+			rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+		}
 	}
 	*op = (void *)rx_op;
 }
Signature · 1 line
2.7.4
#1 lore raw

Hi Bernard,

Quoted 44 lines

-----Original Message-----
From: Iremonger, Bernard
Sent: Monday, April 8, 2019 1:26 PM
To: [email protected]; Trahe, Fiona <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Cc: Iremonger, Bernard <[email protected]>
Subject: [PATCH] crypto/qat: fix second seg fault in QAT PMD

While running the IPsec unit tests the following
segmentation fault is occurring:

Thread 1 "test" received signal SIGSEGV, Segmentation fault. 0x0000000000bf3b50 in qat_sym_process_response ( op=0x5355280 <unittest_params+512>, resp=0x100455100 "") at /root/dpdk/drivers/crypto/qat/qat_sym.h:161
161 if (sess->bpi_ctx)

Fixes 91614c73b67c ("crypto/qat: make response process function inline")
---
 drivers/crypto/qat/qat_sym.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/crypto/qat/qat_sym.h +5 -4
index bc6426c..685c6c0 100644
@@ -157,10 +157,12 @@ qat_sym_process_response(void **op, uint8_t *resp)
 						rx_op->sym->session,
 						cryptodev_qat_driver_id);
 
-
-		if (sess->bpi_ctx)
+		if (sess == NULL)
+			rx_op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
+		else if (sess->bpi_ctx) {
 			qat_bpicipher_postprocess(sess, rx_op);
-		rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+			rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+		}
 	}
 	*op = (void *)rx_op;
 }
--
Quoted 1 line

2.7.4

[Fiona] As for previous seg-fault- this is on data-path and likely due to the application sending in an invalid session - or a session created for a symmetric PMD, but being sent to a QAT asymmetric PMD - whose driver_id would not appear in the session array.
Can you make sure to check for SYMMETRIC support in capabilities.

#2 lore raw

Hi Fiona,

Quoted 48 lines

-----Original Message-----
From: Trahe, Fiona
Sent: Monday, April 8, 2019 5:44 PM
To: Iremonger, Bernard <[email protected]>; [email protected]; Ananyev, Konstantin <[email protected]>; [email protected]
Cc: Trahe, Fiona <[email protected]>
Subject: RE: [PATCH] crypto/qat: fix second seg fault in QAT PMD

Hi Bernard,

drivers/crypto/qat/qat_sym.h qat_sym_process_response(void **op, uint8_t

Quoted 29 lines

-----Original Message-----
From: Iremonger, Bernard
Sent: Monday, April 8, 2019 1:26 PM
To: [email protected]; Trahe, Fiona <[email protected]>; Ananyev, Konstantin <[email protected]>; [email protected]
Cc: Iremonger, Bernard <[email protected]>
Subject: [PATCH] crypto/qat: fix second seg fault in QAT PMD

While running the IPsec unit tests the following segmentation fault is occurring:

Thread 1 "test" received signal SIGSEGV, Segmentation fault. 0x0000000000bf3b50 in qat_sym_process_response ( op=0x5355280 <unittest_params+512>, resp=0x100455100 "") at /root/dpdk/drivers/crypto/qat/qat_sym.h:161
161 if (sess->bpi_ctx)

Fixes 91614c73b67c ("crypto/qat: make response process function

inline")

---
 drivers/crypto/qat/qat_sym.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/crypto/qat/qat_sym.h index bc6426c..685c6c0 100644

drivers/crypto/qat/qat_sym.h +0 -0
@@ -157,10 +157,12 @@ qat_sym_process_response(void **op, uint8_t

*resp)

drivers/crypto/qat/qat_sym.h qat_sym_process_response(void **op, uint8_t *resp)

Quoted 7 lines
drivers/crypto/qat/qat_sym.h +2 -2
 						rx_op->sym->session,
 						cryptodev_qat_driver_id);
 
-
-		if (sess->bpi_ctx)
+		if (sess == NULL)
+			rx_op->status =

RTE_CRYPTO_OP_STATUS_AUTH_FAILED;

Quoted 16 lines
Quoted 10 lines
drivers/crypto/qat/qat_sym.h +3 -2
+		else if (sess->bpi_ctx) {
 			qat_bpicipher_postprocess(sess, rx_op);
-		rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+			rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+		}
 	}
 	*op = (void *)rx_op;
 }
--

2.7.4

[Fiona] As for previous seg-fault- this is on data-path and likely due to the application sending in an invalid session - or a session created for a symmetric PMD, but being sent to a QAT asymmetric PMD - whose driver_id would not appear in the session array.
Can you make sure to check for SYMMETRIC support in capabilities.

I have the asym PMD disabled in the common/config_base file. I will investigate further.

Regards,

Bernard.

#3 lore raw

Hi Fiona,

<snip>

Quoted 49 lines
Quoted 33 lines

drivers/crypto/qat/qat_sym.h qat_sym_process_response(void **op, uint8_t

Quoted 24 lines

Subject: [PATCH] crypto/qat: fix second seg fault in QAT PMD

While running the IPsec unit tests the following segmentation fault is
occurring:

Thread 1 "test" received signal SIGSEGV, Segmentation fault. 0x0000000000bf3b50 in qat_sym_process_response ( op=0x5355280 <unittest_params+512>, resp=0x100455100 "") at /root/dpdk/drivers/crypto/qat/qat_sym.h:161
161 if (sess->bpi_ctx)

Fixes 91614c73b67c ("crypto/qat: make response process function

inline")

---
 drivers/crypto/qat/qat_sym.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/drivers/crypto/qat/qat_sym.h index bc6426c..685c6c0 100644

drivers/crypto/qat/qat_sym.h +0 -0
@@ -157,10 +157,12 @@ qat_sym_process_response(void **op, uint8_t

*resp)

drivers/crypto/qat/qat_sym.h qat_sym_process_response(void **op, uint8_t *resp)

Quoted 7 lines
drivers/crypto/qat/qat_sym.h +2 -2
 						rx_op->sym->session,
 						cryptodev_qat_driver_id);
 
-
-		if (sess->bpi_ctx)
+		if (sess == NULL)
+			rx_op->status =

RTE_CRYPTO_OP_STATUS_AUTH_FAILED;

Quoted 16 lines
Quoted 10 lines
drivers/crypto/qat/qat_sym.h +3 -2
+		else if (sess->bpi_ctx) {
 			qat_bpicipher_postprocess(sess, rx_op);
-		rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+			rx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;
+		}
 	}
 	*op = (void *)rx_op;
 }
--

2.7.4

[Fiona] As for previous seg-fault- this is on data-path and likely due to the application sending in an invalid session - or a session created for a symmetric PMD, but being sent to a QAT asymmetric PMD - whose driver_id would not appear in the session array.
Can you make sure to check for SYMMETRIC support in capabilities.

Quoted 2 lines

I have the asym PMD disabled in the common/config_base file. I will investigate further.

Self NAK of this patch as causing test failures.

Regards,

Bernard.