From patchwork Fri Feb 11 12:56:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, ZhiminX" X-Patchwork-Id: 107332 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 2FCA0A00BE; Fri, 11 Feb 2022 05:30:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 04EFC410E5; Fri, 11 Feb 2022 05:30:36 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 6928840DF5 for ; Fri, 11 Feb 2022 05:30:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644553834; x=1676089834; h=from:to:cc:subject:date:message-id; bh=Y4wGEwSs2hAu27Q4r9i018GE7N5u9Z8/YwNtzdp90YI=; b=THoviFeV2wqdHKPyXi0iT749B0dbpIaPU3RnGrLOyt+XBjp3p5EXrwy6 6EEqAQ+R0zSV5IQ46roRUfkrdxyen5p0rfaJ69BdHoiVh4IsyUL4UiP4E G292xjQglWWFRBWiK8iqwDwyaVStJE+dd5GPeBH9Ykm/gamZD37GL7V/W NWJi2Yz89rEQJPqbNTb0yTb1eYQvjnQ0WeEnAyEkoluoGYuY8qidJ7n0z WegFpzG8WN3Sgz0RqZ8YTed83/iGXuMuzL52QO39MpEag1JWyRUHxmRRd yzJ+cx9PdihrtWqU8+S+a34rj3tdFukl/AvD2Jj0jMFGajORAmRjXQaQc A==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="336079969" X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="336079969" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 20:30:33 -0800 X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="526808582" Received: from unknown (HELO localhost.localdomain) ([10.239.251.93]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 20:30:31 -0800 From: Zhimin Huang To: dts@dpdk.org Cc: Zhimin Huang Subject: [dts] [PATCH V1 1/3] test_plans/asan_smoke_test_plan:add asan smoke test plan Date: Fri, 11 Feb 2022 20:56:57 +0800 Message-Id: <20220211125659.27350-1-zhiminx.huang@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org add asan smoke test plan. Signed-off-by: Zhimin Huang --- test_plans/asan_smoke_test_plan.rst | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 test_plans/asan_smoke_test_plan.rst diff --git a/test_plans/asan_smoke_test_plan.rst b/test_plans/asan_smoke_test_plan.rst new file mode 100644 index 00000000..e7d05a19 --- /dev/null +++ b/test_plans/asan_smoke_test_plan.rst @@ -0,0 +1,74 @@ +.. Copyright (c) <2022>, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + +=========================== +AddressSanitizer Smoke Test +=========================== + +Description +=========== + +AddressSanitizer (ASan) is a fast memory error detector,it is a widely-used debugging tool to detect memory access errors. + + - `AddressSanitizer` + - It finds use-after-free, various kinds of buffer overruns in dpdk, and printing out detailed debug information + whenever an error is detected. + - ASAN is integrated with gcc and clang, and use meson option '-Db_sanitize=address' to enable. + +Prerequisites +============= + +1. NIC requires: + + - Intel ethernet cards: niantic/fortville/columbiaville,etc + +2. Software:: + + dpdk: http://dpdk.org/git/dpdk. + scapy: http://www.secdev.org/projects/scapy/ + +Test Case: RX/TX test with ASan enable +====================================== + +1. Build dpdk with ASan tool, add "-Dbuildtype=debug -Db_lundef=false -Db_sanitize=address" + in meson build system could enable ASan tool, such as below:: + + CC=gcc meson -Denable_kmods=True -Dlibdir=lib -Dbuildtype=debug -Db_lundef=false -Db_sanitize=address --default-library=static x86_64-native-linuxapp-gcc + ninja -C x86_64-native-linuxapp-gcc -j 70 + +2. Bind NIC port to vfio-pci. + +3. Setup testpmd, check testpmd could launch successfully and don't have "heap-buffer-overflow", "use-after-free" memory errors. + +4. Set mac forward mode. + +5. Send packet and check testpmd forward packet successfully. \ No newline at end of file From patchwork Fri Feb 11 12:56:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, ZhiminX" X-Patchwork-Id: 107333 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 2C65FA00C2; Fri, 11 Feb 2022 05:30:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 21532411FB; Fri, 11 Feb 2022 05:30:37 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 0F3DA40DF5 for ; Fri, 11 Feb 2022 05:30:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644553835; x=1676089835; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=AjGWDMVI0fyaoV+jpqUPJKFyOIlLNivxdJn4kmu4HdQ=; b=fRChVbhCl2QCuYOA1oJa5oWXa8+F0A66wC7zXtEaJ9RIpOFNIXkHqNha LCVdau/8CWcbpphKlgasSQRSGAcAal3xg3xc3g8Dso3UdTvleNse08NeV isUWKFO44e5U4+BG57GW9b3DGwV5kgcGCj97/Rgz5JosXP9iL3bnFDtEL +Bj8hjJY/TdKcd4jMqQ2dV/EK9pSnlIqMbsf83hIQVrhajbXg8vw+L0ky pm3QqNm9BlLEjrj/mbJSR38Ya9r04CqPG04z5Ju9V2onmrq6Pa/fUlzrY 6kYYarcEXTkSwEQr1a9JBngCO+xFO8/m6mOHyhaB7vPXJ3abeUvGqQ/bN Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="336079975" X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="336079975" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 20:30:34 -0800 X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="526808604" Received: from unknown (HELO localhost.localdomain) ([10.239.251.93]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 20:30:33 -0800 From: Zhimin Huang To: dts@dpdk.org Cc: Zhimin Huang Subject: [dts] [PATCH V1 2/3] test_plans/index:add new suite Date: Fri, 11 Feb 2022 20:56:58 +0800 Message-Id: <20220211125659.27350-2-zhiminx.huang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220211125659.27350-1-zhiminx.huang@intel.com> References: <20220211125659.27350-1-zhiminx.huang@intel.com> X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org add new testplan to index. Signed-off-by: Zhimin Huang --- test_plans/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/test_plans/index.rst b/test_plans/index.rst index e3511caa..89571ffe 100644 --- a/test_plans/index.rst +++ b/test_plans/index.rst @@ -38,6 +38,7 @@ The following are the test plans for the DPDK DTS automated test system. :numbered: ABI_stable_test_plan + asan_smoke_test_plan blocklist_test_plan checksum_offload_test_plan coremask_test_plan From patchwork Fri Feb 11 12:56:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, ZhiminX" X-Patchwork-Id: 107334 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 48A26A00C5; Fri, 11 Feb 2022 05:30:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3F01B411ED; Fri, 11 Feb 2022 05:30:38 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 69158411ED for ; Fri, 11 Feb 2022 05:30:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644553836; x=1676089836; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=MHeEJPFpdSanGTTZKb5ah9Mdf4Jx+8bRX7Uw7uj+Jw8=; b=kEmCy+edvwJKq3Byp3Jui4LCslU7iy6wCMNy5kRUIZPfopIRtrmT7Id3 NezUAyMafIq6AHmlu/gWDm+8wr0CtlZ0j/1AvW1+aUUAxCmPhkFbooy1l RlcaZB1R8t78oEOdprStBJJBi0o5UTpqum0byHrzklq8rRUzKdl1dLISp PBrC4aiGDP7HasfOZlwtN8CwsJHvSzgCdbFk7Pu2i+9pegmzFTSodXbqv PzVm0QfSQ+uTuAzGyCLBAOVhnBBvzEKMiJRMRng9AYpKNnLgZix5joCm1 7pEb/EIHZbU8yK9F98VSh8YADKJKNpN4t0FUkM6E7aGEpDPZuYQ/z52av g==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="336079983" X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="336079983" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 20:30:35 -0800 X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="526808619" Received: from unknown (HELO localhost.localdomain) ([10.239.251.93]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 20:30:34 -0800 From: Zhimin Huang To: dts@dpdk.org Cc: Zhimin Huang Subject: [dts] [PATCH V1 3/3] tests/asan_smoke:add asan smoke test suite Date: Fri, 11 Feb 2022 20:56:59 +0800 Message-Id: <20220211125659.27350-3-zhiminx.huang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220211125659.27350-1-zhiminx.huang@intel.com> References: <20220211125659.27350-1-zhiminx.huang@intel.com> X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org add asan smoke test suite. Signed-off-by: Zhimin Huang Acked-by: Xueqin Lin --- tests/TestSuite_asan_smoke.py | 107 ++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 tests/TestSuite_asan_smoke.py diff --git a/tests/TestSuite_asan_smoke.py b/tests/TestSuite_asan_smoke.py new file mode 100644 index 00000000..fc876da6 --- /dev/null +++ b/tests/TestSuite_asan_smoke.py @@ -0,0 +1,107 @@ +# BSD LICENSE +# +# Copyright(c) 2022 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from .smoke_base import ( + DEFAULT_MTU_VALUE, + JUMBO_FRAME_LENGTH, + JUMBO_FRAME_MTU, + LAUNCH_QUEUE, + SmokeTest, +) +from framework.packet import Packet +from framework.pmd_output import PmdOutput +from framework.test_case import TestCase + +class TestAsanSmoke(TestCase): + + def set_up_all(self): + """ + Run at the start of each test suite. + Generic filter Prerequistites + """ + self.smoke_dut_ports = self.dut.get_ports(self.nic) + self.ports_pci = [self.dut.ports_info[self.smoke_dut_ports[0]]['pci']] + # Verify that enough ports are available + self.verify(len(self.smoke_dut_ports) >= 1, "Insufficient ports") + self.tester_port0 = self.tester.get_local_port(self.smoke_dut_ports[0]) + self.smoke_tester_nic = self.tester.get_interface(self.tester_port0) + self.smoke_tester_mac = self.tester.get_mac(self.smoke_dut_ports[0]) + self.smoke_dut_mac = self.dut.get_mac_address(self.smoke_dut_ports[0]) + self.cores = "1S/5C/1T" + # check core num + core_list = self.dut.get_core_list(self.cores) + self.verify(len(core_list) >= 5, "Insufficient cores for testing") + + # init Packet(), SmokeTest(), PmdOutput() + self.pkt = Packet() + self.smoke_base = SmokeTest(self) + self.pmd_out = PmdOutput(self.dut) + + # build dpdk with asan tool + self.dut.build_install_dpdk(target=self.target, + extra_options="-Dbuildtype=debug -Db_lundef=false -Db_sanitize=address") + + def set_up(self): + """ + Run before each test case. + """ + pass + + def tear_down(self): + """ + Run after each test case. + """ + self.pmd_out.execute_cmd("stop") + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.send_expect("quit", "#") + self.dut.kill_all() + self.dut.build_install_dpdk(self.target) + + def check_testpmd_status(self): + cmd = "ps -aux | grep testpmd | grep -v grep" + out = self.dut.send_expect(cmd, "#", 15, alt_session=True) + self.verify("testpmd" in out, "After build dpdk with ASan, start testpmd failed") + + def test_rxtx_with_asan_enable(self): + out = self.pmd_out.start_testpmd(cores=self.cores, ports=self.ports_pci) + self.check_testpmd_status() + self.verify(all([error_key not in out for error_key in ['heap-buffer-overflow', 'use-after-free']]), + "the testpmd have error key words") + self.pmd_out.execute_cmd("set fwd mac") + self.pmd_out.execute_cmd("set verbose 1") + self.pmd_out.execute_cmd("start") + queues, stats = self.smoke_base.send_pkg_return_stats() + self.verify(stats['RX-packets'] != 0 and stats['RX-packets'] == stats['TX-packets'], "RX-packets: {} " + "TX-packets : {}, rx tx test failed".format(stats['RX-packets'], stats['TX-packets'])) \ No newline at end of file