Skip to contentSkip to conversation

examples/fips_validation: fix dangling pointer for SHA test

PATCH Superseded Emma Finn 4 participants 13 messages Aug 28, 2025 – Mar 17

lore
Share & tools
lore

Emma Finn

author
#0 lore raw

PATCH 1/1 examples/fips_validation: fix dangling pointer for SHA test

Set vector pointer to NULL after free to avoid calling rte_free() on the same pointer twice in some cases.

---
 examples/fips_validation/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/fips_validation/main.c +1 -1
index f21826e9d7..60ee9f8dd4 100644
@@ -2612,7 +2612,7 @@ fips_mct_sha_test(void)
 		rte_free(md[i].val);
 
 	rte_free(vec.pt.val);
-
+	vec.pt.val = NULL;
 	rte_free(val.val);
 	return 0;
 }
Signature · 1 line
2.34.1
#1 lore raw
Quoted 13 lines

Set vector pointer to NULL after free to avoid calling rte_free() on the same pointer twice in some cases.

---
 examples/fips_validation/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/fips_validation/main.c +0 -0
index f21826e9d7..60ee9f8dd4 100644

examples/fips_validation/main.c fips_mct_sha_test(void) · line 2615

Quoted 5 lines
examples/fips_validation/main.c +1 -1
@@ -2612,7 +2612,7 @@ fips_mct_sha_test(void)
 		rte_free(md[i].val);
 
 	rte_free(vec.pt.val);
-
+	vec.pt.val = NULL;

Same could be the case for fips_mct_shake_test also.

Thanks,
Gowrishankar

Quoted 5 lines
examples/fips_validation/main.c +0 -1
 	rte_free(val.val);
 	return 0;
 }
--

2.34.1

author
#2 lore raw
Quoted 23 lines

-----Original Message-----
From: Gowrishankar Muthukrishnan <[email protected]>
Sent: Thursday 28 August 2025 10:42
To: Finn, Emma <[email protected]>
Cc: [email protected]; Ji, Kai <[email protected]>
Subject: RE: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test

Quoted 15 lines

Set vector pointer to NULL after free to avoid calling rte_free() on the same pointer twice in some cases.

---
 examples/fips_validation/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/examples/fips_validation/main.c index f21826e9d7..60ee9f8dd4 100644

examples/fips_validation/main.c +0 -0
@@ -2612,7 +2612,7 @@ fips_mct_sha_test(void)
 		rte_free(md[i].val);
 
Quoted 6 lines

examples/fips_validation/main.c fips_mct_sha_test(void) · line 2615

Quoted 3 lines
examples/fips_validation/main.c +1 -1
 	rte_free(vec.pt.val);
-
+	vec.pt.val = NULL;

Same could be the case for fips_mct_shake_test also.

Good catch, probably the same could happen with shake.
I currently don’t have a way to test shake but I'm happy to make the change as part of this patch if you can test?

Thanks,
Emma

Quoted 7 lines

Thanks,
Gowrishankar

Quoted 5 lines
examples/fips_validation/main.c +0 -1
 	rte_free(val.val);
 	return 0;
 }
--

2.34.1

#3 lore raw
Quoted 10 lines
Quoted 6 lines

examples/fips_validation/main.c fips_mct_sha_test(void) · line 2615

Quoted 3 lines
examples/fips_validation/main.c +1 -1
 	rte_free(vec.pt.val);
-
+	vec.pt.val = NULL;

Same could be the case for fips_mct_shake_test also.

Good catch, probably the same could happen with shake.
I currently don’t have a way to test shake but I'm happy to make the change as part of this patch if you can test?

Did you find any segfault and so got to know the problem ? If so, what was the command you executed ?.

Thanks,
Gowrishankar

author
#4 lore raw
Quoted 20 lines

-----Original Message-----
From: Gowrishankar Muthukrishnan <[email protected]>
Sent: Friday 29 August 2025 11:23
To: Finn, Emma <[email protected]>
Cc: [email protected]; Ji, Kai <[email protected]>
Subject: RE: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test
Importance: High

Quoted 10 lines
Quoted 6 lines

examples/fips_validation/main.c fips_mct_sha_test(void) · line 2615

Quoted 3 lines
examples/fips_validation/main.c +1 -1
 	rte_free(vec.pt.val);
-
+	vec.pt.val = NULL;

Same could be the case for fips_mct_shake_test also.

Good catch, probably the same could happen with shake.
I currently don’t have a way to test shake but I'm happy to make the change as part of this patch if you can test?

Quoted 5 lines

Did you find any segfault and so got to know the problem ? If so, what was the command you executed ?.

Thanks,
Gowrishankar

Running fips sample app with aesni_mb and SHA ACVP test vector files. Also occurs with QAT. ./dpdk-fips_validation --vdev=crypto_aesni_mb -- --req-file $FIPS_DIR/$alg/req --rsp-file $FIPS_DIR/$alg/resp_aesni_mb --path-is-folder

Output shows invalid memory bug.
EAL: Detected CPU lcores: 64
EAL: Detected NUMA nodes: 2
EAL: Detected static linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'VA'
EAL: VFIO support initialized
EAL: Using IOMMU type 1 (Type 1)
CRYPTODEV: Creating cryptodev crypto_aesni_mb
CRYPTODEV: Initialisation parameters - name: crypto_aesni_mb,socket id: 0, max queue pairs: 8
IPSEC_MB: ipsec_mb_create() line 168: IPSec Multi-buffer library version used: 2.0.0
EAL: Error: Invalid memory

SHAKE is not supported by these hence I did not catch it.

Thanks,
Emma

#5 lore raw
Quoted 1 line

SHAKE is not supported by these hence I did not catch it.

OpenSSL PMD supports SHA and SHAKE. Could that help verifying both lines of fix ?.

Thanks,
Gowrishankar.

author
#6 lore raw
Quoted 11 lines

-----Original Message-----
From: Gowrishankar Muthukrishnan <[email protected]>
Sent: Friday 29 August 2025 13:17
To: Finn, Emma <[email protected]>
Cc: [email protected]; Ji, Kai <[email protected]>
Subject: RE: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test
Importance: High

Quoted 7 lines
Quoted 1 line

SHAKE is not supported by these hence I did not catch it.

OpenSSL PMD supports SHA and SHAKE. Could that help verifying both lines of fix ?.

Thanks,
Gowrishankar.

OpenSSL PMD only supports SHAKE-256 for EdDSA operations, not as standalone hash functions

#7 lore raw

Hi Gowrishankar,

Have you get a chance to test this patch against SHAKE on your ends ?

Regards

Kai

________________________________
From: Finn, Emma <[email protected]>
Sent: Friday, August 29, 2025 14:14
To: Gowrishankar Muthukrishnan <[email protected]>
Cc: [email protected] <[email protected]>; Ji, Kai <[email protected]>
Subject: RE: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test

Quoted 9 lines

-----Original Message-----
From: Gowrishankar Muthukrishnan <[email protected]>
Sent: Friday 29 August 2025 13:17
To: Finn, Emma <[email protected]>
Cc: [email protected]; Ji, Kai <[email protected]>
Subject: RE: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test
Importance: High

Quoted 7 lines
Quoted 1 line

SHAKE is not supported by these hence I did not catch it.

OpenSSL PMD supports SHA and SHAKE. Could that help verifying both lines of fix ?.

Thanks,
Gowrishankar.

OpenSSL PMD only supports SHAKE-256 for EdDSA operations, not as standalone hash functions

#8 lore raw

Hi,
I see example app runs normally with openssl PMD in my local tests, even without fix.

Thanks,
Gowrishankar

From: Ji, Kai <[email protected]>
Sent: Wednesday, October 15, 2025 9:23 PM
To: Finn, Emma <[email protected]>; Gowrishankar Muthukrishnan <[email protected]>
Cc: [email protected]
Subject: Re: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test

Hi Gowrishankar, Have you get a chance to test this patch against SHAKE on your ends ? Regards Kai From: Finn, Emma <emma. finn@ intel. com> Sent: Friday, August 29, 2025 14: 14 To: Gowrishankar Muthukrishnan <gmuthukrishn@ marvell. com> ZjQcmQRYFpfptBannerStart
Prioritize security for external emails:
Confirm sender and content safety before clicking links or opening attachments
Report Suspicious <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/CRVmXkqW!ui3XGZ9YrjX626H8WV37YM2aa0G6UhN-cKsdbpw7pqWvplKrDOohK8dxT6B9_RqNiV6uMomo_2pTJiWsEIfe_ZdA07-kBAy14DcmaeM7eRLbMeeoTtyqbMs3d2Q0-a5r77yEbIlkHnqjs8o$> ‌
ZjQcmQRYFpfptBannerEnd
Hi Gowrishankar,

Have you get a chance to test this patch against SHAKE on your ends ?

Regards

Kai

________________________________
From: Finn, Emma <[email protected]<mailto:[email protected]>>
Sent: Friday, August 29, 2025 14:14
To: Gowrishankar Muthukrishnan <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>; Ji, Kai <[email protected]<mailto:[email protected]>>
Subject: RE: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test

Quoted 9 lines

-----Original Message-----
From: Gowrishankar Muthukrishnan <[email protected]<mailto:[email protected]>>
Sent: Friday 29 August 2025 13:17
To: Finn, Emma <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>; Ji, Kai <[email protected]<mailto:[email protected]>>
Subject: RE: [EXTERNAL] [PATCH] examples/fips_validation: fix dangling pointer for SHA test
Importance: High

Quoted 7 lines
Quoted 1 line

SHAKE is not supported by these hence I did not catch it.

OpenSSL PMD supports SHA and SHAKE. Could that help verifying both lines of fix ?.

Thanks,
Gowrishankar.

OpenSSL PMD only supports SHAKE-256 for EdDSA operations, not as standalone hash functions

Acked-by on v1 1/1
#9 lore raw
In reply to Emma Finn

________________________________
From: Finn, Emma <[email protected]>
Sent: 28 August 2025 10:28
To: Gowrishankar Muthukrishnan <[email protected]>
Cc: [email protected] <[email protected]>; Ji, Kai <[email protected]>; Finn, Emma <[email protected]>
Subject: [PATCH] examples/fips_validation: fix dangling pointer for SHA test

Set vector pointer to NULL after free to avoid calling rte_free() on the same pointer twice in some cases.

---
 examples/fips_validation/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
examples/fips_validation/main.c +1 -1
index f21826e9d7..60ee9f8dd4 100644
@@ -2612,7 +2612,7 @@ fips_mct_sha_test(void)
                 rte_free(md[i].val);
 
         rte_free(vec.pt.val);
-
+       vec.pt.val = NULL;
         rte_free(val.val);
         return 0;
 }

--
2.34.1

author
#10 lore raw

PATCH v2 1/1 examples/fips_validation: fix dangling pointer for SHA and SHAKE test

In reply to Emma Finn

Set vector pointer to NULL after free to avoid calling rte_free() on the same pointer twice in some cases.

---
v2:
* add fix to mct_shake_test

---
 examples/fips_validation/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
examples/fips_validation/main.c +2 -1
index daf273bc85..2b6d55aa51 100644
@@ -2610,7 +2610,7 @@ fips_mct_sha_test(void)
 		rte_free(md[i].val);
 
 	rte_free(vec.pt.val);
-
+	vec.pt.val = NULL;
 	rte_free(val.val);
 	return 0;
 }
@@ -2698,6 +2698,7 @@ fips_mct_shake_test(void)
 
 	rte_free(md.val);
 	rte_free(vec.pt.val);
+	vec.pt.val = NULL;
 	rte_free(val.val);
 	return 0;
 }
Signature · 1 line
2.43.0