patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] examples/ipsec-secgw: fix partial overflow
@ 2023-11-15 12:31 Brian Dooley
  2023-11-15 16:24 ` Power, Ciara
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Dooley @ 2023-11-15 12:31 UTC (permalink / raw)
  To: dev
  Cc: Brian Dooley, sergio.gonzalez.monroy, stable, Radu Nicolau, Akhil Goyal

Case of partial overflow detected with ASan. Added extra padding
to cdev_key structure.

This structure is used for the key in hash table.
Padding is added to force the struct to use 8 bytes,
to ensure memory is notread past this structs boundary
(the hash key calculation reads 8 bytes if this struct is size 5 bytes).
The padding should be zeroed.
If fields are modified in this struct, the padding must be updated to
ensure multiple of 8 bytes size overall.

Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application")
Cc: sergio.gonzalez.monroy@intel.com
Cc: stable@dpdk.org

Signed-off-by: Brian Dooley <brian.dooley@intel.com>
---
 examples/ipsec-secgw/ipsec.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 5059418456..10e7fc179b 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -249,11 +249,21 @@ struct offloads {
 
 extern struct offloads tx_offloads;
 
+/*
+ * This structure is used for the key in hash table.
+ * Padding is added to force the struct to use 8 bytes,
+ * to ensure memory is notread past this structs boundary
+ * (the hash key calculation reads 8 bytes if this struct is size 5 bytes).
+ * The padding should be zeroed.
+ * If fields are modified in this struct, the padding must be updated to
+ * ensure multiple of 8 bytes size overall.
+ */
 struct cdev_key {
 	uint16_t lcore_id;
 	uint8_t cipher_algo;
 	uint8_t auth_algo;
 	uint8_t aead_algo;
+	uint8_t padding[3];
 };
 
 struct socket_ctx {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-23 10:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 12:31 [PATCH] examples/ipsec-secgw: fix partial overflow Brian Dooley
2023-11-15 16:24 ` Power, Ciara
2023-11-22 16:37   ` Thomas Monjalon
2023-11-23 10:48     ` Dooley, Brian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).