* [dpdk-dev] [PATCH] app: fix buffer overrun
@ 2021-09-21 13:21 Przemyslaw Zegan
2021-09-21 14:41 ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
2021-09-22 10:15 ` [dpdk-dev] [dpdk-dev v2] " Przemyslaw Zegan
0 siblings, 2 replies; 9+ messages in thread
From: Przemyslaw Zegan @ 2021-09-21 13:21 UTC (permalink / raw)
To: dev; +Cc: gakhil, roy.fan.zhang, Przemyslaw Zegan, pbhagavatula
This patch fixes a possible buffer overrun problem in crypto perf test.
Previously when user configured aad size is over 12 bytes the copy of template aad will cause a buffer overrun.
The problem is fixed by only copy up to 12 bytes of aad template.
Fixes: 761a321acf91 ("event/cnxk: support vectorized Tx event fast path" )
Cc: pbhagavatula@marvell.com
Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
---
app/test-crypto-perf/cperf_test_vectors.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index 0af01ff911..2c7e314ec8 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -548,12 +548,16 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
t_vec->aead_key.data = aead_key;
if (options->aead_aad_sz) {
- t_vec->aad.data = rte_malloc(NULL,
+ t_vec->aad.data = rte_zmalloc(NULL,
options->aead_aad_sz, 16);
if (t_vec->aad.data == NULL) {
rte_free(t_vec);
return NULL;
}
+
+ if(options->aead_aad_sz > 12)
+ options->aead_aad_sz = 12;
+
memcpy(t_vec->aad.data, aad, options->aead_aad_sz);
t_vec->aad.phys_addr = rte_malloc_virt2iova(t_vec->aad.data);
t_vec->aad.length = options->aead_aad_sz;
--
2.17.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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [EXT] [PATCH] app: fix buffer overrun
2021-09-21 13:21 [dpdk-dev] [PATCH] app: fix buffer overrun Przemyslaw Zegan
@ 2021-09-21 14:41 ` Pavan Nikhilesh Bhagavatula
2021-09-22 10:15 ` [dpdk-dev] [dpdk-dev v2] " Przemyslaw Zegan
1 sibling, 0 replies; 9+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2021-09-21 14:41 UTC (permalink / raw)
To: Przemyslaw Zegan, dev; +Cc: Akhil Goyal, roy.fan.zhang
>This patch fixes a possible buffer overrun problem in crypto perf test.
>Previously when user configured aad size is over 12 bytes the copy of
>template aad will cause a buffer overrun.
>The problem is fixed by only copy up to 12 bytes of aad template.
>
>Fixes: 761a321acf91 ("event/cnxk: support vectorized Tx event fast
>path" )
>Cc: pbhagavatula@marvell.com
>
I don't see how the above mentioned patch is related to test-crypto-perf.
Could you please recheck?
>Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
>---
> app/test-crypto-perf/cperf_test_vectors.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-
>crypto-perf/cperf_test_vectors.c
>index 0af01ff911..2c7e314ec8 100644
>--- a/app/test-crypto-perf/cperf_test_vectors.c
>+++ b/app/test-crypto-perf/cperf_test_vectors.c
>@@ -548,12 +548,16 @@ cperf_test_vector_get_dummy(struct
>cperf_options *options)
> t_vec->aead_key.data = aead_key;
>
> if (options->aead_aad_sz) {
>- t_vec->aad.data = rte_malloc(NULL,
>+ t_vec->aad.data = rte_zmalloc(NULL,
> options->aead_aad_sz, 16);
> if (t_vec->aad.data == NULL) {
> rte_free(t_vec);
> return NULL;
> }
>+
>+ if(options->aead_aad_sz > 12)
>+ options->aead_aad_sz = 12;
>+
> memcpy(t_vec->aad.data, aad, options-
>>aead_aad_sz);
> t_vec->aad.phys_addr =
>rte_malloc_virt2iova(t_vec->aad.data);
> t_vec->aad.length = options->aead_aad_sz;
>--
>2.17.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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [dpdk-dev v2] app: fix buffer overrun
2021-09-21 13:21 [dpdk-dev] [PATCH] app: fix buffer overrun Przemyslaw Zegan
2021-09-21 14:41 ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
@ 2021-09-22 10:15 ` Przemyslaw Zegan
2021-10-05 14:45 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-11 8:04 ` [dpdk-dev] [dpdk-dev v3] " Przemyslaw Zegan
1 sibling, 2 replies; 9+ messages in thread
From: Przemyslaw Zegan @ 2021-09-22 10:15 UTC (permalink / raw)
To: dev; +Cc: gakhil, roy.fan.zhang, Przemyslaw Zegan, pablo.de.lara.guarch
This patch fixes a possible buffer overrun problem in crypto perf test.
Previously when user configured aad size is over 12 bytes the copy of template aad will cause a buffer overrun.
The problem is fixed by only copy up to 12 bytes of aad template.
Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
Cc: pablo.de.lara.guarch@intel.com
Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
---
v2:
- changed to correct fixed line.
app/test-crypto-perf/cperf_test_vectors.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index 0af01ff911..2c7e314ec8 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -548,12 +548,16 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
t_vec->aead_key.data = aead_key;
if (options->aead_aad_sz) {
- t_vec->aad.data = rte_malloc(NULL,
+ t_vec->aad.data = rte_zmalloc(NULL,
options->aead_aad_sz, 16);
if (t_vec->aad.data == NULL) {
rte_free(t_vec);
return NULL;
}
+
+ if(options->aead_aad_sz > 12)
+ options->aead_aad_sz = 12;
+
memcpy(t_vec->aad.data, aad, options->aead_aad_sz);
t_vec->aad.phys_addr = rte_malloc_virt2iova(t_vec->aad.data);
t_vec->aad.length = options->aead_aad_sz;
--
2.17.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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [EXT] [dpdk-dev v2] app: fix buffer overrun
2021-09-22 10:15 ` [dpdk-dev] [dpdk-dev v2] " Przemyslaw Zegan
@ 2021-10-05 14:45 ` Akhil Goyal
2021-10-11 8:04 ` [dpdk-dev] [dpdk-dev v3] " Przemyslaw Zegan
1 sibling, 0 replies; 9+ messages in thread
From: Akhil Goyal @ 2021-10-05 14:45 UTC (permalink / raw)
To: Przemyslaw Zegan, dev; +Cc: roy.fan.zhang, pablo.de.lara.guarch
> This patch fixes a possible buffer overrun problem in crypto perf test.
> Previously when user configured aad size is over 12 bytes the copy of
> template aad will cause a buffer overrun.
> The problem is fixed by only copy up to 12 bytes of aad template.
>
> Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
> Cc: pablo.de.lara.guarch@intel.com
>
> Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
> ---
> v2:
> - changed to correct fixed line.
>
> app/test-crypto-perf/cperf_test_vectors.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-
> perf/cperf_test_vectors.c
> index 0af01ff911..2c7e314ec8 100644
> --- a/app/test-crypto-perf/cperf_test_vectors.c
> +++ b/app/test-crypto-perf/cperf_test_vectors.c
> @@ -548,12 +548,16 @@ cperf_test_vector_get_dummy(struct
> cperf_options *options)
> t_vec->aead_key.data = aead_key;
>
> if (options->aead_aad_sz) {
> - t_vec->aad.data = rte_malloc(NULL,
> + t_vec->aad.data = rte_zmalloc(NULL,
> options->aead_aad_sz, 16);
> if (t_vec->aad.data == NULL) {
> rte_free(t_vec);
> return NULL;
> }
> +
> + if(options->aead_aad_sz > 12)
> + options->aead_aad_sz = 12;
Instead of hardcoding, shouldn't this be sizeof(aad)
> +
> memcpy(t_vec->aad.data, aad, options-
> >aead_aad_sz);
> t_vec->aad.phys_addr = rte_malloc_virt2iova(t_vec-
> >aad.data);
> t_vec->aad.length = options->aead_aad_sz;
> --
> 2.17.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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [dpdk-dev v3] app: fix buffer overrun
2021-09-22 10:15 ` [dpdk-dev] [dpdk-dev v2] " Przemyslaw Zegan
2021-10-05 14:45 ` [dpdk-dev] [EXT] " Akhil Goyal
@ 2021-10-11 8:04 ` Przemyslaw Zegan
2021-10-11 10:45 ` Zhang, Roy Fan
2021-10-12 12:56 ` [dpdk-dev] [dpdk-dev v4] " Przemyslaw Zegan
1 sibling, 2 replies; 9+ messages in thread
From: Przemyslaw Zegan @ 2021-10-11 8:04 UTC (permalink / raw)
To: dev; +Cc: gakhil, roy.fan.zhang, Przemyslaw Zegan, pablo.de.lara.guarch
This patch fixes a possible buffer overrun problem in crypto perf test.
Previously when user configured aad size is over 12 bytes the copy of template aad will cause a buffer overrun.
The problem is fixed by only copy up to 12 bytes of aad template.
Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
Cc: pablo.de.lara.guarch@intel.com
Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
---
v3:
- replaced hardcoded values by sizeof(aad)
app/test-crypto-perf/cperf_test_vectors.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index 2c7e314ec8..271e91c13c 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -555,8 +555,8 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
return NULL;
}
- if(options->aead_aad_sz > 12)
- options->aead_aad_sz = 12;
+ if(options->aead_aad_sz > sizeof(aad))
+ options->aead_aad_sz = sizeof(aad);
memcpy(t_vec->aad.data, aad, options->aead_aad_sz);
t_vec->aad.phys_addr = rte_malloc_virt2iova(t_vec->aad.data);
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [dpdk-dev v3] app: fix buffer overrun
2021-10-11 8:04 ` [dpdk-dev] [dpdk-dev v3] " Przemyslaw Zegan
@ 2021-10-11 10:45 ` Zhang, Roy Fan
2021-10-12 12:56 ` [dpdk-dev] [dpdk-dev v4] " Przemyslaw Zegan
1 sibling, 0 replies; 9+ messages in thread
From: Zhang, Roy Fan @ 2021-10-11 10:45 UTC (permalink / raw)
To: Zegan, PrzemyslawX, dev; +Cc: gakhil, De Lara Guarch, Pablo
> -----Original Message-----
> From: Zegan, PrzemyslawX <przemyslawx.zegan@intel.com>
> Sent: Monday, October 11, 2021 9:05 AM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Zhang, Roy Fan <roy.fan.zhang@intel.com>; Zegan,
> PrzemyslawX <przemyslawx.zegan@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Subject: [dpdk-dev v3] app: fix buffer overrun
>
> This patch fixes a possible buffer overrun problem in crypto perf test.
> Previously when user configured aad size is over 12 bytes the copy of
> template aad will cause a buffer overrun.
> The problem is fixed by only copy up to 12 bytes of aad template.
>
> Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
> Cc: pablo.de.lara.guarch@intel.com
>
> Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
> ---
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [dpdk-dev v4] app: fix buffer overrun
2021-10-11 8:04 ` [dpdk-dev] [dpdk-dev v3] " Przemyslaw Zegan
2021-10-11 10:45 ` Zhang, Roy Fan
@ 2021-10-12 12:56 ` Przemyslaw Zegan
2021-10-16 13:44 ` [dpdk-dev] [EXT] " Akhil Goyal
1 sibling, 1 reply; 9+ messages in thread
From: Przemyslaw Zegan @ 2021-10-12 12:56 UTC (permalink / raw)
To: dev; +Cc: gakhil, roy.fan.zhang, Przemyslaw Zegan, pablo.de.lara.guarch
This patch fixes a possible buffer overrun problem in crypto perf test.
Previously when user configured aad size is over 12 bytes the copy of template aad will cause a buffer overrun.
The problem is fixed by only copy up to 12 bytes of aad template.
Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
Cc: pablo.de.lara.guarch@intel.com
Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
---
v4:
- rebased on top of latest master
v3:
- replaced hardcoded values by sizeof(aad)
v2:
- changed to correct fixed line.
app/test-crypto-perf/cperf_test_vectors.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index 4bba405961..314e2b7710 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -590,6 +590,10 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
rte_free(t_vec);
return NULL;
}
+
+ if(options->aead_aad_sz > sizeof(aad))
+ options->aead_aad_sz = sizeof(aad);
+
memcpy(t_vec->aad.data, aad, options->aead_aad_sz);
t_vec->aad.phys_addr = rte_malloc_virt2iova(t_vec->aad.data);
t_vec->aad.length = options->aead_aad_sz;
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [EXT] [dpdk-dev v4] app: fix buffer overrun
2021-10-12 12:56 ` [dpdk-dev] [dpdk-dev v4] " Przemyslaw Zegan
@ 2021-10-16 13:44 ` Akhil Goyal
2021-10-16 13:46 ` Akhil Goyal
0 siblings, 1 reply; 9+ messages in thread
From: Akhil Goyal @ 2021-10-16 13:44 UTC (permalink / raw)
To: Przemyslaw Zegan, dev; +Cc: roy.fan.zhang, pablo.de.lara.guarch
> This patch fixes a possible buffer overrun problem in crypto perf test.
> Previously when user configured aad size is over 12 bytes the copy of
> template aad will cause a buffer overrun.
> The problem is fixed by only copy up to 12 bytes of aad template.
>
> Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
> Cc: pablo.de.lara.guarch@intel.com
>
> Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
> Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Applied to dpdk-next-crypto
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [EXT] [dpdk-dev v4] app: fix buffer overrun
2021-10-16 13:44 ` [dpdk-dev] [EXT] " Akhil Goyal
@ 2021-10-16 13:46 ` Akhil Goyal
0 siblings, 0 replies; 9+ messages in thread
From: Akhil Goyal @ 2021-10-16 13:46 UTC (permalink / raw)
To: Przemyslaw Zegan, dev; +Cc: roy.fan.zhang, pablo.de.lara.guarch, stable
> > This patch fixes a possible buffer overrun problem in crypto perf test.
> > Previously when user configured aad size is over 12 bytes the copy of
> > template aad will cause a buffer overrun.
> > The problem is fixed by only copy up to 12 bytes of aad template.
> >
> > Fixes: 8a5b494a7f99 ("app/test-crypto-perf: add AEAD parameters")
> > Cc: pablo.de.lara.guarch@intel.com
> >
> > Signed-off-by: Przemyslaw Zegan <przemyslawx.zegan@intel.com>
> > Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
> Applied to dpdk-next-crypto
Cc: stable@dpdk.org
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-10-16 13:46 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 13:21 [dpdk-dev] [PATCH] app: fix buffer overrun Przemyslaw Zegan
2021-09-21 14:41 ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
2021-09-22 10:15 ` [dpdk-dev] [dpdk-dev v2] " Przemyslaw Zegan
2021-10-05 14:45 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-11 8:04 ` [dpdk-dev] [dpdk-dev v3] " Przemyslaw Zegan
2021-10-11 10:45 ` Zhang, Roy Fan
2021-10-12 12:56 ` [dpdk-dev] [dpdk-dev v4] " Przemyslaw Zegan
2021-10-16 13:44 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-16 13:46 ` Akhil Goyal
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).