From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 10610A0C4C; Tue, 21 Sep 2021 15:22:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED18540DF8; Tue, 21 Sep 2021 15:22:00 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id B1DFD4003C for ; Tue, 21 Sep 2021 15:21:59 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10113"; a="220158556" X-IronPort-AV: E=Sophos;i="5.85,311,1624345200"; d="scan'208";a="220158556" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2021 06:21:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,311,1624345200"; d="scan'208";a="549483171" Received: from silpixa00400308.ir.intel.com ([10.237.214.190]) by FMSMGA003.fm.intel.com with ESMTP; 21 Sep 2021 06:21:55 -0700 From: Przemyslaw Zegan To: dev@dpdk.org Cc: gakhil@marvell.com, roy.fan.zhang@intel.com, Przemyslaw Zegan , pbhagavatula@marvell.com Date: Tue, 21 Sep 2021 14:21:25 +0100 Message-Id: <20210921132125.6109-1-przemyslawx.zegan@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] app: fix buffer overrun X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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.