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 9A3B8A00C3; Fri, 7 Oct 2022 15:47:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AFED842B82; Fri, 7 Oct 2022 15:47:07 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id AE48D40042 for ; Fri, 7 Oct 2022 15:47:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665150425; x=1696686425; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kqub+7FKR/7XKv8tN0wbaFn5+qRhVItfGHksWl6lWjc=; b=FQsvX8+1rSKugi1gpHtFa78AdHkJK1RYA6oRcn/Fwz0Iohh51zql3EuB Rk1O4cGJ0ES73X4X+HVm2Og9GGk8jxw5SPqY25iIUMCGHRCbr7X04iAp+ hHmgvQ94zjW8YO1F54hxKgIieqTVptGY2dwYBRe23HyDZBqu5S/x8xPcl AyEe2iMvXyTJ/1l2EMAq6VZr0Mc1eUhRB4BtMoxCpNe+JD38OUmQ2+K/y ZA9rP2OJhRmSTLLtS90M0JoMeiMYjFU9fOHLpS6kA1gGMnlD1e3u6MUMr cTyVzzdguBGpv01zhvKo0gwU9mAceIcwm43euB2but8f2pHKZHfM43bW0 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="390032310" X-IronPort-AV: E=Sophos;i="5.95,166,1661842800"; d="scan'208";a="390032310" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2022 06:47:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10493"; a="625150221" X-IronPort-AV: E=Sophos;i="5.95,166,1661842800"; d="scan'208";a="625150221" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.163]) by orsmga002.jf.intel.com with ESMTP; 07 Oct 2022 06:47:03 -0700 From: Ciara Power To: Akhil Goyal , Fan Zhang Cc: dev@dpdk.org, kai.ji@intel.com, Ciara Power , Fan Zhang , Pablo de Lara Subject: [PATCH v5 1/4] test/crypto: fix wireless auth digest segment Date: Fri, 7 Oct 2022 13:46:50 +0000 Message-Id: <20221007134653.929034-2-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221007134653.929034-1-ciara.power@intel.com> References: <20220812132334.75707-1-ciara.power@intel.com> <20221007134653.929034-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The segment size for some tests was too small to hold the auth digest. This caused issues when using op->sym->auth.digest.data for comparisons in AESNI_MB PMD after a subsequent patch enables SGL. For example, if segment size is 2, and digest size is 4, then 4 bytes are read from op->sym->auth.digest.data, which overflows into the memory after the segment, rather than using the second segment that contains the remaining half of the digest. Fixes: 11c5485bb276 ("test/crypto: add scatter-gather tests for IP and OOP") Signed-off-by: Ciara Power Acked-by: Fan Zhang Acked-by: Pablo de Lara --- v4: Added failure check when appending digest size to buffer. --- app/test/test_cryptodev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index c6d47a035e..203b8b61fa 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2990,6 +2990,16 @@ create_wireless_algo_auth_cipher_operation( remaining_off -= rte_pktmbuf_data_len(sgl_buf); sgl_buf = sgl_buf->next; } + + /* The last segment should be large enough to hold full digest */ + if (sgl_buf->data_len < auth_tag_len) { + rte_pktmbuf_free(sgl_buf->next); + sgl_buf->next = NULL; + TEST_ASSERT_NOT_NULL(rte_pktmbuf_append(sgl_buf, + auth_tag_len - sgl_buf->data_len), + "No room to append auth tag"); + } + sym_op->auth.digest.data = rte_pktmbuf_mtod_offset(sgl_buf, uint8_t *, remaining_off); sym_op->auth.digest.phys_addr = rte_pktmbuf_iova_offset(sgl_buf, -- 2.25.1