DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <gakhil@marvell.com>
To: Przemyslaw Zegan <przemyslawx.zegan@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "roy.fan.zhang@intel.com" <roy.fan.zhang@intel.com>,
	"pablo.de.lara.guarch@intel.com" <pablo.de.lara.guarch@intel.com>
Subject: Re: [dpdk-dev] [EXT] [dpdk-dev v2] app: fix buffer overrun
Date: Tue, 5 Oct 2021 14:45:45 +0000	[thread overview]
Message-ID: <CO6PR18MB44843DB410B7D73599C80422D8AF9@CO6PR18MB4484.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20210922101511.10395-1-przemyslawx.zegan@intel.com>

> 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.


  reply	other threads:[~2021-10-05 14:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 13:21 [dpdk-dev] [PATCH] " 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   ` Akhil Goyal [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO6PR18MB44843DB410B7D73599C80422D8AF9@CO6PR18MB4484.namprd18.prod.outlook.com \
    --to=gakhil@marvell.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=przemyslawx.zegan@intel.com \
    --cc=roy.fan.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).