From patchwork Wed Jun 30 12:46:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gujjar, Abhinandan S" X-Patchwork-Id: 95077 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D4B2EA0A0F; Wed, 30 Jun 2021 14:49:21 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B59134127C; Wed, 30 Jun 2021 14:47:44 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 6542041277 for ; Wed, 30 Jun 2021 14:47:43 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="208160819" X-IronPort-AV: E=Sophos;i="5.83,312,1616482800"; d="scan'208";a="208160819" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2021 05:47:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,312,1616482800"; d="scan'208";a="447453358" Received: from unknown (HELO localhost.localdomain) ([10.190.210.97]) by orsmga007.jf.intel.com with ESMTP; 30 Jun 2021 05:47:37 -0700 From: Abhinandan Gujjar To: dev@dpdk.org, jerinj@marvell.com Cc: gakhil@marvell.com, abhinandan.gujjar@intel.com, ciara.power@intel.com Date: Wed, 30 Jun 2021 18:16:37 +0530 Message-Id: <20210630124637.2987722-1-abhinandan.gujjar@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] test: fix crypto_op length for sessionless case 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" Currently, private_data_offset for the sessionless is computed wrongly which includes extra bytes added because of using sizeof(struct rte_crypto_sym_xform) * 2) instead of (sizeof(union rte_event_crypto_metadata)). Due to this buffer overflow, the corruption was leading to test application crash while freeing the ops mempool. Fixes: 3c2c535ecfc0 ("test: add event crypto adapter auto-test") Reported-by: ciara.power@intel.com Signed-off-by: Abhinandan Gujjar --- app/test/test_event_crypto_adapter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index f689bc1f2..688ac0b2f 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -229,7 +229,7 @@ test_op_forward_mode(uint8_t session_less) first_xform = &cipher_xform; sym_op->xform = first_xform; uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH + - (sizeof(struct rte_crypto_sym_xform) * 2); + (sizeof(union rte_event_crypto_metadata)); op->private_data_offset = len; /* Fill in private data information */ rte_memcpy(&m_data.response_info, &response_info, @@ -424,7 +424,7 @@ test_op_new_mode(uint8_t session_less) first_xform = &cipher_xform; sym_op->xform = first_xform; uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH + - (sizeof(struct rte_crypto_sym_xform) * 2); + (sizeof(union rte_event_crypto_metadata)); op->private_data_offset = len; /* Fill in private data information */ rte_memcpy(&m_data.response_info, &response_info,