Return-Path: Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 23144C0032 for ; Fri, 27 Oct 2023 03:12:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id E191060F8B for ; Fri, 27 Oct 2023 03:12:45 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E191060F8B Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Ryyc/uhG X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -2.801 X-Spam-Level: X-Spam-Status: No, score=-2.801 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SKcLUlRAvHMg for ; Fri, 27 Oct 2023 03:12:45 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by smtp3.osuosl.org (Postfix) with ESMTPS id 3BAB6600BB for ; Fri, 27 Oct 2023 03:12:45 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 3BAB6600BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698376365; x=1729912365; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VSVlpAN/muaagpk0w3qAzhzUsJiu2rUHn22Ot91+HdI=; b=Ryyc/uhGMiNzoZCxchSF9jI6yWunt50b1IszF5Eb4lZ0wx8qHvFKQvCv 5RCWvS3t1q0+0T8WkmlLKO6lDhc+0G85PIEL4INfgcrFcllcPnSGs+IcK dS0hcuEIS1AEHRXIKy2xzwoiFzjFlq7OuXPNSZmt27/BP+Fo33vqlPCLe IG9xrNh/35PBrAMMt/Hx+DMazriMwRK7GlokMBsBhBztJeLUYCFxSMPVd zWG3sNJIuklitCSZbiR9nbNELQzZv4zk9o/SO+ZRCKMoEx4uJWkEB0ut6 AlOt7wyp6bjcW3cuJRySGmuhCnTcMPLPwXHoDdnHUNfwQX2HNxNpwxWoc Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="387514701" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="387514701" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 20:12:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="1006617241" X-IronPort-AV: E=Sophos;i="6.03,255,1694761200"; d="scan'208";a="1006617241" Received: from aocl-server2.sh.intel.com ([10.239.164.24]) by fmsmga006.fm.intel.com with ESMTP; 26 Oct 2023 20:12:41 -0700 From: "Guo, Lingyan" To: accel-config@lists.linuxfoundation.org, ramesh.thomas@intel.com, fenghua.yu@intel.com Date: Fri, 27 Oct 2023 11:06:52 +0800 Message-Id: <20231027030655.17022-5-lingyan.guo@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027030655.17022-1-lingyan.guo@intel.com> References: <20231027030655.17022-1-lingyan.guo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 27 Oct 2023 15:06:11 +0000 Cc: lingyan Subject: [Accel-config] [PATCH 5/8] add protection src buffer for iaa scan X-BeenThere: accel-config@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: accel-config List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Oct 2023 03:12:46 -0000 From: lingyan change: init scan input buffer and copy to src1 src1 will be overwrite by compress result Signed-off-by: lingyan --- test/iaa.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/test/iaa.c b/test/iaa.c index a83877a..3256cde 100644 --- a/test/iaa.c +++ b/test/iaa.c @@ -305,11 +305,19 @@ static int init_scan(struct task *tsk, int tflags, tsk->test_flags = tflags; tsk->xfer_size = src1_xfer_size; + // Enough space for Chain decompress result + tsk->input = aligned_alloc(ADDR_ALIGNMENT, src1_xfer_size); + if (!tsk->input) + return -ENOMEM; + for (i = 0; i < (src1_xfer_size / 4); i++) + ((uint32_t *)tsk->input)[i] = pattern++; + tsk->src1 = aligned_alloc(ADDR_ALIGNMENT, src1_xfer_size); if (!tsk->src1) return -ENOMEM; - for (i = 0; i < (src1_xfer_size / 4); i++) - ((uint32_t *)tsk->src1)[i] = pattern++; + memset_pattern(tsk->src1, 0, src1_xfer_size); + memcpy(tsk->src1, tsk->input, src1_xfer_size); + tsk->src2 = aligned_alloc(32, IAA_FILTER_AECS_SIZE); if (!tsk->src2) @@ -2489,8 +2497,8 @@ int task_result_verify_scan(struct task *tsk, int mismatch_expected) if (mismatch_expected) warn("invalid arg mismatch_expected for %d\n", tsk->opcode); - - expected_len = iaa_do_scan(tsk->output, tsk->src1, tsk->src2, + // input , src2 unchange for w/wo chaining + expected_len = iaa_do_scan(tsk->output, tsk->input, tsk->src2, tsk->iaa_num_inputs, tsk->iaa_filter_flags); rc = memcmp(tsk->dst1, tsk->output, expected_len); -- 2.34.1